132         inline std::string _typeToString() { 
return "unknown"; }
   134         template <> 
inline std::string _typeToString<void>()               { 
return "void"; }
   135         template <> 
inline std::string _typeToString<int>()                { 
return "int"; }
   136         template <> 
inline std::string _typeToString<unsigned int>()       { 
return "uint"; }
   137         template <> 
inline std::string _typeToString<char>()               { 
return "char"; }
   138         template <> 
inline std::string _typeToString<unsigned char>()      { 
return "uchar"; }
   139         template <> 
inline std::string _typeToString<short>()              { 
return "short"; }
   140         template <> 
inline std::string _typeToString<unsigned short>()     { 
return "ushort"; }
   141         template <> 
inline std::string _typeToString<long>()               { 
return "long"; }
   142         template <> 
inline std::string _typeToString<unsigned long>()      { 
return "ulong"; }
   143         template <> 
inline std::string _typeToString<long long>()          { 
return "longlong"; }
   144         template <> 
inline std::string _typeToString<unsigned long long>() { 
return "ulonglong"; }
   145         template <> 
inline std::string _typeToString<float>()              { 
return "float"; }
   146         template <> 
inline std::string _typeToString<double>()             { 
return "double"; }
   147         template <> 
inline std::string _typeToString<long double>()        { 
return "longdouble"; }
   148         template <> 
inline std::string _typeToString<bool>()               { 
return "bool"; }
   149         template <> 
inline std::string _typeToString<std::string>()        { 
return "string"; }
   150         template <> 
inline std::string _typeToString<Vector2>()            { 
return "Vector2"; }
   151         template <> 
inline std::string _typeToString<Vector3>()            { 
return "Vector3"; }
   152         template <> 
inline std::string _typeToString<Quaternion>()         { 
return "Quaternion"; }
   153         template <> 
inline std::string _typeToString<ColourValue>()        { 
return "ColourValue"; }
   154         template <> 
inline std::string _typeToString<Radian>()             { 
return "Radian"; }
   155         template <> 
inline std::string _typeToString<Degree>()             { 
return "Degree"; }
   195             virtual Type getType() 
const = 0;
   197             virtual unsigned int getParamCount() 
const = 0;
   199             virtual bool hasReturnvalue() 
const = 0;
   202             virtual std::string getTypenameParam(
unsigned int index) 
const = 0;
   204             virtual std::string getTypenameReturnvalue() 
const = 0;
   207             virtual void evaluateArgument(
unsigned int index, 
MultiType& argument) 
const = 0;
   210             virtual void setRawObjectPointer(
void* 
object) = 0;
   212             virtual void* getRawObjectPointer() 
const = 0;
   215             virtual void setSafeMode(
bool bSafeMode) = 0;
   218             virtual const std::type_info& getFullIdentifier() 
const = 0;
   220             virtual const std::type_info& getHeaderIdentifier() 
const = 0;
   222             virtual const std::type_info& getHeaderIdentifier(
unsigned int params) 
const = 0;
   242             virtual ~FunctorMember() { 
if (this->bSafeMode_) { this->unregisterObject(this->object_); } }
   252                     return (*
this)(this->object_, param1, param2, param3, param4, param5);
   267                 if (this->bSafeMode_ && 
object != this->object_)
   269                     this->unregisterObject(this->object_);
   270                     this->registerObject(
object);
   272                 this->object_ = object;
   276                 { 
return this->object_; }
   280                 { this->setObject((
O*)
object); }
   283                 { 
return this->object_; }
   288                 if (bSafeMode == this->bSafeMode_)
   291                 this->bSafeMode_ = bSafeMode;
   294                     this->registerObject(this->object_);
   296                     this->unregisterObject(this->object_);
   302                 { this->registerAsDestructionListener(
object); }
   308                 { this->unregisterAsDestructionListener(
object); }
   314                 { this->object_ = 
nullptr; }
   334                 return (*
this)((
void*)
nullptr, param1, param2, param3, param4, param5);
   368     template <
class F, 
class O = 
void>
   377                 { this->functionPointer_ = functionPointer; }
   380                 { 
return this->functionPointer_; }
   389         template <
class F, 
class R, 
class O, 
bool isconst, 
class... Params> 
struct FunctionType ;
   390         template <         
