28 #ifndef _util_state_stateout_h
29 #define _util_state_stateout_h
35 #include <util/class/class.h>
36 #include <util/state/state.h>
51 template <
typename T>
void ToStateOut(
const T& t, StateOut& so,
int& count);
83 int next_object_number_;
85 std::map<ClassDescP,int> classidmap_;
88 virtual int put_array_void(
const void*,
int);
95 void have_classdesc() { have_cd_ = 1; }
96 int need_classdesc() {
int tmp = have_cd_; have_cd_ = 0;
return !tmp; }
120 virtual int put(
const std::string &);
121 virtual int put(
char r);
122 virtual int put(
unsigned int r);
123 virtual int put(
int r);
124 virtual int put(
unsigned long r);
125 virtual int put(
long r);
126 virtual int put(
bool r);
127 virtual int put(
float r);
128 virtual int put(
double r);
135 virtual int put(
const char*,
int);
136 virtual int put(
const unsigned int*,
int);
137 virtual int put(
const int*,
int);
138 virtual int put(
const unsigned long*,
int);
139 virtual int put(
const long*,
int);
140 virtual int put(
const float*,
int);
141 virtual int put(
const double*,
int);
147 virtual int put_array_char(
const char*p,
int size);
148 virtual int put_array_uint(
const unsigned int*p,
int size);
149 virtual int put_array_int(
const int*p,
int size);
150 virtual int put_array_ulong(
const unsigned long*p,
int size);
151 virtual int put_array_long(
const long*p,
int size);
152 virtual int put_array_float(
const float*p,
int size);
153 virtual int put_array_double(
const double*p,
int size);
161 template <
template <
typename,
typename>
class Container,
class T,
class A>
163 int put(
const Container<T,A> &v) {
164 const size_t l = v.size();
166 for (
typename Container<T,A>::const_iterator i=v.begin(); i!=v.end(); ++i)
172 template <
class T,
class A>
173 int put(
const std::vector<T,A> &v) {
174 const size_t l = v.size();
176 for (
typename std::vector<T,A>::const_iterator i=v.begin(); i!=v.end(); ++i)
182 template <
typename Key,
typename Compare,
typename Alloc>
183 int put(
const std::set<Key,Compare,Alloc> &s) {
184 const size_t l = s.size();
186 for (
typename std::set<Key,Compare,Alloc>::const_iterator i=s.begin(); i!=s.end(); ++i)
192 template <
typename Key,
typename Value>
193 int put(
const std::map<Key,Value>&
map) {
194 typedef std::map<Key,Value> Map;
195 const size_t size =
map.size();
198 typedef typename Map::const_iterator citer;
199 const citer end =
map.end();
200 for(citer i=
map.begin(); i!=end; ++i) {
208 template <
typename L,
typename R>
209 int put(
const std::pair<L,R>& v) {
231 virtual void flush();
244 virtual void seek(
int loc);
void copy_references()
If a reference to an object that has already been written is encountered, copy it instead of generati...
int put(const std::map< Key, Value > &map)
Write an std::map. This also works if Key or Value is a Ref to a SavableState.
Definition: stateout.h:193
void ToStateOut(const Atom &a, StateOut &so, int &count)
writes Atom to sc::StateOut
virtual int use_directory()
Returns true if this object uses a directory.
Definition: stateout.h:53
A template class that maintains references counts.
Definition: ref.h:361
virtual int seekable()
Return non-zero if tell and seek do anything sensible.
virtual int putobject(const Ref< SavableState > &)
This will prepare StateOut to output a pointer to data.
T * pointer() const
Returns a pointer the reference counted object.
Definition: ref.h:413
virtual int tell()
Returns the current position in the file.
virtual void flush()
Flush out any remaining data.
This class is used to contain information about classes.
Definition: class.h:147
int put(const std::pair< L, R > &v)
Write an std::pair.
Definition: stateout.h:209
virtual void seek(int loc)
Set the current position in the file.
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 ...
int put(const std::vector< T, A > &v)
"Specialization" of the above put() to std::vector.
Definition: stateout.h:173
Convert data to other formats.
Definition: translate.h:162
Definition: stateout.h:71
void save_state(StateOut &)
Save the state of the object as specified by the StateOut object.
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition: class.h:233
void forget_references()
Don't keep track of pointers to objects.
int put(const Container< T, A > &v)
Write a Container that could be a standard (non-associative) C++ container such as std::vector or std...
Definition: stateout.h:163
virtual int put(const ClassDesc *)
Write out information about the given ClassDesc.
virtual void put_header()
Write out header information.
Base class for objects that can save/restore state.
Definition: state.h:45
virtual int putstring(const char *)
This is like put except the length of the char array is determined by interpreting the character arra...
int node_to_node() const
True if this is a node to node save/restore.
Definition: stateout.h:237
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
int put(const std::set< Key, Compare, Alloc > &s)
Write an std::set. This also works if Key or Value is a Ref to a SavableState.
Definition: stateout.h:183
Generated at Sun Jan 26 2020 23:24:02 for MPQC
3.0.0-alpha using the documentation package Doxygen
1.8.16.