MPQC 2.3.1
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#ifdef __GNUC__
32#pragma interface
33#endif
34
35#include <util/state/state_file.h>
36
37namespace sc {
38
45 private:
46 // do not allow copy constructor or assignment
48 void operator=(const StateOutText&);
49 protected:
50 int no_newline_;
51 int no_array_;
52 void no_newline();
53 void no_array();
54 void newline();
55 void start_array();
56 void end_array();
58 int putparents(const ClassDesc*);
59 public:
61 StateOutText(std::ostream& s);
62 StateOutText(const char *);
64 int putstring(const char*);
65 int put_array_char(const char*,int);
66 int put_array_uint(const unsigned int*,int);
67 int put_array_int(const int*,int);
68 int put_array_float(const float*,int);
69 int put_array_double(const double*,int);
70 int put(const ClassDesc*);
71 int put(char r);
72 int put(unsigned int r);
73 int put(int r);
74 int put(float r);
75 int put(double r);
76 int put(const char*,int);
77 int put(const unsigned int*,int);
78 int put(const int*,int);
79 int put(const float*,int);
80 int put(const double*,int);
81 };
82
85class StateInText: public StateInFile {
86 private:
87 // do not allow copy constructor or assignment
89 void operator=(const StateInText&);
90 protected:
91 int newlines_;
92 int no_newline_;
93 int no_array_;
94 void no_newline();
95 void no_array();
96
97 int read(char*);
98 int read(unsigned int&);
99 int read(int&);
100 int read(float&);
101 int read(double&);
102 void newline();
103 void start_array();
104 void end_array();
106
107 void abort();
108 public:
109 StateInText();
110 StateInText(std::istream& s);
111 StateInText(const char *);
112 StateInText(const Ref<KeyVal> &);
113 ~StateInText();
114 int getstring(char*&);
115 int get_array_char(char*,int);
116 int get_array_uint(unsigned int*,int);
117 int get_array_int(int*,int);
118 int get_array_float(float*,int);
119 int get_array_double(double*,int);
120 int get(const ClassDesc**);
121 int get(char&r, const char *key = 0);
122 int get(unsigned int&r, const char *key = 0);
123 int get(int&r, const char *key = 0);
124 int get(float&r, const char *key = 0);
125 int get(double&r, const char *key = 0);
126 int get(char*&);
127 int get(unsigned int*&);
128 int get(int*&);
129 int get(float*&);
130 int get(double*&);
131 };
132
133}
134
135#endif
136
137// Local Variables:
138// mode: c++
139// c-file-style: "CLJ"
140// End:
This class is used to contain information about classes.
Definition class.h:158
A template class that maintains references counts.
Definition ref.h:332
Reads state information from a file.
Definition state_file.h:75
Reads state information written with StateOutText.
Definition state_text.h:85
int get_array_char(char *, int)
These restore data saved with StateOut's put.
int getstring(char *&)
This restores strings saved with StateOut::putstring.
int get(char &r, const char *key=0)
These restore data saved with StateOut's put. members.
int get(char *&)
These restore data saved with StateOut's put.
int getobject(Ref< SavableState > &)
This is used to restore an object.
int get(const ClassDesc **)
This restores ClassDesc's.
Writes state information to files.
Definition state_file.h:47
Writes out state information in an almost human readable format.
Definition state_text.h:44
int putobject(const Ref< SavableState > &)
This will prepare StateOut to output a pointer to data.
int put(const char *, int)
Write the given array data.
int put_array_char(const char *, int)
Put arrays of data.
int put(const ClassDesc *)
Write out information about the given ClassDesc.
int putstring(const char *)
This is like put except the length of the char array is determined by interpreting the character arra...
int put(char r)
Write the given datum.

Generated at Mon Sep 2 2024 00:00:00 for MPQC 2.3.1 using the documentation package Doxygen 1.12.0.