casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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: 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 //#
27 //# $Id$
28 
29 #ifndef SCIMATH_FUNCTIONMARSHALLABLE_H
30 #define SCIMATH_FUNCTIONMARSHALLABLE_H
31 
32 #include <casacore/casa/aips.h>
36 
37 namespace casacore { //# NAMESPACE CASACORE - BEGIN
38 
39 // <summary>
40 // a class for serializing/reconstituting Function objects to/from Records
41 // </summary>
42 
43 // <use visibility=export>
44 
45 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
46 // </reviewed>
47 
48 // <prerequisite>
49 // <li> FunctionFactory
50 // <li> Function
51 // </prerequisite>
52 //
53 // <etymology>
54 // Marshalling (a.k.a. serialization) is the process of converting the
55 // state of an object into a transmitable form so that an another object with
56 // identical state can be created in another execution context. This class
57 // defines an interface for marshalling Functions.
58 // </etymology>
59 //
60 // <synopsis>
61 //
62 //
63 //
64 //
65 // </synopsis>
66 //
67 // <example>
68 //
69 //
70 //
71 // </example>
72 //
73 // <motivation>
74 //
75 //
76 //
77 // </motivation>
78 //
79 // <thrown>
80 // </thrown>
81 //
82 // <todo asof="yyyy/mm/dd">
83 // </todo>
84 
86 public:
87 
88  // create a FunctionMarshallable. <em>functype</em> is the name that
89  // store() will load into the Record's <tt>functype</tt> field.
90  FunctionMarshallable(const String& functype) : ftype(functype) {}
92  ftype = other.ftype;
93  }
94  virtual ~FunctionMarshallable() {}
95 
96  // store the state of this Function into a Record
97  // <thrown>
98  // <li> InvalidSerializationError if an error during serialization
99  // </thrown>
100  virtual void store(Record& gr) const = 0;
101 
102  virtual FunctionMarshallable&
104  {
105  ftype = other.ftype;
106  return *this;
107  }
108 
109  // return the name representing the Function type that will be placed
110  // in the <tt>functype</tt> field of Record passed to store().
111  const String& getFuncType() const { return ftype; }
112 
113  // load functype field into the given Record
114  void loadFuncType(Record& gr) const {
115  gr.define(SerialHelper::FUNCTYPE.c_str(), ftype.c_str());
116  }
117 
118 private:
120 
122 };
123 
124 
125 } //# NAMESPACE CASACORE - END
126 
127 #endif
128 
129 
void loadFuncType(Record &gr) const
load functype field into the given Record
FunctionMarshallable(const String &functype)
create a FunctionMarshallable.
const String & getFuncType() const
return the name representing the Function type that will be placed in the functype field of Record pa...
FunctionMarshallable(const FunctionMarshallable &other)
a class for serializing/reconstituting Function objects to/from Records
virtual FunctionMarshallable & operator=(const FunctionMarshallable &other)
const Char * c_str() const
Get char array.
Definition: String.h:557
A hierarchical collection of named fields of various types.
Definition: Record.h:180
virtual void store(Record &gr) const =0
store the state of this Function into a Record
static const String FUNCTYPE
Definition: SerialHelper.h:102
String: the storage and methods of handling collections of characters.
Definition: String.h:225
void define(const RecordFieldId &, Bool value)
Define a value for the given field.