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 class StateIn; 00038 class StateOut; 00039 class TranslateDataIn; 00040 class TranslateDataOut; 00041 00044 class SavableState: public DescribedClass { 00045 protected: 00046 SavableState(); 00047 SavableState(const SavableState&); 00048 #ifndef __GNUC__ 00049 public: 00050 #endif 00051 SavableState& operator=(const SavableState&); 00052 public: 00053 virtual ~SavableState(); 00054 00055 // save functions 00056 00062 void save_state(StateOut&); 00063 00064 // Like save_state(StateOut&), but will handle null pointers correctly. 00065 static void save_state(SavableState*s, StateOut&); 00066 00071 void save_object_state(StateOut&); 00072 00080 virtual void save_vbase_state(StateOut&); 00081 00085 virtual void save_data_state(StateOut&); 00086 00087 // restore functions 00088 00096 static SavableState* restore_state(StateIn& si); 00099 static SavableState* key_restore_state(StateIn& si, 00100 const char *keyword); 00101 static SavableState* dir_restore_state(StateIn& si, 00102 const char *objectname, 00103 const char *keyword = 0); 00104 00105 protected: 00106 00111 SavableState(StateIn&); 00112 }; 00113 00114 #endif 00115 00116 // Local Variables: 00117 // mode: c++ 00118 // c-file-style: "CLJ" 00119 // End: