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

# /Users/fpy/titan-1-5-MBARI/Mers/Utils/Io/Xml/Dom/XMLSaveLoad.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_UTILS_IO_XML_SAVELOAD
    00012 #define MERS_UTILS_IO_XML_SAVELOAD
    00013
    00015
    00016 #include <Mers/Utils/Io/SaveLoad/ISaveLoad.h>
    00017 #include <xercesc/dom/DOM.hpp>
    00018
    00020
    00021 namespace Mers {
    00022 namespace Utils {
    00023 namespace Io {
    00024 namespace Xml {
    00025 namespace Dom {
    00026
    00031 class XMLSaveLoad : public Mers::Utils::Io::SaveLoad::ISaveLoad
    00032 {
    00033 public:
    00050         XMLSaveLoad( XERCES_CPP_NAMESPACE::DOMDocument * document,
    00051                 Mers::Utils::Io::SaveLoad::ISaveLoad::eSaveOrLoad saveOrLoad,
    00052                 unsigned int version = ISaveLoad::kCurrentVersion );
    00053
    00057         XERCES_CPP_NAMESPACE::DOMDocument * getDocument()
    00058         {
    00059                 return m_document;
    00060         }
    00061
    00066         virtual void saveLoadComment( const char * message );
    00067
    00068 protected:
    00070         // Save/Load helper functions
    00072
    00076         template< typename t_Basic >
    00077         void saveLoadNode( const char * elementName, t_Basic &obj );
    00078
    00082         template<typename t_Integer>
    00083         void saveLoadInteger( const char * attributeName, t_Integer &value );
    00084
    00088         template<typename t_Real>
    00089         void saveLoadReal( const char * attributeName, t_Real &value );
    00090
    00094         void saveLoadAttribute( const char * attributeName, bool &value );
    00095
    00099         void saveLoadAttribute( const char * attributeName,
    00100                 Mers::Utils::Lang::String &value );
    00101
    00105         void saveLoadAttribute( const char * attributeName, char * &value );
    00106
    00110         void saveLoadAttribute( const char * attributeName, int &value );
    00111
    00115         void saveLoadAttribute( const char * attributeName, unsigned int &value );
    00116
    00120         void saveLoadAttribute( const char * attributeName, short &value );
    00121
    00125         void saveLoadAttribute( const char * attributeName, unsigned short &value );
    00126
    00130         void saveLoadAttribute( const char * attributeName, double &value );
    00131
    00133         // Save/Load interface
    00135
    00139         void doSaveLoad( const char * name, bool &inout_value );
    00140
    00144         virtual void doSaveLoad( const char * name, Mers::Utils::Lang::String &inout_value );
    00145
    00149         virtual void doSaveLoad( const char * name, char * &inout_value );
    00150
    00154         virtual void doSaveLoad( const char * name, int &inout_value );
    00155
    00159         virtual void doSaveLoad( const char * name, unsigned int &value );
    00160
    00164         virtual void doSaveLoad( const char * name, short &value );
    00165
    00169         virtual void doSaveLoad( const char * name, unsigned short &value );
    00170
    00174         virtual void doSaveLoad( const char * name, double &value );
    00175
    00186         virtual Mers::Utils::Lang::String pushContext( const char * name );
    00187
    00191         virtual void popContext();
    00192
    00193 protected:
    00205         Mers::Utils::Lang::String pushContextNode( const char * name );
    00206
    00207 protected:
    00209         XERCES_CPP_NAMESPACE::DOMDocument * m_document;
    00210
    00212         XERCES_CPP_NAMESPACE::DOMElement * m_currentElement;
    00213
    00215         XERCES_CPP_NAMESPACE::DOMElement * m_recentChild;
    00216 };
    00217
    00218 } // Dom
    00219 } // Xml
    00220 } // Io
    00221 } // Utils
    00222 } // Mers
    00223
    00224 #endif
    00225