MPQC  3.0.0-alpha
state_text.h
1 //
2 // state_text.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_text_h
29 #define _util_state_state_text_h
30 
31 #include <util/state/state_file.h>
32 
33 namespace sc {
34 
41 class StateOutText: public StateOutFile {
42  private:
43  // do not allow copy constructor or assignment
44  StateOutText(const StateOutText&);
45  void operator=(const StateOutText&);
46  protected:
47  int no_newline_;
48  int no_array_;
49  void no_newline();
50  void no_array();
51  void newline();
52  void start_array();
53  void end_array();
54  int putobject(const Ref<SavableState> &);
55  int putparents(const ClassDesc*);
56  public:
57  StateOutText();
58  StateOutText(std::ostream& s);
59  StateOutText(const char *);
60  ~StateOutText();
61  int putstring(const char*);
62  int put_array_char(const char*,int);
63  int put_array_uint(const unsigned int*,int);
64  int put_array_int(const int*,int);
65  int put_array_ulong(const unsigned long*,int);
66  int put_array_long(const long*,int);
67  int put_array_float(const float*,int);
68  int put_array_double(const double*,int);
69  int put(const ClassDesc*);
70  int put(const std::string &);
71  int put(char r);
72  int put(unsigned int r);
73  int put(int r);
74  int put(unsigned long r);
75  int put(long r);
76  int put(bool r);
77  int put(float r);
78  int put(double r);
79  int put(const char*,int);
80  int put(const unsigned int*,int);
81  int put(const int*,int);
82  int put(const unsigned long*,int);
83  int put(const long*,int);
84  int put(const float*,int);
85  int put(const double*,int);
86  };
87 
91 class StateInText: public StateInFile {
92  private:
93  // do not allow copy constructor or assignment
94  StateInText(const StateInText&);
95  void operator=(const StateInText&);
96  protected:
97  int newlines_;
98  int no_newline_;
99  int no_array_;
100  void no_newline();
101  void no_array();
102 
103  int read(char*);
104  int read(unsigned int&);
105  int read(int&);
106  int read(unsigned long&);
107  int read(long&);
108  int read(bool&);
109  int read(float&);
110  int read(double&);
111  void newline();
112  void start_array();
113  void end_array();
115 
116  void abort();
117  public:
118  StateInText();
119  StateInText(std::istream& s);
120  StateInText(const char *);
121  StateInText(const Ref<KeyVal> &);
122  ~StateInText();
123  int getstring(char*&);
124  int get_array_char(char*,int);
125  int get_array_uint(unsigned int*,int);
126  int get_array_int(int*,int);
127  int get_array_ulong(unsigned long*,int);
128  int get_array_long(long*,int);
129  int get_array_float(float*,int);
130  int get_array_double(double*,int);
131  int get(const ClassDesc**);
132  int get(std::string&);
133  int get(char&r, const char *key = 0);
134  int get(unsigned int&r, const char *key = 0);
135  int get(int&r, const char *key = 0);
136  int get(unsigned long&r, const char *key = 0);
137  int get(long&r, const char *key = 0);
138  int get(bool&r, const char *key = 0);
139  int get(float&r, const char *key = 0);
140  int get(double&r, const char *key = 0);
141  int get(char*&);
142  int get(unsigned int*&);
143  int get(int*&);
144  int get(unsigned long*&);
145  int get(long*&);
146  int get(float*&);
147  int get(double*&);
148  };
149 
150 }
151 
152 #endif
153 
154 // Local Variables:
155 // mode: c++
156 // c-file-style: "CLJ"
157 // End:
sc::StateInFile
Definition: state_file.h:73
sc::StateInText::getstring
int getstring(char *&)
This restores strings saved with StateOut::putstring.
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::StateInText::getobject
int getobject(Ref< SavableState > &)
This is used to restore an object.
sc::StateOutText
Definition: state_text.h:41
sc::StateOutText::put
int put(const ClassDesc *)
Write out information about the given ClassDesc.
sc::ClassDesc
This class is used to contain information about classes.
Definition: class.h:147
sc::StateOutText::putobject
int putobject(const Ref< SavableState > &)
This will prepare StateOut to output a pointer to data.
sc::StateInText::get
int get(const ClassDesc **)
This restores ClassDesc's.
sc::StateInText
Definition: state_text.h:91
sc::StateOutFile
Definition: state_file.h:44
sc::StateOutText::putstring
int putstring(const char *)
This is like put except the length of the char array is determined by interpreting the character arra...
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14

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