MPQC  3.0.0-alpha
state.h
1 //
2 // state.h
3 //
4 // Copyright (C) 1996 Limit Point Systems, Inc.
5 //
6 // Author: Curtis Janssen <cljanss@limitpt.com>
7 // Maintainer: LPS
8 //
9 // This file is part of the SC Toolkit.
10 //
11 // The SC Toolkit is free software; you can redistribute it and/or modify
12 // it under the terms of the GNU Library General Public License as published by
13 // the Free Software Foundation; either version 2, or (at your option)
14 // any later version.
15 //
16 // The SC Toolkit is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU Library General Public License for more details.
20 //
21 // You should have received a copy of the GNU Library General Public License
22 // along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 //
25 // The U.S. Government is granted a limited license as per AL 91-7.
26 //
27 
28 #ifndef _util_state_state_h
29 #define _util_state_state_h
30 
31 #include <util/class/class.h>
32 
33 namespace sc {
34 
35 class StateIn;
36 class StateOut;
37 class TranslateDataIn;
38 class TranslateDataOut;
39 
42 
45 class SavableState: virtual public DescribedClass {
46  protected:
47  SavableState();
48  SavableState(const SavableState&);
49 #ifndef __GNUC__
50  public:
51 #endif
52  SavableState& operator=(const SavableState&);
53  public:
54  virtual ~SavableState();
55 
56  // save functions
57 
63  void save_state(StateOut&);
64 
65  // Like save_state(StateOut&), but will handle null pointers correctly.
66  static void save_state(SavableState*s, StateOut&);
67 
73 
81  virtual void save_vbase_state(StateOut&);
82 
86  virtual void save_data_state(StateOut&);
87 
88  // restore functions
89 
97  static SavableState* restore_state(StateIn& si);
101  const char *keyword);
102  static SavableState* dir_restore_state(StateIn& si,
103  const char *objectname,
104  const char *keyword = 0);
105 
106  protected:
107 
113  };
114 
116  struct DummySavableState : virtual public SavableState {
117  public:
119 
122  void save_data_state(StateOut&);
123 
124  private:
125  static ClassDesc class_desc_;
126  };
127 
129 // end of addgroup State
130 
131 }
132 
133 #endif
134 
135 // Local Variables:
136 // mode: c++
137 // c-file-style: "CLJ"
138 // End:
sc::SavableState::save_data_state
virtual void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::DummySavableState::save_data_state
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
sc::StateIn
Definition: statein.h:79
sc::ClassDesc
This class is used to contain information about classes.
Definition: class.h:147
sc::SavableState::save_object_state
void save_object_state(StateOut &)
This can be used for saving state when the exact type of the object is known for both the save and th...
sc::SavableState::restore_state
static SavableState * restore_state(StateIn &si)
Restores objects saved with save_state.
sc::SavableState::save_vbase_state
virtual void save_vbase_state(StateOut &)
Save the virtual bases for the object.
sc::SavableState::key_restore_state
static SavableState * key_restore_state(StateIn &si, const char *keyword)
Like restore_state, but keyword is used to override values while restoring.
sc::StateOut
Definition: stateout.h:71
sc::SavableState::save_state
void save_state(StateOut &)
Save the state of the object as specified by the StateOut object.
sc::DescribedClass
Classes which need runtime information about themselves and their relationship to other classes can v...
Definition: class.h:233
sc::SavableState
Base class for objects that can save/restore state.
Definition: state.h:45
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::DummySavableState
useful as a dummy template argument
Definition: state.h:116

Generated at Sun Jan 26 2020 23:24:02 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.