Changeset 4487 in orxonox.OLD for orxonox/trunk/src/util/loading/load_param.h
- Timestamp:
- Jun 3, 2005, 12:56:57 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/loading/load_param.h
r4318 r4487 38 38 */ 39 39 40 #define l_INT_TYPE int41 #define l_INT_FUNC atoi42 #define l_INT_NAME "int"43 44 #define l_LONG_TYPE long45 #define l_LONG_FUNC atol46 #define l_LONG_NAME "long"47 48 #define l_SHORT_TYPE short49 #define l_SHORT_FUNC atoi50 #define l_SHORT_NAME "short"51 52 #define l_FLOAT_TYPE float53 #define l_FLOAT_FUNC atof54 #define l_FLOAT_NAME "float"55 56 #define l_STRING_TYPE const char*57 #define l_STRING_FUNC 58 #define l_STRING_NAME "string"59 60 61 /** 62 \brief a Macro to easily implement many different Constructors for the LoadParam-Class 40 #define l_INT_TYPE int //!< The type of an INT 41 #define l_INT_FUNC atoi //!< the function to call to parse INT 42 #define l_INT_NAME "int" //!< the name of an INT 43 44 #define l_LONG_TYPE long //!< The type of a LONG 45 #define l_LONG_FUNC atol //!< The function to parse a LONG 46 #define l_LONG_NAME "long" //!< The name of a LONG 47 48 #define l_SHORT_TYPE short //!< The type of a SHORT 49 #define l_SHORT_FUNC atoi //!< The function to parse a SHORT 50 #define l_SHORT_NAME "short" //!< The name of a SHORT 51 52 #define l_FLOAT_TYPE float //!< The type of a FLOAT 53 #define l_FLOAT_FUNC atof //!< The function to parse a FLOAT 54 #define l_FLOAT_NAME "float" //!< The name of a FLOAT 55 56 #define l_STRING_TYPE const char* //!< The type fo a STRING 57 #define l_STRING_FUNC //!< The function to parse a STRING 58 #define l_STRING_NAME "string" //!< The name of a STRING 59 60 // 1. TYPE 61 /** 62 \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 1 argument 63 63 \param type1 The type of the first functionParameter 64 64 */ … … 75 75 76 76 // 2. TYPES 77 /** 78 \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 2 arguments 79 \param type1 The type of the first functionParameter 80 \param type2 The type of the second functionParameter 81 */ 77 82 #define LoadParam2(type1, type2) \ 78 83 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE)) \ … … 94 99 95 100 // 3. TYPES 101 /** 102 \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 3 arguments 103 \param type1 The type of the first functionParameter 104 \param type2 The type of the second functionParameter 105 \param type3 The type of the third functionParameter 106 */ 96 107 #define LoadParam3(type1, type2, type3) \ 97 108 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE))\ … … 113 124 114 125 // 4. TYPES 126 /** 127 \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 4 arguments 128 \param type1 The type of the first functionParameter 129 \param type2 The type of the second functionParameter 130 \param type3 The type of the third functionParameter 131 \param type4 The type of the forth functionParameter 132 */ 115 133 #define LoadParam4(type1, type2, type3, type4) \ 116 134 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE)) \ … … 132 150 133 151 // 5. TYPES 152 /** 153 \brief a Macro to easily implement many different Constructors for the LoadParam-Class with 5 arguments 154 \param type1 The type of the first functionParameter 155 \param type2 The type of the second functionParameter 156 \param type3 The type of the third functionParameter 157 \param type4 The type of the forth functionParameter 158 \param type5 The type of the fifth functionParameter 159 */ 134 160 #define LoadParam5(type1, type2, type3, type4, type5) \ 135 161 LoadParam(const TiXmlElement* root, const char* paramName, T* pt2Object, void(T::*function)(type1##_TYPE, type2##_TYPE, type3##_TYPE, type4##_TYPE, type5##_TYPE)) \ … … 161 187 void setDescription(const char* descriptionText); 162 188 /** \returns the descriptionString */ 163 const char* getDescription(void) { return this->description; };189 const char* getDescription(void) { return this->description; }; 164 190 165 191 void print(void) const; 166 192 private: 167 char* paramName; //!< The name of the parameter 168 int paramCount; //!< The count of parameters 169 char** types; //!< What kind of parameters does this function take ?? 170 char* description; //!< A longer description about this function 171 }; 172 193 char* paramName; //!< The name of the parameter 194 int paramCount; //!< The count of parameters 195 char** types; //!< What kind of parameters does this function take ?? 196 char* description; //!< A longer description about this function 197 }; 198 199 //! A class for descriptions of a loadable module 173 200 class LoadClassDescription 174 201 { … … 184 211 static void printAll(const char* fileName = NULL); 185 212 186 static bool parametersDescription; //!< if parameter-description should be enabled.187 static tList<LoadClassDescription>* classList; //!< a list, that holds all the loadable classes. (after one instance has been loaded)188 213 private: 189 char* className; //!< name of the class 190 tList<LoadParamDescription>* paramList; //!< List of parameters this class knows. 191 }; 192 193 // abstract Base class 214 static bool parametersDescription; //!< if parameter-description should be enabled. 215 static tList<LoadClassDescription>* classList; //!< a list, that holds all the loadable classes. (after one instance has been loaded) 216 char* className; //!< name of the class 217 tList<LoadParamDescription>* paramList; //!< List of parameters this class knows. 218 }; 219 220 //! abstract Base class for a Loadable parameter 194 221 class BaseLoadParam 195 222 { … … 201 228 202 229 protected: 203 LoadClassDescription* classDesc;//!< The LoadClassDescription of this LoadParameter204 LoadParamDescription* paramDesc;//!< The LoadParameterDescription of this LoadParameter205 const char* loadString;//!< The string loaded by this LoadParam230 LoadClassDescription* classDesc; //!< The LoadClassDescription of this LoadParameter 231 LoadParamDescription* paramDesc; //!< The LoadParameterDescription of this LoadParameter 232 const char* loadString; //!< The string loaded by this LoadParam 206 233 }; 207 234 … … 211 238 { 212 239 public: 240 //! makes functions with one string loadable 213 241 LoadParam1(l_STRING); 242 //! makes functions with two strings loadable 214 243 LoadParam2(l_STRING, l_STRING); 244 //! makes functions with three strings loadable 215 245 LoadParam3(l_STRING, l_STRING, l_STRING); 246 //! makes functions with four strings loadable 216 247 LoadParam4(l_STRING, l_STRING, l_STRING, l_STRING); 217 248 249 //! makes functions with one int loadable 218 250 LoadParam1(l_INT); 251 //! makes functions with two ints loadable 219 252 LoadParam2(l_INT, l_INT); 253 //! makes functions with three ints loadable 220 254 LoadParam3(l_INT, l_INT, l_INT); 255 //! makes functions with four ints loadable 221 256 LoadParam4(l_INT, l_INT, l_INT, l_INT); 222 257 258 //! makes functions with one float loadable 223 259 LoadParam1(l_FLOAT); 260 //! makes functions with two floats loadable 224 261 LoadParam2(l_FLOAT, l_FLOAT); 262 //! makes functions with three floats loadable 225 263 LoadParam3(l_FLOAT, l_FLOAT, l_FLOAT); 264 //! makes functions with four floats loadable 226 265 LoadParam4(l_FLOAT, l_FLOAT, l_FLOAT, l_FLOAT); 227 266 };
Note: See TracChangeset
for help on using the changeset viewer.