class R, 
class O,               
class... Params> 
struct FunctionType<void, R, O,    false, Params...> { 
typedef R (O::*
Type)(Params...); };       
   391         template <         
class R, 
class O,               
class... Params> 
struct FunctionType<void, R, O,    true,  Params...> { 
typedef R (O::*
Type)(Params...) 
const; }; 
   392         template <         
class R,                        
class... Params> 
struct FunctionType<void, R, void, false, Params...> { 
typedef R (*
Type)(Params...); };          
   393         template <
class F, 
class R,                        
class... Params> 
struct FunctionType<F,    R, void, false, Params...> { 
typedef F 
Type; };                        
   396         template <
class F, 
class R, 
class O, 
bool isconst, 
class... Params> 
struct FunctorCaller ;
   397         template <         
class R, 
class O, 
bool isconst, 
class... Params> 
struct FunctorCaller<void, R,    O,    isconst, Params...> { 
template <
class... UnusedParams> 
static inline MultiType call(
typename detail::FunctionType<void, R,    O,    isconst, Params...>::Type functionPointer, O* 
object, 
const Params&... parameters, 
const UnusedParams&...) { 
return (object->*functionPointer)(parameters...); } };                  
   398         template <                  
class O, 
bool isconst, 
class... Params> 
struct FunctorCaller<void, void, O,    isconst, Params...> { 
template <
class... UnusedParams> 
static inline MultiType call(
typename detail::FunctionType<void, void, O,    isconst, Params...>::Type functionPointer, O* 
object, 
const Params&... parameters, 
const UnusedParams&...) { (
object->*functionPointer)(parameters...); 
return MultiType::Null; } }; 
   399         template <         
class R,                        
class... Params> 
struct FunctorCaller<void, R,    void, false,   Params...> { 
template <
class... UnusedParams> 
static inline MultiType call(
typename detail::FunctionType<void, R,    void, false,   Params...>::Type functionPointer, 
void*,     
const Params&... parameters, 
const UnusedParams&...) { 
return (*functionPointer)(parameters...); } };                          
   400         template <                                         
class... Params> 
struct FunctorCaller<void, void, void, false,   Params...> { 
template <
class... UnusedParams> 
static inline MultiType call(
typename detail::FunctionType<void, void, void, false,   Params...>::Type functionPointer, 
void*,     
const Params&... parameters, 
const UnusedParams&...) { (*functionPointer)(parameters...); 
return MultiType::Null; } };         
   401         template <
class F, 
class R,                        
class... Params> 
struct FunctorCaller<F,    R,    void, false,   Params...> { 
template <
class... UnusedParams> 
static inline MultiType call(
typename detail::FunctionType<F,    R,    void, false,   Params...>::Type functor,         
void*,     
const Params&... parameters, 
const UnusedParams&...) { 
return functor(parameters...); } };                                     
   402         template <
class F,                                 
class... Params> 
struct FunctorCaller<F,    void, void, false,   Params...> { 
template <
class... UnusedParams> 
static inline MultiType call(
typename detail::FunctionType<F,    void, void, false,   Params...>::Type functor,         
void*,     
const Params&... parameters, 
const UnusedParams&...) { functor(parameters...); 
return MultiType::Null; } };                    
   406         struct FunctorHasReturnvalue
   407         { 
enum { result = 
true }; };
   409         struct FunctorHasReturnvalue<void>
   410         { 
enum { result = 
false }; };
   413         template <
int n, 
typename T = 
void, 
typename... Other>
   414         struct GetNthParamType
   415         { 
typedef typename GetNthParamType<n - 1, Other...>
::Type Type; };
   416         template <
typename T, 
typename... Other>
   417         struct GetNthParamType<0, T, Other...>
   421         template<
class... Types> 
struct type_list {};
   423         template <
class T1, 
class... AllTypes>
   424         struct make_type_list_helper
   426             template <std::size_t 
N, 
class... Types>
   427             struct make_type_list_impl : make_type_list_helper<AllTypes...>::template make_type_list_impl<N - 1, Types..., T1> {};
   429             template <
class... Types>
   430             struct make_type_list_impl<1u, Types...> : type_list<Types..., T1> {};
   434         struct make_type_list_helper<T1>
   436             template <std::size_t 
