28 #ifndef _util_state_statein_h
29 #define _util_state_statein_h
34 #include <util/state/state.h>
35 #include <util/keyval/keyval.h>
50 template <
typename T>
void FromStateIn(T& t, StateIn& si,
int& count);
70 version(v), name(name), classdesc(c), ninstance(0) {}
88 char key_[KeyVal::MaxKeywordLength];
93 std::map<int,StateInData> ps_;
94 int expected_object_num_;
95 std::map<ClassDescP,int> classidmap_;
96 std::map<int,StateClassData> classdatamap_;
103 virtual int get_array_void(
void*,
int);
105 int push_key(
const char *key);
106 void pop_key(
int n) { key_[n] =
'\0'; keylength_ = n; }
107 const char *key() {
return key_; }
109 void get_directory();
110 int directory_location()
const {
return dir_loc_; }
111 void find_and_get_directory();
136 void have_classdesc() { have_cd_ = 1; }
137 int need_classdesc() {
int tmp = have_cd_; have_cd_ = 0;
return !tmp; }
162 virtual int get(std::string&);
163 virtual int get(
char&r,
const char *keyword = 0);
164 virtual int get(
unsigned int&r,
const char *keyword = 0);
165 virtual int get(
int&r,
const char *keyword = 0);
166 virtual int get(
unsigned long int&r,
const char *keyword = 0);
167 virtual int get(
long int&r,
const char *keyword = 0);
168 virtual int get(
bool&r,
const char *keyword = 0);
169 virtual int get(
float&r,
const char *keyword = 0);
170 virtual int get(
double&r,
const char *keyword = 0);
177 virtual int get(
char*&);
178 virtual int get(
unsigned int*&);
179 virtual int get(
int*&);
180 virtual int get(
unsigned long int*&);
181 virtual int get(
long int*&);
182 virtual int get(
float*&);
183 virtual int get(
double*&);
189 virtual int get_array_char(
char*p,
int size);
190 virtual int get_array_uint(
unsigned int*p,
int size);
191 virtual int get_array_int(
int*p,
int size);
192 virtual int get_array_ulong(
unsigned long*p,
int size);
193 virtual int get_array_long(
long*p,
int size);
194 virtual int get_array_float(
float*p,
int size);
195 virtual int get_array_double(
double*p,
int size);
203 template <
template <
typename,
typename>
class Container,
class T,
class A>
205 int get(Container<T,A> &v) {
208 for (
size_t i=0; i<l; i++) {
217 template <
class T,
class A>
218 int get(std::vector<T, A> &v) {
222 for (
size_t i=0; i<l; i++) {
231 template <
typename Key,
typename Compare,
typename Alloc>
232 int get(std::set<Key,Compare,Alloc>& s) {
233 typedef std::set<Key,Compare,Alloc> Set;
237 for(
size_t i=0; i<size; ++i) {
247 template <
typename Key,
typename Value>
249 typedef std::map<Key,Value> Map;
253 for(
size_t i=0; i<size; ++i) {
254 std::pair<Key,Value> v;
256 map[v.first] = v.second;
263 template <
typename L,
typename R>
264 int get(std::pair<L,R>& v) {
285 virtual void seek(
int);
289 int has_directory()
const {
return dir_loc_ != 0; }
int get(Container< T, A > &v)
Read a Container that could be a standard (non-associative) C++ container such as std::vector or std:...
Definition: statein.h:205
virtual int seekable()
Return non-zero if seek does anything sensible.
virtual int use_directory()
Returns true of this object uses a directory.
void set_override(const Ref< KeyVal > &kv)
Give this StateIn a KeyVal object that is used to override values.
Definition: statein.h:297
A template class that maintains references counts.
Definition: ref.h:361
virtual int getstring(char *&)
This restores strings saved with StateOut::putstring.
int get(std::pair< L, R > &v)
Read an std::pair.
Definition: statein.h:264
int get(std::vector< T, A > &v)
"Specialization" of the above get() to an std::vector
Definition: statein.h:218
This class is used to contain information about classes.
Definition: class.h:147
virtual void seek(int)
Set the current position in the file.
static SavableState * restore_state(StateIn &si)
Restores objects saved with save_state.
int node_to_node() const
True if this is a node to node save/restore.
Definition: statein.h:276
virtual int version(const ClassDesc *)
Returns the version of the ClassDesc in the persistent object or -1 if info on the ClassDesc doesn't ...
virtual int dir_getobject(Ref< SavableState > &, const char *name)
This restores objects that are listed in the directory.
virtual int getobject(Ref< SavableState > &)
This is used to restore an object.
Convert data from other formats.
Definition: translate.h:197
int get(std::set< Key, Compare, Alloc > &s)
Read an std::set. This also works if Key or Value is a Ref to a SavableState.
Definition: statein.h:232
std::vector< int > map(const GaussianBasisSet &B, const GaussianBasisSet &A)
same as operator<<, except A does not have to be contained in B, map[a] = -1 if function a is not in ...
virtual int tell()
Return the current position in the file.
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition: class.h:233
virtual void list_objects(std::ostream &=ExEnv::out0())
List all the objects to the stream.
static std::ostream & out0()
Return an ostream that writes from node 0.
virtual void get_header()
Read in the header information.
Base class for objects that can save/restore state.
Definition: state.h:45
int get(std::map< Key, Value > &map)
Read an std::map. This also works if Key or Value is a Ref to a SavableState.
Definition: statein.h:248
virtual void nextobject(int)
A call to nextobject followed by havepointer(int) is equiv to havepointer(int,void**);.
virtual int get(const ClassDesc **)
This restores ClassDesc's.
void FromStateIn(Atom &a, StateIn &si, int &count)
reads Atom from sc::StateIn
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
virtual void haveobject(int, const Ref< SavableState > &)
When storage has been allocated during object restoration, this routine is called with the object ref...
Generated at Sun Jan 26 2020 23:24:02 for MPQC
3.0.0-alpha using the documentation package Doxygen
1.8.16.