28 #ifndef _util_state_statein_h
29 #define _util_state_statein_h
39 #include <util/state/state.h>
40 #include <util/keyval/keyval.h>
62 version(v), name(name), classdesc(c), ninstance(0) {}
79 char key_[KeyVal::MaxKeywordLength];
84 std::map<int,StateInData> ps_;
85 int expected_object_num_;
86 std::map<ClassDescP,int> classidmap_;
87 std::map<int,StateClassData> classdatamap_;
94 virtual int get_array_void(
void*,
int);
96 int push_key(
const char *key);
97 void pop_key(
int n) { key_[n] =
'\0'; keylength_ = n; }
98 const char *key() {
return key_; }
100 void get_directory();
101 int directory_location()
const {
return dir_loc_; }
102 void find_and_get_directory();
127 void have_classdesc() { have_cd_ = 1; }
128 int need_classdesc() {
int tmp = have_cd_; have_cd_ = 0;
return !tmp; }
151 virtual int get(std::string&);
154 virtual int get(
char&r,
const char *keyword = 0);
155 virtual int get(
unsigned int&r,
const char *keyword = 0);
156 virtual int get(
int&r,
const char *keyword = 0);
157 virtual int get(
bool&r,
const char *keyword = 0);
158 virtual int get(
float&r,
const char *keyword = 0);
159 virtual int get(
double&r,
const char *keyword = 0);
162 virtual int get(
char*&);
163 virtual int get(
unsigned int*&);
164 virtual int get(
int*&);
165 virtual int get(
float*&);
166 virtual int get(
double*&);
170 virtual int get_array_uint(
unsigned int*p,
int size);
171 virtual int get_array_int(
int*p,
int size);
172 virtual int get_array_float(
float*p,
int size);
173 virtual int get_array_double(
double*p,
int size);
177 int get(
typename std::vector<T> &v) {
180 if (l) { v.resize(l);
for (
int i=0; i<l; i++) r +=
get(v[i]); }
197 virtual void seek(
int);
201 int has_directory()
const {
return dir_loc_ != 0; }
virtual int get_array_char(char *p, int size)
These restore data saved with StateOut's put.
virtual int getstring(char *&)
This restores strings saved with StateOut::putstring.
int node_to_node() const
True if this is a node to node save/restore.
Definition: statein.h:188
virtual void haveobject(int, const Ref< SavableState > &)
When storage has been allocated during object restoration, this routine is called with the object ref...
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition: class.h:244
A template class that maintains references counts.
Definition: ref.h:332
virtual int tell()
Return the current position in the file.
virtual void list_objects(std::ostream &=ExEnv::out0())
List all the objects to the stream.
virtual void seek(int)
Set the current position in the file.
Restores objects that derive from SavableState.
Definition: statein.h:70
This class is used to contain information about classes.
Definition: class.h:158
virtual void nextobject(int)
A call to nextobject followed by havepointer(int) is equiv to havepointer(int,void**);.
static std::ostream & out0()
Return an ostream that writes from node 0.
virtual int seekable()
Return non-zero if seek does anything sensible.
virtual int dir_getobject(Ref< SavableState > &, const char *name)
This restores objects that are listed in the directory.
virtual int use_directory()
Returns true of this object uses a directory.
Convert data from other formats.
Definition: translate.h:188
virtual int version(const ClassDesc *)
Returns the version of the ClassDesc in the persistent object or -1 if info on the ClassDesc doesn't ...
void set_override(const Ref< KeyVal > &kv)
Give this StateIn a KeyVal object that is used to override values.
Definition: statein.h:209
Base class for objects that can save/restore state.
Definition: state.h:46
virtual int getobject(Ref< SavableState > &)
This is used to restore an object.
virtual void get_header()
Read in the header information.