N, 
class... Types>
   437             struct make_type_list_impl : type_list<Types..., T1> {};
   440         template <std::size_t 
N, 
class... Types>
   441         struct make_type_list : make_type_list_helper<Types...>::template make_type_list_impl<N> {};
   443         template <
class... Types>
   444         struct make_type_list<0u, Types...> : type_list<> {};
   446         template <std::
size_t N>
   447         struct make_type_list<N> : type_list<> {};
   450         struct make_type_list<0u> : type_list<> {};
   470     template <
class F, 
class R, 
class O, 
bool isconst, 
class... Params>
   473         static_assert(
sizeof...(Params) <= 5, 
"Only up to 5 parameters are supported");
   477             FunctorTemplate(
typename detail::FunctionType<F, R, O, isconst, Params...>::Type functionPointer, O* 
object = 
nullptr) : 
FunctorPointer<typename detail::FunctionType<
F, R, O, isconst, Params...>::
Type, O>(functionPointer, object) {}
   482                 return detail::FunctorCaller<F, R, O, isconst, Params...>::call(this->functionPointer_, 
object, param1, param2, param3, param4, param5);
   488                 return std::make_shared<FunctorTemplate>(*this);
   496                     case 0: argument.
convert<
typename detail::GetNthParamType<0, Params...>
::Type>(); 
break;
   497                     case 1: argument.
convert<
typename detail::GetNthParamType<1, Params...>
::Type>(); 
break;
   498                     case 2: argument.
convert<
typename detail::GetNthParamType<2, Params...>
::Type>(); 
break;
   499                     case 3: argument.
convert<
typename detail::GetNthParamType<3, Params...>
::Type>(); 
break;
   500                     case 4: argument.
convert<
typename detail::GetNthParamType<4, Params...>
::Type>(); 
break;
   507                 return sizeof...(Params);
   513                 return detail::FunctorHasReturnvalue<R>::result;
   533                 return typeToString<R>();
   539                 return typeid(
typename detail::FunctionType<
void, 
R, 
O, isconst, Params...>
::Type);
   545                 return typeid(
typename detail::FunctionType<
void, 
R, 
void, 
false, Params...>
::Type);
   553                     case 0:  
return this->getTypelistIdentifier(detail::make_type_list<0, Params...>{});
   554                     case 1:  
return this->getTypelistIdentifier(detail::make_type_list<1, Params...>{});
   555                     case 2:  
return this->getTypelistIdentifier(detail::make_type_list<2, Params...>{});
   556                     case 3:  
return this->getTypelistIdentifier(detail::make_type_list<3, Params...>{});
   557                     case 4:  
return this->getTypelistIdentifier(detail::make_type_list<4, Params...>{});
   558                     default: 
return this->getTypelistIdentifier(detail::make_type_list<5, Params...>{});
   564             template<
class... Types>
   567                 return typeid(
typename detail::FunctionType<
void, 
R, 
void, 
false, Types...>
::Type);
   576         struct CallableHelper
   578             template <
class R, 
class... Params> 
static inline FunctorStaticPtr create(
const F& functionObject, 
R(
F::*)(Params...))       { 
return std::make_shared<
FunctorTemplate<
F, 
R, 
void, 
false, Params...>>(functionObject); }
   579             template <
class R, 
class... Params> 
static inline FunctorStaticPtr create(
const F& functionObject, 
R(
F::*)(Params...) 
const) { 
return std::make_shared<
FunctorTemplate<
F, 
R, 
void, 
false, Params...>>(functionObject); } 
 virtual void setRawObjectPointer(void *) override
Assigns an object-pointer to the functor which is used to execute a member-function. 
Definition: Functor.h:342
 
std::shared_ptr< Functor > FunctorPtr
Definition: FunctorPtr.h:57
 
virtual MultiType operator()(const MultiType ¶m1=MultiType::Null, const MultiType ¶m2=MultiType::Null, const MultiType ¶m3=MultiType::Null, const MultiType ¶m4=MultiType::Null, const MultiType ¶m5=MultiType::Null) override
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. 
Definition: Functor.h:332
 
The Functor classes are used to wrap function pointers. 
Definition: Functor.h:175
 
virtual Functor::Type getType() const override
Returns the type of the function: static or member. 
Definition: Functor.h:261
 
