LibCT 2.0
|
00001 // ------------------------------------------------------------------ 00012 #ifndef _LIBCT_VARIABLECONTAINER_H 00013 #define _LIBCT_VARIABLECONTAINER_H 00014 00015 #include "Defines.h" 00016 00017 #include <string> 00018 #include <map> 00019 00020 namespace LibCT 00021 { 00023 class OutputStream; 00024 class InputStream; 00025 class VariableInterface; 00026 00028 typedef std::map<std::string, VariableInterface*> VariableList; 00029 typedef std::pair<std::string, VariableInterface*> VariablePair; 00030 00032 class VariableContainer 00033 { 00034 public: 00036 VariableContainer(); 00037 00039 ~VariableContainer(); 00040 00042 void SetValue( 00043 const std::string& name, 00044 int value 00045 ); 00046 00048 void SetValue( 00049 const std::string& name, 00050 float value 00051 ); 00052 00054 void SetValue( 00055 const std::string& name, 00056 double value 00057 ); 00058 00060 void SetValue( 00061 const std::string& name, 00062 bool value 00063 ); 00064 00066 void SetValue( 00067 const std::string& name, 00068 const std::string& value 00069 ); 00070 00073 bool GetValue( 00074 const std::string& name, 00075 int& value 00076 ) const; 00077 00080 bool GetValue( 00081 const std::string& name, 00082 float& value 00083 ) const; 00084 00087 bool GetValue( 00088 const std::string& name, 00089 double& value 00090 ) const; 00091 00094 bool GetValue( 00095 const std::string& name, 00096 bool& value 00097 ) const; 00098 00101 bool GetValue( 00102 const std::string& name, 00103 std::string& value 00104 ) const; 00105 00108 const VariableList* GetVariableList() const; 00109 00111 void RemoveVariable( 00112 const std::string& name 00113 ); 00114 00117 VariableInterface* GetVariable( 00118 const std::string& name 00119 ) const; 00120 00121 protected: 00122 VariableList m_Variables; 00123 }; 00124 00127 bool SerialiseVariableContainer( 00128 VariableContainer* pContainer, 00129 OutputStream* pOutput); 00130 00133 bool SerialiseVariableContainer( 00134 VariableContainer* pContainer, 00135 InputStream* pInput); 00136 } 00137 00138 #endif // _LIBCT_VARIABLECONTAINER_H