casacore
Loading...
Searching...
No Matches
FunctionMarshallable.h
Go to the documentation of this file.
1// # FunctionMarshallable.h: a class for serializing/reconstituting Function objects to/from Records
2// # Copyright (C) 2002
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_FUNCTIONMARSHALLABLE_H
27#define SCIMATH_FUNCTIONMARSHALLABLE_H
28
29#include <casacore/casa/aips.h>
30#include <casacore/scimath/Functionals/Function.h>
31#include <casacore/scimath/Functionals/FunctionFactoryErrors.h>
32#include <casacore/scimath/Functionals/SerialHelper.h>
33
34namespace casacore { // # NAMESPACE CASACORE - BEGIN
35
36// <summary>
37// a class for serializing/reconstituting Function objects to/from Records
38// </summary>
39
40// <use visibility=export>
41
42// <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
43// </reviewed>
44
45// <prerequisite>
46// <li> FunctionFactory
47// <li> Function
48// </prerequisite>
49//
50// <etymology>
51// Marshalling (a.k.a. serialization) is the process of converting the
52// state of an object into a transmitable form so that an another object with
53// identical state can be created in another execution context. This class
54// defines an interface for marshalling Functions.
55// </etymology>
56//
57// <synopsis>
58//
59//
60//
61//
62// </synopsis>
63//
64// <example>
65//
66//
67//
68// </example>
69//
70// <motivation>
71//
72//
73//
74// </motivation>
75//
76// <thrown>
77// </thrown>
78//
79// <todo asof="yyyy/mm/dd">
80// </todo>
81
83 public:
84 // create a FunctionMarshallable. <em>functype</em> is the name that
85 // store() will load into the Record's <tt>functype</tt> field.
86 FunctionMarshallable(const String& functype) : ftype(functype) {}
89
90 // store the state of this Function into a Record
91 // <thrown>
92 // <li> InvalidSerializationError if an error during serialization
93 // </thrown>
94 virtual void store(Record& gr) const = 0;
95
97 ftype = other.ftype;
98 return *this;
99 }
100
101 // return the name representing the Function type that will be placed
102 // in the <tt>functype</tt> field of Record passed to store().
103 const String& getFuncType() const { return ftype; }
104
105 // load functype field into the given Record
106 void loadFuncType(Record& gr) const { gr.define(SerialHelper::FUNCTYPE.c_str(), ftype.c_str()); }
107
108 private:
110
112};
113
114} // namespace casacore
115
116#endif
const String & getFuncType() const
return the name representing the Function type that will be placed in the functype field of Record pa...
void loadFuncType(Record &gr) const
load functype field into the given Record
FunctionMarshallable(const FunctionMarshallable &other)
virtual FunctionMarshallable & operator=(const FunctionMarshallable &other)
virtual void store(Record &gr) const =0
store the state of this Function into a Record
FunctionMarshallable(const String &functype)
create a FunctionMarshallable.
static const String FUNCTYPE
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