TrueReality  v0.1.1912
trManager::Invokable Class Reference

An Invokable is a queriable method interface that can be added to a trManager::ActorBase Invoking the invokable requires a trManager::MessageBase as a parameter. More...

#include <Invokable.h>

Inheritance diagram for trManager::Invokable:
Collaboration diagram for trManager::Invokable:

Public Types

using InvokableFunc = trUtil::Functor< void, TYPELIST_1(const trManager::MessageBase &)>
 
- Public Types inherited from trBase::SmrtClass
using BaseClass = osg::Referenced
 

Public Member Functions

virtual const std::string & GetType () const override
 Holds the class type name for efficient comparisons. More...
 
template<typename Message_T >
 Invokable (const std::string &name, trUtil::Functor< void, TYPELIST_1(const Message_T &)> toInvoke)
 
 Invokable (const Invokable &)=delete
 Deleted copy constructor. More...
 
const std::string & GetName () const
 
void Invoke (const trManager::MessageBase &message)
 Invoke this. More...
 
- Public Member Functions inherited from trBase::SmrtClass
 SmrtClass ()
 Adds an easy and swappable access to the base class. More...
 
 SmrtClass (bool threadSafeRefUnref)
 Constructor. More...
 
 SmrtClass (const SmrtClass &inst)
 Copy constructor. More...
 
virtual bool GetThreadSafeRefUnref ()
 Get whether a mutex is used to ensure Ref() and UnRef() are thread safe. More...
 
OpenThreads::Mutex * GetRefMutex () const
 Get the mutex used to ensure thread safety of Ref()/UnRef(). More...
 
int Ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
int Unref () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int UnRefNoDelete () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int ReferenceCount () const
 Return the number of pointers currently referencing this object. More...
 

Static Public Attributes

static const trUtil::RefStr CLASS_TYPE = trUtil::RefStr("trManager::Invokable")
 

Protected Member Functions

virtual ~Invokable ()
 referenced classes should always have protected destructor More...
 
- Protected Member Functions inherited from trBase::SmrtClass
 ~SmrtClass ()
 

Private Member Functions

Invokableoperator= (const Invokable &)
 

Private Attributes

std::string mName
 
trBase::SmrtPtr< InvokableFunctorCallerBasemCaller
 

Additional Inherited Members

- Static Public Member Functions inherited from trBase::SmrtClass
static OpenThreads::Mutex * GetGlobalReferencedMutex ()
 Get the optional global Referenced mutex, this can be shared between all trBase::SmrtClass. More...
 

Detailed Description

An Invokable is a queriable method interface that can be added to a trManager::ActorBase Invoking the invokable requires a trManager::MessageBase as a parameter.

The actual code is executed by calling a Functor that takes 1 parameter, the message, and returns nothing. The method must take a const Method reference.

See also
trManager::MessageBase

Definition at line 84 of file Invokable.h.

Member Typedef Documentation

◆ InvokableFunc

Constructor & Destructor Documentation

◆ Invokable() [1/2]

template<typename Message_T >
trManager::Invokable::Invokable ( const std::string &  name,
trUtil::Functor< void, TYPELIST_1(const Message_T &)>  toInvoke 
)
inline

Definition at line 102 of file Invokable.h.

◆ Invokable() [2/2]

trManager::Invokable::Invokable ( const Invokable )
delete

Deleted copy constructor.

◆ ~Invokable()

trManager::Invokable::~Invokable ( )
protectedvirtual

referenced classes should always have protected destructor

Definition at line 37 of file Invokable.cpp.

Member Function Documentation

◆ GetName()

const std::string& trManager::Invokable::GetName ( ) const
inline
Returns
the name of this invokable.

Definition at line 118 of file Invokable.h.

Referenced by trManager::EntityBase::AddInvokable(), trManager::SystemManager::CallInvokable(), and trManager::EntityBase::RemoveInvokable().

Here is the caller graph for this function:

◆ GetType()

const std::string & trManager::Invokable::GetType ( ) const
inlineoverridevirtual

Holds the class type name for efficient comparisons.

Gets the type.

Returns
The type.

Implements trBase::SmrtClass.

Definition at line 97 of file Invokable.h.

◆ Invoke()

void trManager::Invokable::Invoke ( const trManager::MessageBase message)

Invoke this.

Parameters
messagethe message to invoke.

Definition at line 42 of file Invokable.cpp.

References mCaller.

Referenced by trManager::SystemManager::CallInvokable(), and trManager::SystemManager::SendGlobalyRegisteredMessage().

Here is the caller graph for this function:

◆ operator=()

Invokable& trManager::Invokable::operator= ( const Invokable )
inlineprivate

Definition at line 133 of file Invokable.h.

Member Data Documentation

◆ CLASS_TYPE

const trUtil::RefStr trManager::Invokable::CLASS_TYPE = trUtil::RefStr("trManager::Invokable")
static

Definition at line 88 of file Invokable.h.

◆ mCaller

trBase::SmrtPtr<InvokableFunctorCallerBase> trManager::Invokable::mCaller
private

Definition at line 131 of file Invokable.h.

Referenced by Invoke().

◆ mName

std::string trManager::Invokable::mName
private

Definition at line 129 of file Invokable.h.


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