# state.h

    00001 //
    00002 // state.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_h
    00029 #define _util_state_state_h
    00030
    00031 #ifdef __GNUC__
    00032 #pragma interface
    00033 #endif
    00034
    00035 #include <util/class/class.h>
    00036
    00037 namespace sc {
    00038
    00039 class StateIn;
    00040 class StateOut;
    00041 class TranslateDataIn;
    00042 class TranslateDataOut;
    00043
    00046 class SavableState: public DescribedClass {
    00047   protected:
    00048     SavableState();
    00049     SavableState(const SavableState&);
    00050 #ifndef __GNUC__
    00051   public:
    00052 #endif
    00053     SavableState& operator=(const SavableState&);
    00054   public:
    00055     virtual ~SavableState();
    00056
    00057     // save functions
    00058
    00064     void save_state(StateOut&);
    00065
    00066     // Like save_state(StateOut&), but will handle null pointers correctly.
    00067     static void save_state(SavableState*s, StateOut&);
    00068
    00073     void save_object_state(StateOut&);
    00074
    00082     virtual void save_vbase_state(StateOut&);
    00083
    00087     virtual void save_data_state(StateOut&);
    00088
    00089     // restore functions
    00090
    00098     static SavableState* restore_state(StateIn& si);
    00101     static SavableState* key_restore_state(StateIn& si,
    00102                                            const char *keyword);
    00103     static SavableState* dir_restore_state(StateIn& si,
    00104                                            const char *objectname,
    00105                                            const char *keyword = 0);
    00106
    00107   protected:
    00108
    00113     SavableState(StateIn&);
    00114   };
    00115
    00116 }
    00117
    00118 #endif
    00119
    00120 // Local Variables:
    00121 // mode: c++
    00122 // c-file-style: "CLJ"
    00123 // End: