Orxonox  0.0.5 Codename: Arcturus
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
orxonox::FunctorMember< O > Class Template Referenceabstract

FunctorMember is a child class of Functor and expands it with an object-pointer, that is used for member-functions, as well as an overloaded execution operator. More...

#include </home/jenkins/workspace/orxonox_doxygen_trunk/src/libraries/core/command/Functor.h>

Inheritance diagram for orxonox::FunctorMember< O >:
orxonox::Functor orxonox::DestructionListener orxonox::FunctorPointer< detail::FunctionType< F, R, O, isconst, Params... >::Type, O > orxonox::FunctorPointer< F, O > orxonox::FunctorTemplate< F, R, O, isconst, Params >

Public Member Functions

 FunctorMember (O *object=nullptr)
 Constructor: Stores the object-pointer. More...
 
virtual ~FunctorMember ()
 
O * getObject () const
 Returns the object-pointer. More...
 
virtual voidgetRawObjectPointer () const override
 Returns the object-pointer. More...
 
virtual Functor::Type getType () const override
 Returns the type of the function: static or member. More...
 
virtual MultiType operator() (O *object, const MultiType &param1=MultiType::Null, const MultiType &param2=MultiType::Null, const MultiType &param3=MultiType::Null, const MultiType &param4=MultiType::Null, const MultiType &param5=MultiType::Null)=0
 Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be nullptr. More...
 
virtual MultiType operator() (const MultiType &param1=MultiType::Null, const MultiType &param2=MultiType::Null, const MultiType &param3=MultiType::Null, const MultiType &param4=MultiType::Null, const MultiType &param5=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. More...
 
void setObject (O *object)
 Assigns an object-pointer to the functor which is used to execute a member-function. More...
 
virtual void setRawObjectPointer (void *object) override
 Assigns an object-pointer to the functor which is used to execute a member-function. More...
 
virtual void setSafeMode (bool bSafeMode) override
 Enables or disables the safe mode which causes the functor to change the object pointer to nullptr if the object is deleted (only member functors). More...
 
- Public Member Functions inherited from orxonox::Functor
virtual ~Functor ()=default
 
virtual FunctorPtr clone ()=0
 Creates a new instance of Functor with the same values like this (used instead of a copy-constructor) More...
 
virtual void evaluateArgument (unsigned int index, MultiType &argument) const =0
 Converts a given argument to the type of the parameter with given index (the first parameter has index 0). More...
 
virtual const std::type_info & getFullIdentifier () const =0
 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. More...
 
virtual const std::type_info & getHeaderIdentifier () const =0
 Returns an identifier of the header of the function (doesn't include the function's class). Used to compare functors. More...
 
virtual const std::type_info & getHeaderIdentifier (unsigned int params) const =0
 Returns an identifier of the header of the function (doesn't include the function's class), but regards only the first params parameters. Used to compare functions if an Executor provides default-values for the other parameters. More...
 
virtual unsigned int getParamCount () const =0
 Returns the number of parameters of the function. More...
 
virtual std::string getTypenameParam (unsigned int index) const =0
 Returns the type-name of the parameter with given index (the first parameter has index 0). More...
 
virtual std::string getTypenameReturnvalue () const =0
 Returns the type-name of the return-value. More...
 
virtual bool hasReturnvalue () const =0
 Returns true if the function has a return-value. More...
 

Protected Member Functions

virtual void objectDeleted () override
 Will be called by Destroyable::~Destroyable() if the stored object is a Destroyable and deleted and the Functor is in safe mode. More...
 
void registerObject (Destroyable *object)
 Casts the object and registers as destruction listener if the object is a Destroyable. More...
 
void registerObject (void *object)
 
void unregisterObject (Destroyable *object)
 Casts the object and unregisters as destruction listener if the object is a Destroyable. More...
 
void unregisterObject (void *object)
 
- Protected Member Functions inherited from orxonox::DestructionListener
virtual ~DestructionListener ()
 
void registerAsDestructionListener (Destroyable *object)
 
void unregisterAsDestructionListener (Destroyable *object)
 

Protected Attributes

bool bSafeMode_
 If true, the functor is in safe mode and registers itself as listener at the object and changes the pointer to nullptr if the object is deleted. More...
 
O * object_
 The stored object-pointer, used to execute a member-function (or nullptr for static functions) More...
 

Additional Inherited Members

- Public Types inherited from orxonox::Functor
enum  Type { Type::Static, Type::Member }
 Defines the type of a function (static or member) More...
 

Detailed Description

template<class O>
class orxonox::FunctorMember< O >

FunctorMember is a child class of Functor and expands it with an object-pointer, that is used for member-functions, as well as an overloaded execution operator.

Parameters
OThe type of the function's class (or void if it's a static function)

