Changeset 7352 for code/branches/doc/src/libraries/core/command/Functor.h
- Timestamp:
- Sep 4, 2010, 11:33:02 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/doc/src/libraries/core/command/Functor.h
r7284 r7352 27 27 */ 28 28 29 /** 30 @file 31 @ingroup Command FunctorExecutor 32 @brief Definition of orxonox::Functor and its specialized subclasses, as well as the createFunctor() functions. 33 34 @anchor FunctorExample 35 36 Functors can be used to wrap function-pointers. While function-pointers have a very 37 complicated syntax in C++, Functors are always the same and you can call the wrapped 38 function-pointer independently of its parameter with arguments of type MultiType. These 39 arguments are then automatically converted to the right type. 40 41 To create a Functor, the helper function createFunctor() is used. It returns an instance 42 of orxonox::FunctorPtr which is simply a typedef of @ref orxonox::SharedPtr "SharedPtr<Functor>". 43 This means you don't have to delete the Functor after using it, because it is managed 44 by the SharedPtr. 45 46 Example: 47 @code 48 int myStaticFunction(int value) // Definition of a static function 49 { 50 return (value * 2); // Return the double of the value 51 } 52 53 FunctorPtr functor = createFunctor(&myStaticFunction); // Create a Functor 54 55 int result = (*functor)(5); // Calls the functor with value = 5, result == 10 56 57 int result = (*functor)("7"); // Calls the functor with a string which is converted to an integer, result == 14 58 @endcode 59 60 Functors can also be used if you work with member-functions. In this case createFunctor() 61 returns an instance of orxonox::FunctorMemberPtr - this allows you to define the object 62 that will be used to call the function. 63 64 Example: 65 @code 66 class MyClass // Define a class 67 { 68 public: 69 MyClass(const std::string& text) // Constructor 70 { 71 this->text_ = text; 72 } 73 74 bool contains(const std::string& word) // Function that searches for "word" in "text" 75 { 76 return (this->text_.find(word) != std::string::npos); 77 } 78 79 private: 80 std::string text_; // Member variable 81 }; 82 83 MyClass* object = new MyClass("Hello World"); // Create an object of type MyClass and set its text to "Hello World" 84 85 FunctorPtr functor = createFunctor(&MyClass:contains, object); // Create a Functor (note the object!) 86 87 bool result = (*functor)("World"); // result == true 88 bool result = (*functor)("test"); // result == false 89 @endcode 90 91 Instead of assigning the object directly to the functor when creating it, you can also define 92 it at any later point or when you call the functor. Note however that this works only with 93 orxonox::FunctorMember. 94 95 @code 96 MyClass* object1 = new MyClass("Hello World"); // Create an object 97 MyClass* object2 = new MyClass("this is a test"); // Create another object 98 99 FunctorMemberPtr functor = createFunctor(&MyClass:contains); // Create a FunctorMember (note: no object this time) 100 101 bool result = (*functor)("World"); // result == false and an error: "Error: Can't execute FunctorMember, no object set." 102 103 bool result = (*functor)(object1, "World"); // result == true 104 bool result = (*functor)(object1, "test"); // result == false 105 bool result = (*functor)(object2, "test"); // result == true 106 107 functor->setObject(object1); // Assign an object to the FunctorMember 108 109 bool result = (*functor)("World"); // result == true (no error this time, because the object was set using setObject()) 110 @endcode 111 */ 112 29 113 #ifndef _Functor_H__ 30 114 #define _Functor_H__ … … 40 124 namespace orxonox 41 125 { 42 const unsigned int MAX_FUNCTOR_ARGUMENTS = 5; 43 126 const unsigned int MAX_FUNCTOR_ARGUMENTS = 5; ///< The maximum number of parameters of a function that is supported by Functor 127 128 namespace detail 129 { 130 template <class T> 131 inline std::string _typeToString() { return "unknown"; } 132 133 template <> inline std::string _typeToString<void>() { return "void"; } 134 template <> inline std::string _typeToString<int>() { return "int"; } 135 template <> inline std::string _typeToString<unsigned int>() { return "uint"; } 136 template <> inline std::string _typeToString<char>() { return "char"; } 137 template <> inline std::string _typeToString<unsigned char>() { return "uchar"; } 138 template <> inline std::string _typeToString<short>() { return "short"; } 139 template <> inline std::string _typeToString<unsigned short>() { return "ushort"; } 140 template <> inline std::string _typeToString<long>() { return "long"; } 141 template <> inline std::string _typeToString<unsigned long>() { return "ulong"; } 142 template <> inline std::string _typeToString<long long>() { return "longlong"; } 143 template <> inline std::string _typeToString<unsigned long long>() { return "ulonglong"; } 144 template <> inline std::string _typeToString<float>() { return "float"; } 145 template <> inline std::string _typeToString<double>() { return "double"; } 146 template <> inline std::string _typeToString<long double>() { return "longdouble"; } 147 template <> inline std::string _typeToString<bool>() { return "bool"; } 148 template <> inline std::string _typeToString<std::string>() { return "string"; } 149 template <> inline std::string _typeToString<Vector2>() { return "Vector2"; } 150 template <> inline std::string _typeToString<Vector3>() { return "Vector3"; } 151 template <> inline std::string _typeToString<Quaternion>() { return "Quaternion"; } 152 template <> inline std::string _typeToString<ColourValue>() { return "ColourValue"; } 153 template <> inline std::string _typeToString<Radian>() { return "Radian"; } 154 template <> inline std::string _typeToString<Degree>() { return "Degree"; } 155 } 156 157 /// Returns the name of type @a T as string. 44 158 template <class T> 45 inline std::string _typeToString() { return "unknown"; } 46 47 template <> inline std::string _typeToString<void>() { return ""; } 48 template <> inline std::string _typeToString<int>() { return "int"; } 49 template <> inline std::string _typeToString<unsigned int>() { return "uint"; } 50 template <> inline std::string _typeToString<char>() { return "char"; } 51 template <> inline std::string _typeToString<unsigned char>() { return "uchar"; } 52 template <> inline std::string _typeToString<short>() { return "short"; } 53 template <> inline std::string _typeToString<unsigned short>() { return "ushort"; } 54 template <> inline std::string _typeToString<long>() { return "long"; } 55 template <> inline std::string _typeToString<unsigned long>() { return "ulong"; } 56 template <> inline std::string _typeToString<long long>() { return "longlong"; } 57 template <> inline std::string _typeToString<unsigned long long>() { return "ulonglong"; } 58 template <> inline std::string _typeToString<float>() { return "float"; } 59 template <> inline std::string _typeToString<double>() { return "double"; } 60 template <> inline std::string _typeToString<long double>() { return "longdouble"; } 61 template <> inline std::string _typeToString<bool>() { return "bool"; } 62 template <> inline std::string _typeToString<std::string>() { return "string"; } 63 template <> inline std::string _typeToString<Vector2>() { return "Vector2"; } 64 template <> inline std::string _typeToString<Vector3>() { return "Vector3"; } 65 template <> inline std::string _typeToString<Quaternion>() { return "Quaternion"; } 66 template <> inline std::string _typeToString<ColourValue>() { return "ColourValue"; } 67 template <> inline std::string _typeToString<Radian>() { return "Radian"; } 68 template <> inline std::string _typeToString<Degree>() { return "Degree"; } 69 70 template <class T> 71 inline std::string typeToString() { return _typeToString<typename Loki::TypeTraits<T>::UnqualifiedReferredType>(); } 72 159 inline std::string typeToString() { return detail::_typeToString<typename Loki::TypeTraits<T>::UnqualifiedReferredType>(); } 160 161 /** 162 @brief The Functor classes are used to wrap function pointers. 163 164 Function-pointers in C++ have a pretty complicated syntax and you can't store 165 and call them unless you know the exact type. A Functor can be used to wrap 166 a function-pointer and to store it independent of its type. You can also call 167 it independently of its parameters by passing the arguments as MultiType. They 168 are converted automatically to the right type. 169 170 Functor is a pure virtual base class. 171 172 @see See @ref FunctorExample "Functor.h" for some examples. 173 */ 73 174 class _CoreExport Functor 74 175 { … … 76 177 struct Type 77 178 { 179 /// Defines the type of a function (static or member) 78 180 enum Enum 79 181 { … … 84 186 85 187 public: 188 /// Calls the function-pointer with up to five arguments. In case of a member-function, the assigned object-pointer is used to call the function. @return Returns the return-value of the function (if any; MT_Type::Null otherwise) 86 189 virtual MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0; 87 190 191 /// Creates a new instance of Functor with the same values like this (used instead of a copy-constructor) 88 192 virtual FunctorPtr clone() = 0; 89 193 194 /// Returns the type of the function: static or member. 90 195 virtual Type::Enum getType() const = 0; 196 /// Returns the number of parameters of the function. 91 197 virtual unsigned int getParamCount() const = 0; 198 /// Returns true if the function has a return-value. 92 199 virtual bool hasReturnvalue() const = 0; 93 200 94 virtual std::string getTypenameParam(unsigned int param) const = 0; 201 /// Returns the type-name of the parameter with given index (the first parameter has index 0). 202 virtual std::string getTypenameParam(unsigned int index) const = 0; 203 /// Returns the type-name of the return-value. 95 204 virtual std::string getTypenameReturnvalue() const = 0; 96 205 97 virtual void evaluateParam(unsigned int index, MultiType& param) const = 0; 98 99 virtual void setRawObjectPointer(void* object) {} 100 virtual void* getRawObjectPointer() const { return 0; } 101 102 template <class F> 103 inline bool setFunction(F* function) 104 { 105 if (this->getFullIdentifier() == typeid(F*)) 106 { 107 modifyFunctor(this, function); 108 return true; 109 } 110 return false; 111 } 112 206 /// Converts a given argument to the type of the parameter with given index (the first parameter has index 0). 207 virtual void evaluateArgument(unsigned int index, MultiType& argument) const = 0; 208 209 /// Assigns an object-pointer to the functor which is used to execute a member-function. 210 virtual void setRawObjectPointer(void* object) = 0; 211 /// Returns the object-pointer. 212 virtual void* getRawObjectPointer() const = 0; 213 214 /// Returns the full identifier of the function-pointer which is defined as typeid(@a F), where @a F is the type of the stored function-pointer. Used to compare functors. 113 215 virtual const std::type_info& getFullIdentifier() const = 0; 216 /// Returns an identifier of the header of the function (doesn't include the function's class). Used to compare functors. 114 217 virtual const std::type_info& getHeaderIdentifier() const = 0; 218 /// Returns an identifier of the header of the function (doesn't include the function's class), but regards only the first @a params parameters. Used to compare functions if an Executor provides default-values for the other parameters. 115 219 virtual const std::type_info& getHeaderIdentifier(unsigned int params) const = 0; 116 220 }; … … 118 222 namespace detail 119 223 { 224 // helper class to determine if a functor is static or not 120 225 template <class O> 121 226 struct FunctorTypeStatic … … 126 231 } 127 232 233 /** 234 @brief FunctorMember is a child class of Functor and expands it with an object-pointer, that 235 is used for member-functions, as well as an overloaded execution operator. 236 237 @param O The type of the function's class (or void if it's a static function) 238 239 Note that FunctorMember is also used for static functions, but with T = void. FunctorStatic 240 is a typedef of FunctorMember<void>. The void* object-pointer is ignored in this case. 241 242 @see See @ref FunctorExample "Functor.h" for some examples. 243 */ 128 244 template <class O> 129 245 class FunctorMember : public Functor 130 246 { 131 247 public: 248 /// Constructor: Stores the object-pointer. 132 249 FunctorMember(O* object = 0) : object_(object) {} 133 250 251 /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MT_Type::Null otherwise) 134 252 virtual MultiType operator()(O* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) = 0; 135 253 254 // see Functor::operator()() 136 255 MultiType operator()(const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) 137 256 { 257 // call the function if it is static or if an object was assigned 138 258 if (detail::FunctorTypeStatic<O>::result || this->object_) 139 259 return (*this)(this->object_, param1, param2, param3, param4, param5); … … 145 265 } 146 266 267 // see Functor::getType() 147 268 Functor::Type::Enum getType() const 148 269 { return detail::FunctorTypeStatic<O>::result ? Functor::Type::Static : Functor::Type::Member; } 149 270 271 /// Assigns an object-pointer to the functor which is used to execute a member-function. 150 272 inline void setObject(O* object) 151 273 { this->object_ = object;} 274 /// Returns the object-pointer. 152 275 inline O* getObject() const 153 276 { return this->object_; } 154 277 278 // see Functor::setRawObjectPointer() 155 279 inline void setRawObjectPointer(void* object) 156 280 { this->object_ = (O*)object; } 281 // see Functor::getRawObjectPointer() 157 282 inline void* getRawObjectPointer() const 158 283 { return this->object_; } 159 284 160 285 protected: 161 O* object_; 286 O* object_; ///< The stored object-pointer, used to execute a member-function (or NULL for static functions) 162 287 }; 163 288 289 /// FunctorStatic is just a typedef of FunctorMember with @a T = void. 164 290 typedef FunctorMember<void> FunctorStatic; 165 291 292 /** 293 @brief FunctorPointer is a child class of FunctorMember and expands it with a function-pointer. 294 @param F The type of the function-pointer 295 @param O The type of the function's class (or void if it's a static function) 296 297 The template FunctorPointer has an additional template parameter that defines the type 298 of the function-pointer. This can be handy if you want to get or set the function-pointer. 299 You can then use a static_cast to cast a Functor to FunctorPointer if you know the type 300 of the function-pointer. 301 302 However FunctorPointer is not aware of the types of the different parameters or the 303 return value. 304 */ 166 305 template <class F, class O = void> 167 306 class FunctorPointer : public FunctorMember<O> 168 307 { 169 308 public: 309 /// Constructor: Initializes the base class and stores the function-pointer. 170 310 FunctorPointer(F functionPointer, O* object = 0) : FunctorMember<O>(object), functionPointer_(functionPointer) {} 171 311 312 /// Changes the function-pointer. 172 313 inline void setFunction(F functionPointer) 173 314 { this->functionPointer_ = functionPointer; } 315 /// Returns the function-pointer. 174 316 inline F getFunction() const 175 317 { return this->functionPointer_; } 176 318 319 // see Functor::getFullIdentifier() 177 320 const std::type_info& getFullIdentifier() const 178 321 { return typeid(F); } 179 322 180 323 protected: 181 F functionPointer_; 324 F functionPointer_; ///< The stored function-pointer 182 325 }; 183 326 184 327 namespace detail 185 328 { 329 // Helper class to get the type of the function pointer with the given class, parameters, return-value, and constness 186 330 template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctionPointer { typedef R (O::*Type)(P1, P2, P3, P4, P5); }; 187 331 template <class R, class O, class P1, class P2, class P3, class P4, class P5> struct FunctionPointer<R, O, false, P1, P2, P3, P4, P5> { typedef R (O::*Type)(P1, P2, P3, P4, P5); }; … … 204 348 template <class R> struct FunctionPointer<R, void, false, void, void, void, void, void> { typedef R (*Type)(); }; 205 349 350 // Helper class, used to call a function-pointer with a given object and parameters and to return its return-value (if available) 206 351 template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2, param3, param4, param5); } }; 207 352 template <class R, class O, bool isconst, class P1, class P2, class P3, class P4> struct FunctorCaller<R, O, isconst, P1, P2, P3, P4, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2, param3, param4); } }; … … 229 374 template <bool isconst> struct FunctorCaller<void, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(); return MT_Type::Null; } }; 230 375 376 // Helper class, used to identify the header of a function-pointer (independent of its class) 231 377 template <class R, class P1, class P2, class P3, class P4, class P5> 232 378 struct FunctorHeaderIdentifier 233 379 {}; 234 380 381 // Helper class to determine if a function has a returnvalue 235 382 template <class T> 236 383 struct FunctorHasReturnvalue … … 240 387 { enum { result = false }; }; 241 388 389 // Helper class to count the number of parameters 242 390 template <class P1, class P2, class P3, class P4, class P5> 243 391 struct FunctorParamCount … … 260 408 } 261 409 410 /** 411 @brief FunctorTemplate is a child class of FunctorPointer and implements all functions 412 that need to know the exact types of the parameters, return-value, and class. 413 414 @param R The type of the return-value of the function 415 @param O The class of the function 416 @param isconst True if the function is a const member-function 417 @param P1 The type of the first parameter 418 @param P2 The type of the second parameter 419 @param P3 The type of the third parameter 420 @param P4 The type of the fourth parameter 421 @param P5 The type of the fifth parameter 422 423 This template has many parameters and is usually not used directly. It is created by 424 createFunctor(), but only the base-classes Functor, FunctorMember, and FunctorPointer 425 are used directly. It implements all the virtual functions that are declared by its 426 base classes. 427 428 All template arguments can be void. 429 */ 262 430 template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5> 263 431 class FunctorTemplate : public FunctorPointer<typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type, O> 264 432 { 265 433 public: 434 /// Constructor: Initializes the base class. 266 435 FunctorTemplate(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object = 0) : FunctorPointer<typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type, O>(functionPointer, object) {} 267 436 437 // see FunctorMember::operator()() 268 438 MultiType operator()(O* object, const MultiType& param1 = MT_Type::Null, const MultiType& param2 = MT_Type::Null, const MultiType& param3 = MT_Type::Null, const MultiType& param4 = MT_Type::Null, const MultiType& param5 = MT_Type::Null) 269 439 { … … 271 441 } 272 442 443 // see Functor::clone() 273 444 FunctorPtr clone() 274 445 { … … 276 447 } 277 448 278 void evaluateParam(unsigned int index, MultiType& param) const 449 // see Functor::evaluateArgument() 450 void evaluateArgument(unsigned int index, MultiType& argument) const 279 451 { 280 452 switch (index) 281 453 { 282 case 0: param.convert<P1>(); break;283 case 1: param.convert<P2>(); break;284 case 2: param.convert<P3>(); break;285 case 3: param.convert<P4>(); break;286 case 4: param.convert<P5>(); break;454 case 0: argument.convert<P1>(); break; 455 case 1: argument.convert<P2>(); break; 456 case 2: argument.convert<P3>(); break; 457 case 3: argument.convert<P4>(); break; 458 case 4: argument.convert<P5>(); break; 287 459 } 288 460 } 289 461 462 // see Functor::getParamCount() 290 463 unsigned int getParamCount() const 291 464 { … … 293 466 } 294 467 468 // see Functor::hasReturnvalue() 295 469 bool hasReturnvalue() const 296 470 { … … 298 472 } 299 473 300 std::string getTypenameParam(unsigned int param) const 301 { 302 switch (param) 474 // see Functor::getTypenameParam() 475 std::string getTypenameParam(unsigned int index) const 476 { 477 switch (index) 303 478 { 304 479 case 0: return typeToString<P1>(); … … 311 486 } 312 487 488 // see Functor::getTypenameReturnvalue() 313 489 std::string getTypenameReturnvalue() const 314 490 { … … 316 492 } 317 493 494 // see Functor::getHeaderIdentifier() 318 495 const std::type_info& getHeaderIdentifier() const 319 496 { … … 321 498 } 322 499 500 // see Functor::getHeaderIdentifier(unsigned int) 323 501 const std::type_info& getHeaderIdentifier(unsigned int params) const 324 502 { … … 335 513 }; 336 514 337 template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer, object); } 338 template <class R, class O, class OO, class P1, class P2, class P3, class P4> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer, object); } 339 template <class R, class O, class OO, class P1, class P2, class P3> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer, object); } 340 template <class R, class O, class OO, class P1, class P2> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer, object); } 341 template <class R, class O, class OO, class P1> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1), OO* object) { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer, object); } 342 template <class R, class O, class OO> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(), OO* object) { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer, object); } 343 template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer, object); } 344 template <class R, class O, class OO, class P1, class P2, class P3, class P4> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer, object); } 345 template <class R, class O, class OO, class P1, class P2, class P3> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer, object); } 346 template <class R, class O, class OO, class P1, class P2> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer, object); } 347 template <class R, class O, class OO, class P1> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const, OO* object) { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer, object); } 348 template <class R, class O, class OO> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const, OO* object) { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer, object); } 349 350 template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer); } 351 template <class R, class O, class P1, class P2, class P3, class P4> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4)) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer); } 352 template <class R, class O, class P1, class P2, class P3> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3)) { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer); } 353 template <class R, class O, class P1, class P2> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2)) { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer); } 354 template <class R, class O, class P1> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1)) { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer); } 355 template <class R, class O> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)()) { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer); } 356 template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer); } 357 template <class R, class O, class P1, class P2, class P3, class P4> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer); } 358 template <class R, class O, class P1, class P2, class P3> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const) { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer); } 359 template <class R, class O, class P1, class P2> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const) { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer); } 360 template <class R, class O, class P1> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const) { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer); } 361 template <class R, class O> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const) { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer); } 362 363 template <class R, class P1, class P2, class P3, class P4, class P5> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, P5>(functionPointer); } 364 template <class R, class P1, class P2, class P3, class P4> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4)) { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, void>(functionPointer); } 365 template <class R, class P1, class P2, class P3> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3)) { return new FunctorTemplate<R, void, false, P1, P2, P3, void, void>(functionPointer); } 366 template <class R, class P1, class P2> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2)) { return new FunctorTemplate<R, void, false, P1, P2, void, void, void>(functionPointer); } 367 template <class R, class P1> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1)) { return new FunctorTemplate<R, void, false, P1, void, void, void, void>(functionPointer); } 368 template <class R> inline FunctorStaticPtr createFunctor(R (*functionPointer)()) { return new FunctorTemplate<R, void, false, void, void, void, void, void>(functionPointer); } 515 template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 516 template <class R, class O, class OO, class P1, class P2, class P3, class P4> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 517 template <class R, class O, class OO, class P1, class P2, class P3> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 518 template <class R, class O, class OO, class P1, class P2> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2), OO* object) { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 519 template <class R, class O, class OO, class P1> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1), OO* object) { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 520 template <class R, class O, class OO> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(), OO* object) { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 521 template <class R, class O, class OO, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 522 template <class R, class O, class OO, class P1, class P2, class P3, class P4> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 523 template <class R, class O, class OO, class P1, class P2, class P3> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 524 template <class R, class O, class OO, class P1, class P2> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const, OO* object) { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 525 template <class R, class O, class OO, class P1> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const, OO* object) { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 526 template <class R, class O, class OO> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const, OO* object) { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer, object); } ///< Creates a new FunctorMember with the given function-pointer and an assigned object 527 528 template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, P5>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 529 template <class R, class O, class P1, class P2, class P3, class P4> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4)) { return new FunctorTemplate<R, O, false, P1, P2, P3, P4, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 530 template <class R, class O, class P1, class P2, class P3> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3)) { return new FunctorTemplate<R, O, false, P1, P2, P3, void, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 531 template <class R, class O, class P1, class P2> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2)) { return new FunctorTemplate<R, O, false, P1, P2, void, void, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 532 template <class R, class O, class P1> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1)) { return new FunctorTemplate<R, O, false, P1, void, void, void, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 533 template <class R, class O> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)()) { return new FunctorTemplate<R, O, false, void, void, void, void, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 534 template <class R, class O, class P1, class P2, class P3, class P4, class P5> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4, P5) const) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, P5>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 535 template <class R, class O, class P1, class P2, class P3, class P4> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3, P4) const) { return new FunctorTemplate<R, O, true, P1, P2, P3, P4, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 536 template <class R, class O, class P1, class P2, class P3> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2, P3) const) { return new FunctorTemplate<R, O, true, P1, P2, P3, void, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 537 template <class R, class O, class P1, class P2> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1, P2) const) { return new FunctorTemplate<R, O, true, P1, P2, void, void, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 538 template <class R, class O, class P1> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)(P1) const) { return new FunctorTemplate<R, O, true, P1, void, void, void, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 539 template <class R, class O> inline FunctorMemberPtr<O> createFunctor(R (O::*functionPointer)() const) { return new FunctorTemplate<R, O, true, void, void, void, void, void>(functionPointer); } ///< Creates a new FunctorMember with the given function-pointer 540 541 template <class R, class P1, class P2, class P3, class P4, class P5> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4, P5)) { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, P5>(functionPointer); } ///< Creates a new Functor with the given function-pointer 542 template <class R, class P1, class P2, class P3, class P4> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3, P4)) { return new FunctorTemplate<R, void, false, P1, P2, P3, P4, void>(functionPointer); } ///< Creates a new Functor with the given function-pointer 543 template <class R, class P1, class P2, class P3> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2, P3)) { return new FunctorTemplate<R, void, false, P1, P2, P3, void, void>(functionPointer); } ///< Creates a new Functor with the given function-pointer 544 template <class R, class P1, class P2> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1, P2)) { return new FunctorTemplate<R, void, false, P1, P2, void, void, void>(functionPointer); } ///< Creates a new Functor with the given function-pointer 545 template <class R, class P1> inline FunctorStaticPtr createFunctor(R (*functionPointer)(P1)) { return new FunctorTemplate<R, void, false, P1, void, void, void, void>(functionPointer); } ///< Creates a new Functor with the given function-pointer 546 template <class R> inline FunctorStaticPtr createFunctor(R (*functionPointer)()) { return new FunctorTemplate<R, void, false, void, void, void, void, void>(functionPointer); } ///< Creates a new Functor with the given function-pointer 369 547 } 370 548
Note: See TracChangeset
for help on using the changeset viewer.