Changeset 7331 in orxonox.OLD for trunk/src/lib/util
- Timestamp:
- Apr 18, 2006, 4:48:37 PM (19 years ago)
- Location:
- trunk/src/lib/util
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/executor/executor.h
r7300 r7331 34 34 * Default Values 35 35 * Functions with up to 5 parameters (more seems useless) 36 * Functions with many types ( see functor_list.h)36 * Functions with many types (@see functor_list.h) 37 37 */ 38 38 class Executor: public BaseObject … … 43 43 virtual Executor* clone () const = 0; 44 44 45 // SETTING up the EXECUTOR 45 46 Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL, 46 47 const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL, 47 48 const MultiType& value4 = MT_NULL); 48 49 50 // EXECUTE 49 51 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */ 50 virtual void execute (BaseObject* object, const std::string& parameters = "") = 0; 51 52 virtual void operator()(BaseObject* object, const std::string& parameters = "") = 0; 53 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes @brief here for your convenience*/ 54 void execute (BaseObject* object, const std::string& parameters = "") { (*this)(object, parameters); }; 55 56 // RETRIEVE INFORMATION 52 57 /** @returns the Type of this Function (either static or objective) */ 53 58 inline long getType() const { return this->functorType; }; … … 65 70 66 71 protected: 67 longfunctorType; //!< The type of Function we've got (either static or objective).72 short functorType; //!< The type of Function we've got (either static or objective). 68 73 unsigned int paramCount; //!< the count of parameters. 69 74 MultiType defaultValue[5]; //!< Default Values. … … 72 77 /////////////////////////////////////////////////// 73 78 /////////////////////////////////////////////////// 74 75 /////////////////////////////////76 // MACRO DEFINITION EXTENSIONS //77 /////////////////////////////////78 //! where to chek for default BOOL values79 #define l_BOOL_DEFGRAB(i) this->defaultValue[i].getBool()80 //! where to chek for default INT values81 #define l_INT_DEFGRAB(i) this->defaultValue[i].getInt()82 //! where to chek for default UINT values83 #define l_UINT_DEFGRAB(i) (unsigned int)this->defaultValue[i].getInt()84 //! where to chek for default LONG values85 #define l_LONG_DEFGRAB(i) (long)this->defaultValue[i].getInt()86 //! where to chek for default FLOAT values87 #define l_FLOAT_DEFGRAB(i) this->defaultValue[i].getFloat()88 //! where to chek for default STRING values89 #define l_STRING_DEFGRAB(i) this->defaultValue[i].getString()90 //! where to chek for default CSTRING values91 #define l_CSTRING_DEFGRAB(i) this->defaultValue[i].getCString()92 79 93 80 ////////////////////////// … … 267 254 } fp; 268 255 269 virtual void execute(BaseObject* object, const std::string& parameters = "")256 virtual void operator()(BaseObject* object, const std::string& parameters = "") 270 257 { 271 258 SubString sub; … … 330 317 331 318 332 virtual void execute(BaseObject* object, const std::string& parameters = "")319 virtual void operator()(BaseObject* object, const std::string& parameters = "") 333 320 { 334 321 SubString sub; -
trunk/src/lib/util/executor/executor_specials.h
r7221 r7331 23 23 public: 24 24 /** 25 *Constructor of a ExecutorXML25 * @brief Constructor of a ExecutorXML 26 26 * @param function a Function to call 27 27 * @param root The XML root to search paramName under … … 43 43 44 44 /** 45 * clones an ExecutorXML, used to copy this Element.45 * @brief clones an ExecutorXML, used to copy this Element. 46 46 * @returns a _new_ Copy of this Executor 47 47 */ … … 56 56 57 57 /** 58 * executes the Command on BaseObject58 * @brief executes the Command on BaseObject 59 59 * @param object the BaseObject to execute this Executor on 60 60 * @param loadString ignored in this case 61 61 */ 62 virtual void execute(BaseObject* object, const std::string& = "")62 virtual void operator()(BaseObject* object, const std::string& = "") 63 63 { 64 64 if (object != NULL && this->element != NULL) … … 68 68 private: 69 69 /** 70 *used for the copy-(Clone)-constructor70 * @brief used for the copy-(Clone)-constructor 71 71 */ 72 72 ExecutorXML() : Executor() { }; -
trunk/src/lib/util/executor/functor_list.h
r7221 r7331 32 32 #include "multi_type.h" 33 33 34 34 35 #define l_BOOL_TYPE bool //!< The type of an BOOL 35 36 #define l_BOOL_FUNC isBool //!< The function to call to parse BOOL 36 #define l_BOOL_NAME "bool" //!< The name of an BOOL37 37 #define l_BOOL_PARAM MT_BOOL //!< the type of the parameter BOOL 38 38 #define l_BOOL_DEFAULT false //!< a default Value for an BOOL 39 39 #define l_BOOL_DEFGRAB(i) this->defaultValue[i].getBool() 40 40 41 41 #define l_INT_TYPE int //!< The type of an INT 42 42 #define l_INT_FUNC isInt //!< The function to call to parse INT 43 #define l_INT_NAME "int" //!< The name of an INT44 43 #define l_INT_PARAM MT_INT //!< the type of the parameter INT 45 44 #define l_INT_DEFAULT 0 //!< a default Value for an INT 45 #define l_INT_DEFGRAB(i) this->defaultValue[i].getInt() 46 46 47 47 #define l_UINT_TYPE unsigned int //!< The type of an UINT 48 48 #define l_UINT_FUNC isInt //!< The function to call to parse UINT 49 #define l_UINT_NAME "unsigned int" //!< The name of an UINT50 49 #define l_UINT_PARAM MT_INT //!< the type of the parameter UINT 51 50 #define l_UINT_DEFAULT 0 //!< a default Value for an UINT 51 #define l_UINT_DEFGRAB(i) (unsigned int)this->defaultValue[i].getInt() 52 52 53 53 #define l_LONG_TYPE long //!< The type of a LONG 54 54 #define l_LONG_FUNC isInt //!< The function to parse a LONG 55 #define l_LONG_NAME "long" //!< The name of a LONG56 55 #define l_LONG_PARAM MT_INT //!< the type of the parameter LONG 57 56 #define l_LONG_DEFAULT 0 //!< a default Value for a LONG 57 #define l_LONG_DEFGRAB(i) (long)this->defaultValue[i].getInt() 58 58 59 59 // #define l_SHORT_TYPE short //!< The type of a SHORT … … 65 65 #define l_FLOAT_TYPE float //!< The type of a FLOAT 66 66 #define l_FLOAT_FUNC isFloat //!< The function to parse a FLOAT 67 #define l_FLOAT_NAME "float" //!< The name of a FLOAT68 67 #define l_FLOAT_PARAM MT_FLOAT //!< the type of the parameter FLOAT 69 68 #define l_FLOAT_DEFAULT 0.0 //!< a default Value for a FLOAT 69 #define l_FLOAT_DEFGRAB(i) this->defaultValue[i].getFloat() 70 70 71 71 //#define l_VECTOR_TYPE const Vector& //!< The type of a VECTOR … … 76 76 #define l_STRING_TYPE const std::string& //!< The type of a STRING 77 77 #define l_STRING_FUNC isString //!< The function to parse a STRING 78 #define l_STRING_NAME "string" //!< The name of a STRING 79 #define l_STRING_PARAM MT_STRING //!< the type of the parameter STRING 78 #define l_STRING_PARAM MT_STRING //!< the type of the parameter STRING 80 79 #define l_STRING_DEFAULT "" //!< a default Value for an STRING 80 #define l_STRING_DEFGRAB(i) this->defaultValue[i].getString() 81 81 82 82 #define l_XML_ELEM_TYPE const TiXmlElement* //!< The type of an XML_ELEM 83 83 #define l_XML_ELEM_FUNC //!< The function to parse an XML_ELEM 84 #define l_XML_ELEM_NAME "XML" //!< The name of an XML_ELEM85 84 //#define l_XML_ELEM_PARAM Parameter //!< the type of the parameter XML_ELEM 86 85 #define l_XML_ELEM_DEFAULT NULL //!< The dafault Value for an XML_ELEM -
trunk/src/lib/util/loading/load_param.cc
r7221 r7331 67 67 { 68 68 PRINTF(4)("Loading value '%s' with Parameters '%s' onto: %s::%s\n", this->paramName.c_str(), loadString.c_str(), this->object->getClassName(), this->object->getName()); 69 this->executor->execute(this->object, loadString);69 (*this->executor)(this->object, loadString); 70 70 } 71 71 delete this->executor; -
trunk/src/lib/util/threading.h
r7329 r7331 17 17 18 18 //! A class for Wrapping Threads 19 class Threading { 19 class Threading 20 { 20 21 21 22 public: 22 23 Threading(); 23 24 virtual ~Threading(); 24 25 25 26 26 27 private: 27 28 28 29 }; 29 30 31 //! A Class that locks a Mutex within its scope 32 class MutexLock 33 { 34 public: 35 //! Locks the Mutex mutex in this Scope. 36 MutexLock(SDL_mutex* mutex) { SDL_mutexP(mutex); this->mutex = mutex; }; 37 ~MutexLock() { SDL_mutexV(mutex); }; 38 private: 39 SDL_mutex* mutex; //!< The Mutex to lock. 40 }; 41 42 30 43 #endif /* _THREADING_H */
Note: See TracChangeset
for help on using the changeset viewer.