Definition: InputPrereqs.h:82
 
virtual bool hasReturnvalue() const override
Returns true if the function has a return-value. 
Definition: Functor.h:511
 
F functionPointer_
The stored function-pointer. 
Definition: Functor.h:383
 
virtual std::string getTypenameReturnvalue() const override
Returns the type-name of the return-value. 
Definition: Functor.h:531
 
Typedefs and definitions of FunctorPtr, FunctorMemberPtr, FunctorStaticPtr, and FunctorPointerPtr. 
 
virtual void * getRawObjectPointer() const override
Returns the object-pointer. 
Definition: Functor.h:345
 
virtual ~FunctorMember()
Definition: Functor.h:242
 
virtual const std::type_info & getFullIdentifier() const override
Returns the full identifier of the function-pointer which is defined as typeid(F), where F is the type of the stored function-pointer. Used to compare functors. 
Definition: Functor.h:537
 
void registerObject(void *object)
Definition: Functor.h:304
 
Shared library macros, enums, constants and forward declarations for the core library  ...
 
::std::string string
Definition: gtest-port.h:756
 
void registerObject(Destroyable *object)
Casts the object and registers as destruction listener if the object is a Destroyable. 
Definition: Functor.h:301
 
Definition: InputPrereqs.h:107
 
Output level, used for warnings which are important for developers. 
Definition: OutputDefinitions.h:96
 
O * object_
The stored object-pointer, used to execute a member-function (or nullptr for static functions) ...
Definition: Functor.h:316
 
virtual const std::type_info & getHeaderIdentifier() const override
Returns an identifier of the header of the function (doesn't include the function's class)...
Definition: Functor.h:543
 
bool bSafeMode_
If true, the functor is in safe mode and registers itself as listener at the object and changes the p...
Definition: Functor.h:317
 
virtual void setSafeMode(bool) override
Enables or disables the safe mode which causes the functor to change the object pointer to nullptr if...
Definition: Functor.h:349
 
Type
Defines the type of a function (static or member) 
Definition: Functor.h:179
 
FunctorMember is a child class of Functor and expands it with an object-pointer, that is used for mem...
Definition: Functor.h:237
 
Output level, used for error messages which are important for developers. 
Definition: OutputDefinitions.h:95
 
Definition: InputPrereqs.h:91
 
O * getObject() const 
Returns the object-pointer. 
Definition: Functor.h:275
 
void unregisterObject(Destroyable *object)
Casts the object and unregisters as destruction listener if the object is a Destroyable. 
Definition: Functor.h:307
 
bool convert()
Converts the current value to type T. 
Definition: MultiType.h:374
 
std::string typeToString()
Returns the name of type T as string. 
Definition: Functor.h:160
 
typedef void(ENET_CALLBACK *ENetPacketFreeCallback)(struct _ENetPacket *)
 
Specialization of FunctorMember with T = void. 
Definition: Functor.h:322
 
FunctorMemberPtr< O > createFunctor(R(O::*functionPointer)(Params...), OO *object)
Creates a new FunctorMember with the given function-pointer and an assigned object. 
Definition: Functor.h:583
 
FunctorMember(O *object=nullptr)
Constructor: Stores the object-pointer. 
Definition: Functor.h:241
 
virtual void setRawObjectPointer(void *object) override
Assigns an object-pointer to the functor which is used to execute a member-function. 
Definition: Functor.h:279
 
void unregisterObject(void *object)
Definition: Functor.h:310
 
virtual FunctorPtr clone() override
Creates a new instance of Functor with the same values like this (used instead of a copy-constructor)...
Definition: Functor.h:486
 
Definition: InputPrereqs.h:77
 
