Loading...
Searching...
No Matches
CompositeNumber.h
Go to the documentation of this file.
//# CompositeNumber.h: generate a composite number
//# Copyright (C) 2000
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: casa-feedback@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
#ifndef CASA_COMPOSITENUMBER_H
#define CASA_COMPOSITENUMBER_H
//# Includes
#include <casacore/casa/aips.h>
#include <casacore/casa/Containers/Block.h>
namespace casacore { //# NAMESPACE CASACORE - BEGIN
// <summary> This class generates composite numbers </summary>
// <use visibility=export>
// <synopsis>
// This class generates a list of composite numbers made up
// of powers of 2, 3, and 5, which are less than
// some max value and returns the smallest composite number greater
// than some number given.
// </synopsis>
// <example>
// <srcblock>
// CompositeNumber cn(1000);
// Int n = cn.nextLarger(319);
// Int m = cn.nextSmaller(462);
// Int l = cn.nearest(462);
// </srcblock>
// </example>
class CompositeNumber
{
public:
// constructor:
// Note: if you later make a call with value > maxval, we
// will recalculate the list of composite numbers
CompositeNumber (const uInt maxval = 8192);
// destructor
~CompositeNumber();
// return the next larger composite number
uInt nextLarger(const uInt value);
// return the next smaller composite number
uInt nextSmaller(const uInt value);
// return the nearest composite number
uInt nearest(const uInt value);
// return the next larger even composite number
uInt nextLargerEven(const uInt value);
// return the next smaller even composite number
uInt nextSmallerEven(const uInt value);
// return the closest even composite number
uInt nearestEven(const uInt value);
// returns True is value is composite
Bool isComposite(const uInt value);
private:
Block<uInt> itsNumbers;
uInt itsMaxComplete;
void generate(const uInt maxval);
};
} //# NAMESPACE CASACORE - END
#endif
casacore::Block
Definition Block.h:140
casacore::CompositeNumber::nearest
uInt nearest(const uInt value)
return the nearest composite number
casacore::CompositeNumber::nextSmallerEven
uInt nextSmallerEven(const uInt value)
return the next smaller even composite number
casacore::CompositeNumber::generate
void generate(const uInt maxval)
casacore::CompositeNumber::nextLargerEven
uInt nextLargerEven(const uInt value)
return the next larger even composite number
casacore::CompositeNumber::itsMaxComplete
uInt itsMaxComplete
Definition CompositeNumber.h:90
casacore::CompositeNumber::~CompositeNumber
~CompositeNumber()
destructor
casacore::CompositeNumber::nextLarger
uInt nextLarger(const uInt value)
return the next larger composite number
casacore::CompositeNumber::itsNumbers
Block< uInt > itsNumbers
Definition CompositeNumber.h:89
casacore::CompositeNumber::nearestEven
uInt nearestEven(const uInt value)
return the closest even composite number
casacore::CompositeNumber::CompositeNumber
CompositeNumber(const uInt maxval=8192)
constructor: Note: if you later make a call with value > maxval, we will recalculate the list of comp...
casacore::CompositeNumber::isComposite
Bool isComposite(const uInt value)
returns True is value is composite
casacore::CompositeNumber::nextSmaller
uInt nextSmaller(const uInt value)
return the next smaller composite number
casacore
this file contains all the compiler specific defines
Definition mainpage.dox:28
casacore::uInt
unsigned int uInt
Definition aipstype.h:49
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
casacore::value
NewDelAllocator< T > NewDelAllocator< T >::value
Definition Allocator.h:369