casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FunctionOrder.h
Go to the documentation of this file.
1 //# FunctionOrder.h: Container of function description details
2 //# Copyright (C) 2002,2003
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 SCIMATH_FUNCTIONORDER_H
29 #define SCIMATH_FUNCTIONORDER_H
30 
31 //# Include files
32 #include <casacore/casa/aips.h>
38 #include <casacore/casa/iosfwd.h>
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 //# Forward declarations
43 class RecordInterface;
44 
45 // <summary> Container of function description details
46 // </summary>
47 //
48 // <use visibility=export>
49 //
50 // <reviewed reviewer="UNKNOWN" date="before2004/08/25"tFunctionOrder"
51 // demos="">
52 // </reviewed>
53 //
54 // <synopsis>
55 // <src>FunctionOrder</src> is used to provide an interface to an entity which
56 // has special fixed parameters (like dimension of Gaussian; oder of
57 // Polynomial).
58 // This is useful, for example, in implementinggeneric function factories.
59 //
60 // </synopsis>
61 //
62 // <example>
63 // See the <linkto class=FunctionHolder>FunctionHolder</linkto>
64 // class for a usage interface.
65 // </example>
66 //
67 // <motivation>
68 // Generically manipulatable parameters are important for Glish interface
69 // </motivation>
70 //
71 // <templating arg=T>
72 // <li> <src>T</src> must have a default constructor, assignment operator,
73 // and copy constructor (for the Vector interface).
74 // <li> Complex/DComplex or Float/Double supported
75 // </templating>
76 //
77 // <todo asof="2002/05/28">
78 // <li> Nothing I know of
79 // </todo>
80 
81 template<class T> class FunctionOrder : public RecordTransformable {
82  public:
83  //# Constructors
84  // Construct a default FunctionOrder with 0 parameters
85  FunctionOrder();
86  // Copy constructor (deep copy)
87  FunctionOrder(const FunctionOrder<T> &other);
88  // Destructor
89  virtual ~FunctionOrder();
90 
91  //# Operators
92  // Copy assignment (deep copy)
94 
95  //# Member functions
96  // Get and set the various parameters (no check for index range).
97  // Automatic extension for write.
98  // <group>
99  Int &getInt(const uInt n);
100  const Int &getInt(const uInt n) const;
101  T &getPar(const uInt n);
102  const T &getPar(const uInt n) const;
103  String &getString();
104  const String &getString() const;
105  T &getScale(const uInt n);
106  const T &getScale(const uInt n) const;
107  T &getCenter(const uInt n);
108  const T &getCenter(const uInt n) const;
109  T &getWidth(const uInt n);
110  const T &getWidth(const uInt n) const;
111  const Function<T> &getFunction(const uInt n) const;
112  void setFunction(const uInt n, Function<T> &other);
113  // </group>
114 
115  // Create a FunctionOrder from a record
116  // Error messages are postfixed to error.
117  // <group>
118  virtual Bool fromRecord(String &error, const RecordInterface &in);
119  virtual Bool fromString(String &error, const String &in);
120  // </group>
121  // Create a record from a FunctionOrder.
122  // Error messages are postfixed to error.
123  virtual Bool toRecord(String &error, RecordInterface &out) const;
124  // Get identification of record
125  virtual const String &ident() const;
126 
127  // Output the parameters
128  ostream &print(ostream &os) const;
129 
130  private:
131  //# Data
132  // All data vectors can be empty
133  // <group>
134  // Integer details (order etc)
136  // Double parameters
138  // String parameters
140  // List of functions (say for Combi and Compound)
142  // Scale of y (length 1)
144  // Centers of x (length ndim)
146  // Width of x (ndim)
148  // </group>
149 
150 };
151 
152 //# Global functions
153 // <summary> Global functions </summary>
154 // <group name=Output>
155 // Output declaration
156 template<class T>
157 ostream &operator<<(ostream &os, const FunctionOrder<T> &par);
158 // </group>
159 
160 //# Inlines
161 template<class T>
162 inline ostream &operator<<(ostream &os, const FunctionOrder<T> &par) {
163  return par.print(os); }
164 
165 
166 } //# NAMESPACE CASACORE - END
167 
168 #ifndef CASACORE_NO_AUTO_TEMPLATES
169 #include <casacore/scimath/Functionals/FunctionOrder.tcc>
170 #endif //# CASACORE_NO_AUTO_TEMPLATES
171 #endif
172 
virtual Bool fromString(String &error, const String &in)
Initialise the class from a String representation.
int Int
Definition: aipstype.h:50
T & getScale(const uInt n)
ostream & print(ostream &os) const
Output the parameters.
FunctionOrder & operator=(const FunctionOrder< T > &other)
Copy assignment (deep copy)
PtrBlock< Function< T > * > function_p
List of functions (say for Combi and Compound)
Vector< Int > int_p
All data vectors can be empty.
Interface class for converting to/from records.
T & getCenter(const uInt n)
void setFunction(const uInt n, Function< T > &other)
const Function< T > & getFunction(const uInt n) const
FunctionOrder()
Construct a default FunctionOrder with 0 parameters.
T & getWidth(const uInt n)
Vector< T > double_p
Double parameters.
virtual Bool toRecord(String &error, RecordInterface &out) const
Create a record from a FunctionOrder.
Int & getInt(const uInt n)
Get and set the various parameters (no check for index range).
String string_p
String parameters.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
A drop-in replacement for Block&lt;T*&gt;.
Definition: Block.h:814
Vector< T > width_p
Width of x (ndim)
T & getPar(const uInt n)
String: the storage and methods of handling collections of characters.
Definition: String.h:225
virtual ~FunctionOrder()
Destructor.
Container of function description details.
Definition: FunctionOrder.h:81
virtual Bool fromRecord(String &error, const RecordInterface &in)
Create a FunctionOrder from a record Error messages are postfixed to error.
Abstract base class for Record classes.
Vector< T > scale_p
Scale of y (length 1)
unsigned int uInt
Definition: aipstype.h:51
Vector< T > center_p
Centers of x (length ndim)
virtual const String & ident() const
Get identification of record.