- Main Page
- Namespaces
- Classes
- Files
- Related Pages

# /Users/fpy/titan-1-5-MBARI/Mers/Models/Base/Io/SaveLoad/Serializer.h

    00001
    00002 //
    00003 // Copyright (c) 2005           Model-based Embedded and Robotic Systems Group
    00004 // All Rights Reserved          Massachusetts Institute of Technology
    00005 //
    00006 // This software is provided as is. Model-based Embedded and Robotic Systems
    00007 // (MERS) group does not assume any responsibility.
    00008 //
    00010
    00011 #ifndef MERS_MODELS_BASE_IO_SAVELOAD_SERIALIZER_H
    00012 #define MERS_MODELS_BASE_IO_SAVELOAD_SERIALIZER_H
    00013
    00015
    00016 // For NULL
    00017 #include <cstddef>
    00018
    00020
    00021 namespace Mers {
    00022 namespace Utils {
    00023 namespace Io {
    00024 namespace SaveLoad {
    00025 // Forward Declare ISaveLoad
    00026 class ISaveLoad;
    00027 } // SaveLoad
    00028 } // Io
    00029 } // Utils
    00030
    00031 // In ::Mers::
    00032 namespace Models {
    00033 namespace Base {
    00034
    00035 // Forward Declare Base Model Objects
    00036 class BaseModel;
    00037 class BaseModelValue;
    00038 class BaseModelValueArray;
    00039 class BaseModelDomain;
    00040 class BaseModelDomainArray;
    00041 class BaseModelVariable;
    00042 class BaseModelVariableArray;
    00043 class BaseModelVariableArrayArray;
    00044 class BaseModelAssignment;
    00045 class BaseModelAssignmentArray;
    00046 class BaseModelClause;
    00047 class BaseModelClauseArray;
    00048 class BaseModelSentence;
    00049
    00050 // In ::Mers::Models::Base::
    00051 namespace Io {
    00052 namespace SaveLoad {
    00053
    00055
    00056 // Make a short namespace for BaseModel and SaveLoad namespaces
    00057 namespace ns_SaveLoad = Mers::Utils::Io::SaveLoad;
    00058 namespace ns_BaseModel = Mers::Models::Base;
    00059
    00061
    00066 class Serializer {
    00067 public:
    00071         Serializer( ns_BaseModel::BaseModel * model = NULL ) : m_model( model )
    00072         {
    00073         }
    00074
    00078         void setModel( ns_BaseModel::BaseModel * model ) {
    00079                 m_model = model;
    00080         }
    00081
    00085         ns_BaseModel::BaseModel * getModel() const {
    00086                 return m_model;
    00087         }
    00088
    00090         // Value
    00092
    00096         static const char * getTypeName( const ns_BaseModel::BaseModelValue * ) {
    00097                 return "Mers::Models::Base::Value";
    00098         }
    00099
    00103         void saveLoad( ns_SaveLoad::ISaveLoad * sl,
    00104                 const char * objName,
    00105                 const ns_BaseModel::BaseModelValue * &val );
    00106
    00110         void saveLoad( ns_SaveLoad::ISaveLoad * sl,
    00111                 const char * objName,
    00112                 ns_BaseModel::BaseModelValue * &var );
    00113
    00115         // ValueArray
    00117
    00121         static const char * getTypeName( const ns_BaseModel::BaseModelValueArray * ) {
    00122                 return "Mers::Models::Base::ValueArray";
    00123         }
    00124
    00128         void saveLoad( ns_SaveLoad::ISaveLoad * sl, const char *,
    00129                 ns_BaseModel::BaseModelValueArray * &values );
    00130
    00132         // Domain
    00134
    00138         static const char * getTypeName( const ns_BaseModel::BaseModelDomain * ) {
    00139                 return "Mers::Models::Base::Domain";
    00140         }
    00141
    00145         void saveLoad( ns_SaveLoad::ISaveLoad * sl,
    00146                 const char *, ns_BaseModel::BaseModelDomain * &domain );
    00147
    00149         // DomainArray
    00151
    00155         static const char * getTypeName( const ns_BaseModel::BaseModelDomainArray * ) {
    00156                 return "Mers::Models::Base::DomainArray";
    00157         }
    00158
    00162         void saveLoad( ns_SaveLoad::ISaveLoad * sl,
    00163                 const char *, ns_BaseModel::BaseModelDomainArray * &domains );
    00164
    00166         // Variable
    00168
    00172         static const char * getTypeName( const ns_BaseModel::BaseModelVariable * ) {
    00173                 return "Mers::Models::Base::Variable";
    00174         }
    00175
    00179         void saveLoad( ns_SaveLoad::ISaveLoad * sl, const char *,
    00180                 ns_BaseModel::BaseModelVariable * &var );
    00181
    00183         // VariableArray
    00185
    00189         static const char * getTypeName( const ns_BaseModel::BaseModelVariableArray * ) {
    00190                 return "Mers::Models::Base::Variablearray";
    00191         }
    00192
    00196         void saveLoad( ns_SaveLoad::ISaveLoad * sl, const char *,
    00197                 ns_BaseModel::BaseModelVariableArray * &var );
    00198
    00200         // Assignment
    00202
    00206         static const char * getTypeName( const ns_BaseModel::BaseModelAssignment * ) {
    00207                 return "Mers::Models::Base::Assignment";
    00208         }
    00209
    00213         void saveLoad( ns_SaveLoad::ISaveLoad * sl, const char *,
    00214                 ns_BaseModel::BaseModelAssignment * &assign );
    00215
    00217         // Model
    00219
    00223         static const char * getTypeName( const ns_BaseModel::BaseModel * ) {
    00224                 return "Mers::Models::Base::Model";
    00225         }
    00226
    00230         void saveLoad( ns_SaveLoad::ISaveLoad * sl, const char *,
    00231                 ns_BaseModel::BaseModel * &model );
    00232
    00233 protected:
    00235         ns_BaseModel::BaseModel * m_model;
    00236 };
    00237
    00239
    00240 } // SaveLoad
    00241 } // Io
    00242 } // Base
    00243 } // Models
    00244 } // Mers
    00245
    00247
    00248 #endif
    00249