libqi-api  release-2.5.3-2016-11-18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
qi::GenericObject Class Reference

#include <genericobject.hpp>

Public Member Functions

 GenericObject (ObjectTypeInterface *type, void *value)
 
 ~GenericObject ()
 
const MetaObjectmetaObject ()
 
template<typename R , typename... Args>
call (const std::string &methodName, Args &&...args)
 
template<typename R , typename... Args>
qi::Future< R > async (const std::string &methodName, Args &&...args)
 
qi::Future< AnyReferencemetaCall (unsigned int method, const GenericFunctionParameters &params, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature())
 
int findMethod (const std::string &name, const GenericFunctionParameters &parameters)
 
qi::Future< AnyReferencemetaCall (const std::string &nameWithOptionalSignature, const GenericFunctionParameters &params, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature())
 
void post (const std::string &eventName, qi::AutoAnyReference p1=qi::AutoAnyReference(), qi::AutoAnyReference p2=qi::AutoAnyReference(), qi::AutoAnyReference p3=qi::AutoAnyReference(), qi::AutoAnyReference p4=qi::AutoAnyReference(), qi::AutoAnyReference p5=qi::AutoAnyReference(), qi::AutoAnyReference p6=qi::AutoAnyReference(), qi::AutoAnyReference p7=qi::AutoAnyReference(), qi::AutoAnyReference p8=qi::AutoAnyReference())
 
void metaPost (unsigned int event, const GenericFunctionParameters &params)
 
void metaPost (const std::string &nameWithOptionalSignature, const GenericFunctionParameters &in)
 
template<typename FUNCTOR_TYPE >
qi::FutureSync< SignalLinkconnect (const std::string &eventName, FUNCTOR_TYPE callback, MetaCallType threadingModel=MetaCallType_Direct)
 
qi::FutureSync< SignalLinkconnect (const std::string &name, const SignalSubscriber &functor)
 
qi::FutureSync< SignalLinkconnect (unsigned int signal, const SignalSubscriber &subscriber)
 Calls given functor when event is fired. Takes ownership of functor. More...
 
qi::FutureSync< SignalLinkconnect (unsigned int signal, AnyObject target, unsigned int slot)
 
qi::FutureSync< void > disconnect (SignalLink linkId)
 Disconnect an event link. Returns if disconnection was successful. More...
 
template<typename T >
qi::FutureSync< T > property (const std::string &name)
 
template<typename T >
qi::FutureSync< void > setProperty (const std::string &name, const T &val)
 
qi::FutureSync< AnyValueproperty (unsigned int id)
 
qi::FutureSync< void > setProperty (unsigned int id, const AnyValue &val)
 
bool isValid ()
 
template<typename FUNCTION_TYPE >
qi::FutureSync< SignalLinkconnect (const std::string &eventName, FUNCTION_TYPE callback, MetaCallType model)
 
- Public Member Functions inherited from qi::Manageable
virtual ~Manageable ()
 
boost::mutex & initMutex ()
 
void forceExecutionContext (boost::shared_ptr< ExecutionContext > eventLoop)
 Override all ThreadingModel and force dispatch to given event loop. More...
 
boost::shared_ptr
< ExecutionContext
executionContext () const
 
int _nextTraceId ()
 
bool isStatsEnabled () const
 
void enableStats (bool enable)
 Set statistics gathering status. More...
 
void pushStats (int slotId, float wallTime, float userTime, float systemTime)
 Push statistics information about slotId. More...
 
ObjectStatistics stats () const
 
void clearStats ()
 Reset all statistical data. More...
 
bool isTraceEnabled () const
 
void enableTrace (bool enable)
 

Public Attributes

ObjectTypeInterfacetype
 
void * value
 
- Public Attributes inherited from qi::Manageable
Signal< EventTracetraceObject
 Emitted each time a call starts and finishes, and for each signal trigger. More...
 

Additional Inherited Members

- Public Types inherited from qi::Manageable
using MethodMap = std::map< unsigned int, std::pair< AnyFunction, MetaCallType >>
 
using SignalGetter = boost::function< SignalBase *(void *)>
 
using SignalMap = std::map< unsigned int, SignalGetter >
 
- Static Public Member Functions inherited from qi::Manageable
static MethodMapmanageableMmethodMap ()
 
static SignalMapmanageableSignalMap ()
 
static MetaObjectmanageableMetaObject ()
 
static void _build ()
 
