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> class FunctionOrder : public RecordTransformable {
80 public:
81 //# Constructors
82 // Construct a default FunctionOrder with 0 parameters
84 // Copy constructor (deep copy)
86 // Destructor
87 virtual ~FunctionOrder();
88
89 //# Operators
90 // Copy assignment (deep copy)
92
93 //# Member functions
94 // Get and set the various parameters (no check for index range).
95 // Automatic extension for write.
96 // <group>
97 Int &getInt(const uInt n);
98 const Int &getInt(const uInt n) const;
99 T &getPar(const uInt n);
100 const T &getPar(const uInt n) const;
102 const String &getString() const;
103 T &getScale(const uInt n);
104 const T &getScale(const uInt n) const;
105 T &getCenter(const uInt n);
106 const T &getCenter(const uInt n) const;
107 T &getWidth(const uInt n);
108 const T &getWidth(const uInt n) const;
109 const Function<T> &getFunction(const uInt n) const;
110 void setFunction(const uInt n, Function<T> &other);
111 // </group>
112
113 // Create a FunctionOrder from a record
114 // Error messages are postfixed to error.
115 // <group>
116 virtual Bool fromRecord(String &error, const RecordInterface &in);
117 virtual Bool fromString(String &error, const String &in);
118 // </group>
119 // Create a record from a FunctionOrder.
120 // Error messages are postfixed to error.
121 virtual Bool toRecord(String &error, RecordInterface &out) const;
122 // Get identification of record
123 virtual const String &ident() const;
124
125 // Output the parameters
126 ostream &print(ostream &os) const;
127
128 private:
129 //# Data
130 // All data vectors can be empty
131 // <group>
132 // Integer details (order etc)
134 // Double parameters
136 // String parameters
138 // List of functions (say for Combi and Compound)
140 // Scale of y (length 1)
142 // Centers of x (length ndim)
144 // Width of x (ndim)
146 // </group>
147
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 - END
165
166#ifndef CASACORE_NO_AUTO_TEMPLATES
167#include <casacore/scimath/Functionals/FunctionOrder.tcc>
168#endif //# CASACORE_NO_AUTO_TEMPLATES
169#endif
170
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).
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.
PtrBlock< Function< T > * > function_p
List of functions (say for Combi and Compound)
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
A drop-in replacement for Block<T*>.
Definition Block.h:812
String: the storage and methods of handling collections of characters.
Definition String.h:223
this file contains all the compiler specific defines
Definition mainpage.dox:28
ostream & operator<<(ostream &os, const IComplex &)
Show on ostream.
unsigned int uInt
Definition aipstype.h:49
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.