casacore
Loading...
Searching...
No Matches
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: casa-feedback@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#ifndef SCIMATH_FUNCTIONORDER_H
27#define SCIMATH_FUNCTIONORDER_H
28
29// # Include files
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Arrays/Vector.h>
32#include <casacore/casa/Containers/Block.h>
33#include <casacore/casa/Utilities/RecordTransformable.h>
34#include <casacore/scimath/Functionals/Function.h>
35#include <casacore/casa/BasicSL/String.h>
36#include <casacore/casa/iosfwd.h>
37
38namespace casacore { // # NAMESPACE CASACORE - BEGIN
39
40// # Forward declarations
41class RecordInterface;
42
43// <summary> Container of function description details
44// </summary>
45//
46// <use visibility=export>
47//
48// <reviewed reviewer="UNKNOWN" date="before2004/08/25"tFunctionOrder"
49// demos="">
50// </reviewed>
51//
52// <synopsis>
53// <src>FunctionOrder</src> is used to provide an interface to an entity which
54// has special fixed parameters (like dimension of Gaussian; oder of
55// Polynomial).
56// This is useful, for example, in implementinggeneric function factories.
57//
58// </synopsis>
59//
60// <example>
61// See the <linkto class=FunctionHolder>FunctionHolder</linkto>
62// class for a usage interface.
63// </example>
64//
65// <motivation>
66// Generically manipulatable parameters are important for Glish interface
67// </motivation>
68//
69// <templating arg=T>
70// <li> <src>T</src> must have a default constructor, assignment operator,
71// and copy constructor (for the Vector interface).
72// <li> Complex/DComplex or Float/Double supported
73// </templating>
74//
75// <todo asof="2002/05/28">
76// <li> Nothing I know of
77// </todo>
78
79template <class T>
81 public:
82 // # Constructors
83 // Construct a default FunctionOrder with 0 parameters
85 // Copy constructor (deep copy)
87 // Destructor
88 virtual ~FunctionOrder();
89
90 // # Operators
91 // Copy assignment (deep copy)
93
94 // # Member functions
95 // Get and set the various parameters (no check for index range).
96 // Automatic extension for write.
97 // <group>
98 Int &getInt(const uInt n);
99 const Int &getInt(const uInt n) const;
100 T &getPar(const uInt n);
101 const T &getPar(const uInt n) const;
103 const String &getString() const;
104 T &getScale(const uInt n);
105 const T &getScale(const uInt n) const;
106 T &getCenter(const uInt n);
107 const T &getCenter(const uInt n) const;
108 T &getWidth(const uInt n);
109 const T &getWidth(const uInt n) const;
110 const Function<T> &getFunction(const uInt n) const;
111 void setFunction(const uInt n, Function<T> &other);
112 // </group>
113
114 // Create a FunctionOrder from a record
115 // Error messages are postfixed to error.
116 // <group>
117 virtual Bool fromRecord(String &error, const RecordInterface &in);
118 virtual Bool fromString(String &error, const String &in);
119 // </group>
120 // Create a record from a FunctionOrder.
121 // Error messages are postfixed to error.
122 virtual Bool toRecord(String &error, RecordInterface &out) const;
123 // Get identification of record
124 virtual const String &ident() const;
125
126 // Output the parameters
127 ostream &print(ostream &os) const;
128
129 private:
130 // # Data
131 // All data vectors can be empty
132 // <group>
133 // Integer details (order etc)
135 // Double parameters
137 // String parameters
139 // List of functions (say for Combi and Compound)
141 // Scale of y (length 1)
143 // Centers of x (length ndim)
145 // Width of x (ndim)
147 // </group>
148};
149
150// # Global functions
151// <summary> Global functions </summary>
152// <group name=Output>
153// Output declaration
154template <class T>
155ostream &operator<<(ostream &os, const FunctionOrder<T> &par);
156// </group>
158// # Inlines
159template <class T>
160inline ostream &operator<<(ostream &os, const FunctionOrder<T> &par) {
161 return par.print(os);
162}
163
164} // namespace casacore
165
166#ifndef CASACORE_NO_AUTO_TEMPLATES
167#include <casacore/scimath/Functionals/FunctionOrder.tcc>
168#endif // # CASACORE_NO_AUTO_TEMPLATES
169#endif
Vector< T > double_p
Double parameters.
Vector< T > center_p
Centers of x (length ndim).
virtual Bool fromRecord(String &error, const RecordInterface &in)
Create a FunctionOrder from a record Error messages are postfixed to error.
FunctionOrder(const FunctionOrder< T > &other)
Copy constructor (deep copy).
virtual ~FunctionOrder()
Destructor.
const Int & getInt(const uInt n) const
Int & getInt(const uInt n)
Get and set the various parameters (no check for index range).
Block< Function< T > * > function_p
List of functions (say for Combi and Compound).
const Function< T > & getFunction(const uInt n) const
T & getCenter(const uInt n)
const String & getString() const
T & getWidth(const uInt n)
Vector< T > scale_p
Scale of y (length 1).
const T & getWidth(const uInt n) const
Vector< Int > int_p
All data vectors can be empty.
void setFunction(const uInt n, Function< T > &other)
const T & getPar(const uInt n) const
virtual Bool toRecord(String &error, RecordInterface &out) const
Create a record from a FunctionOrder.
const T & getScale(const uInt n) const
ostream & print(ostream &os) const
Output the parameters.
virtual Bool fromString(String &error, const String &in)
Initialise the class from a String representation.
T & getPar(const uInt n)
T & getScale(const uInt n)
Vector< T > width_p
Width of x (ndim).
String string_p
String parameters.
virtual const String & ident() const
Get identification of record.
FunctionOrder & operator=(const FunctionOrder< T > &other)
Copy assignment (deep copy).
FunctionOrder()
Construct a default FunctionOrder with 0 parameters.
const T & getCenter(const uInt n) const
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
unsigned int uInt
Definition aipstype.h:49
RecordInterface()
The default constructor creates an empty record with a variable structure.
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
ostream & operator<<(ostream &os, const FunctionOrder< T > &par)
Output declaration.