- Aldebaran documentation |
- C++ Libraries |
- index

libqi-api 2.8.7.4

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- Class List
- Class Hierarchy
- Class Members

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, const boost::optional< ObjectUid > &maybeUid=boost::none)
| ~GenericObject ()
const MetaObject & | metaObject ()
template<typename R , typename... Args>
R | call (const std::string &methodName, Args &&...args)
template<typename R , typename... Args>
qi::Future< R > | async (const std::string &methodName, Args &&...args)
int | findMethod (const std::string &name, const GenericFunctionParameters &parameters)
| Find method named name callable with arguments parameters. More...
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< SignalLink > | connect (const std::string &eventName, FUNCTOR_TYPE callback, MetaCallType threadingModel=MetaCallType_Direct)
qi::FutureSync< SignalLink > | connect (const std::string &name, const SignalSubscriber &functor)
qi::FutureSync< SignalLink > | connect (unsigned int signal, const SignalSubscriber &subscriber)
| Calls given functor when event is fired. Takes ownership of functor. More...
qi::FutureSync< SignalLink > | connect (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< AnyValue > | property (unsigned int id)
qi::FutureSync< void > | setProperty (unsigned int id, const AnyValue &val)
bool | isValid ()
template<typename FUNCTION_TYPE >
qi::FutureSync< SignalLink > | connect (const std::string &eventName, FUNCTION_TYPE callback, MetaCallType model)
qi::Future< AnyReference > | metaCall (const std::string &nameWithOptionalSignature, const GenericFunctionParameters &params, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature())
qi::Future< AnyReference > | metaCall (unsigned int method, const GenericFunctionParameters &params, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature())
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
ObjectTypeInterface * | type
void * | value
ObjectUid | uid
| Uid of "value". More...
Public Attributes inherited from qi::Manageable
Signal< EventTrace > | traceObject
| 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 MethodMap & | manageableMmethodMap ()
static SignalMap & | manageableSignalMap ()
static MetaObject & | manageableMetaObject ()
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)
Manageable & | operator= (const Manageable &b)

## Detailed Description

Definition at line 41 of file genericobject.hpp.

## Constructor & Destructor Documentation

qi::GenericObject::GenericObject | ( | ObjectTypeInterface * | type,
|  | void * | value,
|  | const boost::optional< ObjectUid > & | maybeUid = `boost::none`
| ) |  |

qi::GenericObject::~GenericObject | ( |  | ) |

## Member Function Documentation

template<typename R , typename... Args>

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

Calls a method of the generic object asynchronously.

Returns
  a future tracking the result of the underlying method call. If the underlying call returned a future, the future is unwrapped.

Definition at line 209 of file genericobject.hpp.

template<typename R , typename... Args>

R qi::GenericObject::call | ( | const std::string & | methodName,
|  | Args &&... | args
| ) |  |

Definition at line 195 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 168 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 138 of file genericobject.hpp.

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

Call a method dynamically, using an extensible list of arguments and specific call policies. Since the underlying call may be asynchronous, these functions always return a future, which would match the underlying future result. In other words, it is already unwrapped. Call a method by its name or signature to deduce the method ID.

Parameters

  nameWithOptionalSignature | method name or method signature 'name::(args)' if signature is given, an exact match is required.
  params | arguments to pass to the call.
  callType | type of the call.
  returnSignature | forces the return type if set.

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

Call a method dynamically, by method ID.

Parameters

  method | method ID.
  params | arguments to pass to the call.
  callType | type of the call.
  returnSignature | forces the return type if set.

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
| ) |  |

void qi::GenericObject::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()`
| ) |  |

template<typename T >

qi::FutureSync< T > qi::GenericObject::property | ( | const std::string & | name | ) |

Definition at line 222 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 239 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 139 of file genericobject.hpp.

ObjectUid qi::GenericObject::uid

Uid of "value".

Definition at line 141 of file genericobject.hpp.

void* qi::GenericObject::value

Definition at line 140 of file genericobject.hpp.

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

- /home/opennao/work/release-2.8/sdk/libqi/qi/type/detail/genericobject.hpp