casacore
CompositeNumber.h
Go to the documentation of this file.
1 //# CompositeNumber.h: generate a composite number
2 //# Copyright (C) 2000
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef CASA_COMPOSITENUMBER_H
29 #define CASA_COMPOSITENUMBER_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
33 #include <casacore/casa/Containers/Block.h>
34 
35 namespace casacore { //# NAMESPACE CASACORE - BEGIN
36 
37 // <summary> This class generates composite numbers </summary>
38 // <use visibility=export>
39 
40 // <synopsis>
41 // This class generates a list of composite numbers made up
42 // of powers of 2, 3, and 5, which are less than
43 // some max value and returns the smallest composite number greater
44 // than some number given.
45 // </synopsis>
46 
47 // <example>
48 // <srcblock>
49 // CompositeNumber cn(1000);
50 // Int n = cn.nextLarger(319);
51 // Int m = cn.nextSmaller(462);
52 // Int l = cn.nearest(462);
53 // </srcblock>
54 // </example>
55 
56 
58 {
59 public:
60  // constructor:
61  // Note: if you later make a call with value > maxval, we
62  // will recalculate the list of composite numbers
63  CompositeNumber (const uInt maxval = 8192);
64 
65  // destructor
67 
68  // return the next larger composite number
69  uInt nextLarger(const uInt value);
70 
71  // return the next smaller composite number
72  uInt nextSmaller(const uInt value);
73 
74  // return the nearest composite number
75  uInt nearest(const uInt value);
76 
77  // return the next larger even composite number
79 
80  // return the next smaller even composite number
82 
83  // return the closest even composite number
84  uInt nearestEven(const uInt value);
85 
86  // returns True is value is composite
87  Bool isComposite(const uInt value);
88 
89  private:
90 
93 
94  void generate(const uInt maxval);
95 
96 };
97 
98 
99 } //# NAMESPACE CASACORE - END
100 
101 #endif
casacore::CompositeNumber
This class generates composite numbers.
Definition: CompositeNumber.h:57
casacore::CompositeNumber::nextSmaller
uInt nextSmaller(const uInt value)
return the next smaller composite number
casacore::CompositeNumber::nextSmallerEven
uInt nextSmallerEven(const uInt value)
return the next smaller even composite number
casacore::CompositeNumber::nextLargerEven
uInt nextLargerEven(const uInt value)
return the next larger even composite number
casacore::value
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
casacore::CompositeNumber::~CompositeNumber
~CompositeNumber()
destructor
casacore::CompositeNumber::nextLarger
uInt nextLarger(const uInt value)
return the next larger composite number
casacore::uInt
unsigned int uInt
Definition: aipstype.h:51
casacore::CompositeNumber::itsNumbers
Block< uInt > itsNumbers
Definition: CompositeNumber.h:91
casacore::CompositeNumber::itsMaxComplete
uInt itsMaxComplete
Definition: CompositeNumber.h:92
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Block< uInt >
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::generate
void generate(const uInt maxval)
casacore::CompositeNumber::isComposite
Bool isComposite(const uInt value)
returns True is value is composite
casacore::CompositeNumber::nearestEven
uInt nearestEven(const uInt value)
return the closest even composite number
casacore::CompositeNumber::nearest
uInt nearest(const uInt value)
return the nearest composite number