Note that FunctorMember is also used for static functions, but with T = void. FunctorStatic is a typedef of FunctorMember<void>. The void* object-pointer is ignored in this case.

See also
See Functor.h for some examples.

Constructor & Destructor Documentation

template<class O >
orxonox::FunctorMember< O >::FunctorMember ( O *  object = nullptr)
inline

Constructor: Stores the object-pointer.

template<class O >
virtual orxonox::FunctorMember< O >::~FunctorMember ( )
inlinevirtual

Member Function Documentation

template<class O >
O* orxonox::FunctorMember< O >::getObject ( ) const
inline

Returns the object-pointer.

template<class O >
virtual void* orxonox::FunctorMember< O >::getRawObjectPointer ( ) const
inlineoverridevirtual

Returns the object-pointer.

Implements orxonox::Functor.

template<class O >
virtual Functor::Type orxonox::FunctorMember< O >::getType ( ) const
inlineoverridevirtual

Returns the type of the function: static or member.

Implements orxonox::Functor.

template<class O >
virtual void orxonox::FunctorMember< O >::objectDeleted ( )
inlineoverrideprotectedvirtual

Will be called by Destroyable::~Destroyable() if the stored object is a Destroyable and deleted and the Functor is in safe mode.

Implements orxonox::DestructionListener.

template<class O >
virtual MultiType orxonox::FunctorMember< O >::operator() ( O *  object,
const MultiType param1 = MultiType::Null,
const MultiType param2 = MultiType::Null,
const MultiType param3 = MultiType::Null,
const MultiType param4 = MultiType::Null,
const MultiType param5 = MultiType::Null 
)
pure virtual

Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be nullptr.

Returns
Returns the return-value of the function (if any; MultiType::Null otherwise)

Implemented in orxonox::FunctorTemplate< F, R, O, isconst, Params >.

template<class O >
virtual MultiType orxonox::FunctorMember< O >::operator() ( const MultiType param1 = MultiType::Null,
const MultiType param2 = MultiType::Null,
const MultiType param3 = MultiType::Null,
const MultiType param4 = MultiType::Null,
const MultiType param5 = MultiType::Null 
)
inlineoverridevirtual

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.

Returns
Returns the return-value of the function (if any; MultiType::Null otherwise)

Implements orxonox::Functor.

template<class O >
void orxonox::FunctorMember< O >::registerObject ( Destroyable object)
inlineprotected

Casts the object and registers as destruction listener if the object is a Destroyable.

template<class O >
void orxonox::FunctorMember< O >::registerObject ( void object)
inlineprotected
template<class O >
void orxonox::FunctorMember< O >::setObject ( O *  object)
inline

Assigns an object-pointer to the functor which is used to execute a member-function.

template<class O >
virtual void orxonox::FunctorMember< O >::setRawObjectPointer ( void object)
inlineoverridevirtual

Assigns an object-pointer to the functor which is used to execute a member-function.

Implements orxonox::Functor.

template<class O >
virtual void orxonox::FunctorMember< O >::setSafeMode ( bool  bSafeMode)
inlineoverridevirtual

Enables or disables the safe mode which causes the functor to change the object pointer to nullptr if the object is deleted (only member functors).

Implements orxonox::Functor.

template<class O >
void orxonox::FunctorMember< O >::unregisterObject ( Destroyable object)
inlineprotected

Casts the object and unregisters as destruction listener if the object is a Destroyable.

template<class O >
void orxonox::FunctorMember< O >::unregisterObject ( void object)
inlineprotected

Member Data Documentation

template<class O >
bool orxonox::FunctorMember< O >::bSafeMode_
protected

If true, the functor is in safe mode and registers itself as listener at the object and changes the pointer to nullptr if the object is deleted.

template<class O >
O* orxonox::FunctorMember< O >::object_
protected

The stored object-pointer, used to execute a member-function (or nullptr for static functions)


The documentation for this class was generated from the following file: