Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

state_text.h

00001 //
00002 // state_text.h
00003 //
00004 // Copyright (C) 1996 Limit Point Systems, Inc.
00005 //
00006 // Author: Curtis Janssen <cljanss@limitpt.com>
00007 // Maintainer: LPS
00008 //
00009 // This file is part of the SC Toolkit.
00010 //
00011 // The SC Toolkit is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Library General Public License as published by
00013 // the Free Software Foundation; either version 2, or (at your option)
00014 // any later version.
00015 //
00016 // The SC Toolkit is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 // GNU Library General Public License for more details.
00020 //
00021 // You should have received a copy of the GNU Library General Public License
00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00024 //
00025 // The U.S. Government is granted a limited license as per AL 91-7.
00026 //
00027 
00028 #ifndef _util_state_state_text_h
00029 #define _util_state_state_text_h
00030 
00031 #ifdef __GNUC__
00032 #pragma interface
00033 #endif
00034 
00035 #include <util/state/state_file.h>
00036 
00042 class StateOutText: public StateOutFile {
00043   private:
00044     // do not allow copy constructor or assignment
00045     StateOutText(const StateOutText&);
00046     void operator=(const StateOutText&);
00047   protected:
00048     int no_newline_;
00049     int no_array_;
00050     void no_newline();
00051     void no_array();
00052     void newline();
00053     void start_array();
00054     void end_array();
00055     int putobject(const Ref<SavableState> &);
00056     int putparents(const ClassDesc*);
00057   public:
00058     StateOutText();
00059     StateOutText(std::ostream& s);
00060     StateOutText(const char *);
00061     ~StateOutText();
00062     int putstring(const char*);
00063     int put_array_char(const char*,int);
00064     int put_array_uint(const unsigned int*,int);
00065     int put_array_int(const int*,int);
00066     int put_array_float(const float*,int);
00067     int put_array_double(const double*,int);
00068     int put(const ClassDesc*);
00069     int put(char r);
00070     int put(unsigned int r);
00071     int put(int r);
00072     int put(float r);
00073     int put(double r);
00074     int put(const char*,int);
00075     int put(const unsigned int*,int);
00076     int put(const int*,int);
00077     int put(const float*,int);
00078     int put(const double*,int);
00079   };
00080 
00083 class StateInText: public StateInFile {
00084   private:
00085     // do not allow copy constructor or assignment
00086     StateInText(const StateInText&);
00087     void operator=(const StateInText&);
00088   protected:
00089     int newlines_;
00090     int no_newline_;
00091     int no_array_;
00092     void no_newline();
00093     void no_array();
00094 
00095     int read(char*);
00096     int read(unsigned int&);
00097     int read(int&);
00098     int read(float&);
00099     int read(double&);
00100     void newline();
00101     void start_array();
00102     void end_array();
00103     int  getobject(Ref<SavableState> &);
00104 
00105     void abort();
00106   public:
00107     StateInText();
00108     StateInText(std::istream& s);
00109     StateInText(const char *);
00110     StateInText(const Ref<KeyVal> &);
00111     ~StateInText();
00112     int getstring(char*&);
00113     int get_array_char(char*,int);
00114     int get_array_uint(unsigned int*,int);
00115     int get_array_int(int*,int);
00116     int get_array_float(float*,int);
00117     int get_array_double(double*,int);
00118     int get(const ClassDesc**);
00119     int get(char&r, const char *key = 0);
00120     int get(unsigned int&r, const char *key = 0);
00121     int get(int&r, const char *key = 0);
00122     int get(float&r, const char *key = 0);
00123     int get(double&r, const char *key = 0);
00124     int get(char*&);
00125     int get(unsigned int*&);
00126     int get(int*&);
00127     int get(float*&);
00128     int get(double*&);
00129   };
00130 
00131 #endif
00132 
00133 // Local Variables:
00134 // mode: c++
00135 // c-file-style: "CLJ"
00136 // End:

Generated at Thu Oct 4 18:08:47 2001 for MPQC 2.0.0 using the documentation package Doxygen 1.2.5.