- Static Public Attributes inherited from qi::Manageable
static const uint32_t startId = 80
 Starting id of features handled by Manageable. More...
 
static const uint32_t endId = 99
 Stop id of features handled by Manageable. More...
 
- Protected Member Functions inherited from qi::Manageable
 Manageable ()
 
 Manageable (const Manageable &b)
 
Manageableoperator= (const Manageable &b)
 

Detailed Description

Definition at line 39 of file genericobject.hpp.

Constructor & Destructor Documentation

qi::GenericObject::GenericObject ( ObjectTypeInterface type,
void *  value 
)
qi::GenericObject::~GenericObject ( )

Member Function Documentation

template<typename R , typename... Args>
qi::Future< R > qi::GenericObject::async ( const std::string &  methodName,
Args &&...  args 
)

Definition at line 174 of file genericobject.hpp.

template<typename R , typename... Args>
R qi::GenericObject::call ( const std::string &  methodName,
Args &&...  args 
)

Definition at line 163 of file genericobject.hpp.

template<typename FUNCTOR_TYPE >
qi::FutureSync<SignalLink> qi::GenericObject::connect ( const std::string &  eventName,
FUNCTOR_TYPE  callback,
MetaCallType  threadingModel = MetaCallType_Direct 
)

Connect an event to an arbitrary callback.

If you are within a service, it is recommended that you connect the event to one of your Slots instead of using this method.

qi::FutureSync<SignalLink> qi::GenericObject::connect ( const std::string &  name,
const SignalSubscriber functor 
)
qi::FutureSync<SignalLink> qi::GenericObject::connect ( unsigned int  signal,
const SignalSubscriber subscriber 
)

Calls given functor when event is fired. Takes ownership of functor.

qi::FutureSync<SignalLink> qi::GenericObject::connect ( unsigned int  signal,
AnyObject  target,
unsigned int  slot 
)

Connect an event to a method. Recommended use is when target is not a proxy. If target is a proxy and this is server-side, the event will be registered localy and the call will be forwarded. If target and this are proxies, the message will be routed through the current process.

template<typename FUNCTION_TYPE >
qi::FutureSync<SignalLink> qi::GenericObject::connect ( const std::string &  eventName,
FUNCTION_TYPE  callback,
MetaCallType  model 
)

Definition at line 136 of file genericobject.hpp.

qi::FutureSync<void> qi::GenericObject::disconnect ( SignalLink  linkId)

Disconnect an event link. Returns if disconnection was successful.

int qi::GenericObject::findMethod ( const std::string &  name,
const GenericFunctionParameters parameters 
)

Find method named name callable with arguments parameters

bool qi::GenericObject::isValid ( )
inline

Definition at line 121 of file genericobject.hpp.

qi::Future<AnyReference> qi::GenericObject::metaCall ( unsigned int  method,
const GenericFunctionParameters params,
MetaCallType  callType = MetaCallType_Auto,
Signature  returnSignature = Signature() 
)
qi::Future<AnyReference> qi::GenericObject::metaCall ( const std::string &  nameWithOptionalSignature,
const GenericFunctionParameters params,
MetaCallType  callType = MetaCallType_Auto,
Signature  returnSignature = Signature() 
)

Resolve the method Id and bounces to metaCall

Parameters
nameWithOptionalSignaturemethod name or method signature 'name::(args)' if signature is given, an exact match is required
paramsarguments to the call
callTypetype of the call
returnSignatureforce the method to return a type
const MetaObject& qi::GenericObject::metaObject ( )
void qi::GenericObject::metaPost ( unsigned int  event,
const GenericFunctionParameters params 
)
void qi::GenericObject::metaPost ( const std::string &  nameWithOptionalSignature,
const GenericFunctionParameters in 
)
template<typename T >
qi::FutureSync< T > qi::GenericObject::property ( const std::string &  name)

Definition at line 187 of file genericobject.hpp.

qi::FutureSync<AnyValue> qi::GenericObject::property ( unsigned int  id)
template<typename T >
qi::FutureSync< void > qi::GenericObject::setProperty ( const std::string &  name,
const T &  val 
)

Definition at line 200 of file genericobject.hpp.

qi::FutureSync<void> qi::GenericObject::setProperty ( unsigned int  id,
const AnyValue val 
)

Member Data Documentation

ObjectTypeInterface* qi::GenericObject::type

Definition at line 122 of file genericobject.hpp.

void* qi::GenericObject::value

Definition at line 123 of file genericobject.hpp.


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