virtual void evaluateArgument(unsigned int index, MultiType &argument) const override
Converts a given argument to the type of the parameter with given index (the first parameter has inde...
Definition: Functor.h:492
 
OutputStream & orxout(OutputLevel level=level::debug_output, const OutputContextContainer &context=context::undefined())
This helper function returns a reference to a commonly used instance of OutputStream. 
Definition: Output.h:81
 
Die Wagnis Klasse hat die folgenden Aufgaben: 
Definition: ApplicationPaths.cc:66
 
Declaration of the MultiType and some helper constructs. 
 
#define _CoreExport
Definition: CorePrereqs.h:61
 
The MultiType can hold a value of many possible types and convert them to other types. 
Definition: MultiType.h:130
 
virtual unsigned int getParamCount() const override
Returns the number of parameters of the function. 
Definition: Functor.h:505
 
Declaration of Destroyable, the base class of all objects which can be used with StrongPtr and WeakPt...
 
This listener is used to inform weak pointers if an object of type Destroyable gets destroyed...
Definition: Destroyable.h:97
 
static const MultiType Null
Definition: MultiType.h:304
 
virtual void setSafeMode(bool bSafeMode) override
Enables or disables the safe mode which causes the functor to change the object pointer to nullptr if...
Definition: Functor.h:286
 
Defines the helper function orxout() and includes all necessary headers to use the output system...
 
Definition: InputPrereqs.h:78
 
virtual const std::type_info & getHeaderIdentifier(unsigned int params) const override
Returns an identifier of the header of the function (doesn't include the function's class)...
Definition: Functor.h:549
 
FunctorMember< void > FunctorStatic
FunctorStatic is just a typedef of FunctorMember with T = void. 
Definition: Functor.h:353
 
const std::type_info & getTypelistIdentifier(detail::type_list< Types... >) const 
Helper function that deduces a parameter pack of types and returns the corresponding identifier...
Definition: Functor.h:565
 
const unsigned int MAX_FUNCTOR_ARGUMENTS
The maximum number of parameters of a function that is supported by Functor. 
Definition: Functor.h:127
 
std::shared_ptr< FunctorMember< void >> FunctorStaticPtr
Definition: FunctorPtr.h:60
 
Type
Each Input class has a General Type variable, a form of RTTI. 
Definition: OISPrereqs.h:138
 
virtual MultiType operator()(const MultiType ¶m1=MultiType::Null, const MultiType ¶m2=MultiType::Null, const MultiType ¶m3=MultiType::Null, const MultiType ¶m4=MultiType::Null, const MultiType ¶m5=MultiType::Null) override
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. 
Definition: Functor.h:248
 
std::shared_ptr< FunctorMember< T >> FunctorMemberPtr
Definition: FunctorPtr.h:59
 
virtual Functor::Type getType() const override
Returns the type of the function: static or member. 
Definition: Functor.h:338
 
FunctorTemplate(typename detail::FunctionType< F, R, O, isconst, Params... >::Type functionPointer, O *object=nullptr)
Constructor: Initializes the base class. 
Definition: Functor.h:477
 
FunctorTemplate is a child class of FunctorPointer and implements all functions that need to know the...
Definition: Functor.h:471
 
virtual void * getRawObjectPointer() const override
Returns the object-pointer. 
Definition: Functor.h:282
 
Classes must inherit from this class if they should be used with StrongPtr or WeakPtr. 
Definition: Destroyable.h:47
 
FunctorPointer(F functionPointer, O *object=nullptr)
Constructor: Initializes the base class and stores the function-pointer. 
Definition: Functor.h:373
 
virtual void objectDeleted() override
Will be called by Destroyable::~Destroyable() if the stored object is a Destroyable and deleted and t...
Definition: Functor.h:313
 
FunctorMember(void *object=nullptr)
Constructor: Stores the object-pointer. 
Definition: Functor.h:326
 
F getFunction() const 
Returns the function-pointer. 
Definition: Functor.h:379
 
void setObject(O *object)
Assigns an object-pointer to the functor which is used to execute a member-function. 
Definition: Functor.h:265
 
void setFunction(F functionPointer)
Changes the function-pointer. 
Definition: Functor.h:376
 
FunctorPointer is a child class of FunctorMember and extends it with a function-pointer (or a functio...
Definition: Functor.h:369
 
virtual std::string getTypenameParam(unsigned int index) const override
Returns the type-name of the parameter with given index (the first parameter has index 0)...
Definition: Functor.h:517
 
virtual MultiType operator()(O *object, const MultiType ¶m1=MultiType::Null, const MultiType ¶m2=MultiType::Null, const MultiType ¶m3=MultiType::Null, const MultiType ¶m4=MultiType::Null, const MultiType ¶m5=MultiType::Null) override
Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be nullptr. 
Definition: Functor.h:480