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

libqi-api 2.8.7.4

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros | Functions
objecttypebuilder.hpp File Reference
`#include <qi/api.hpp>`
`#include <string>`
`#include <boost/function.hpp>`
`#include <qi/signature.hpp>`
`#include <sstream>`
`#include <qi/type/typeinterface.hpp>`
`#include <qi/type/detail/staticobjecttype.hpp>`
`#include <qi/type/detail/accessor.hxx>`
`#include <qi/type/detail/object.hxx>`
`#include <qi/property.hpp>`
`#include <qi/type/detail/objecttypebuilder.hxx>`

Go to the source code of this file.

## Classes
class | qi::SignalF< T >
class | qi::ObjectTypeBuilderBase
class | qi::ObjectTypeBuilder< T >
class | qi::TypeOfTemplate< qi::Future >
class | qi::TypeOfTemplate< qi::FutureSync >
class | qi::TypeOfTemplateFutImpl< FutT, T >
class | qi::TypeOfTemplateImpl< qi::Future, T >
class | qi::TypeOfTemplateImpl< qi::FutureSync, T >
class | qi::TypeOfTemplate< qi::Promise >
class | qi::TypeOfTemplateImpl< qi::Promise, T >
struct | qi::detail::TypeManager< Future< T > >
struct | qi::detail::TypeManager< FutureSync< T > >
struct | qi::detail::TypeManager< Promise< T > >

## Namespaces
| qi
| Deprecated in 2.5. Use int8_t from <cstdint>.
| qi::detail

## Macros
#define | _QI_TYPE_OBJECTTYPEBUILDER_HPP_
#define | QI_OBJECT_BUILDER_ADVERTISE(builder, cls, name) builder.advertise(BOOST_PP_STRINGIZE(name), &cls::name)
#define | QI_OBJECT_BUILDER_ADVERTISE_OVERLOAD(builder, cls, name, ret, args) builder.advertiseMethod(BOOST_PP_STRINGIZE(name), static_cast<ret (cls::*)args>(&cls::name))
#define | __QI_REGISTER_ELEMENT(_, name, field) b.advertise(BOOST_PP_STRINGIZE(field), & name::field);
#define | QI_REGISTER_OBJECT(name,...)
#define | QI_REGISTER_MT_OBJECT(name,...)
#define | QI_REGISTER_IMPLEMENTATION(parent, name)
#define | _QI_REGISTER_TEMPLATE_OBJECT(name, model,...)
#define | QI_TEMPLATE_OBJECT(name,...)
#define | QI_REGISTER_TEMPLATE_OBJECT(name,...) QI_TEMPLATE_OBJECT(name, __VA_ARGS__)
#define | QI_MT_TEMPLATE_OBJECT(name,...)
#define | ADVERTISE(meth) b.advertiseMethod(#meth, &FutT<T>::meth)

## Functions
| QI_TEMPLATE_TYPE_DECLARE (qi::Promise)

## Macro Definition Documentation

#define __QI_REGISTER_ELEMENT | ( |  | _,
|  |  | name,
|  |  | field
| ) |  | b.advertise(BOOST_PP_STRINGIZE(field), & name::field);

Definition at line 174 of file objecttypebuilder.hpp.

#define _QI_REGISTER_TEMPLATE_OBJECT | ( |  | name,
|  |  | model,
|  |  | ...
| ) |  |

Value:
namespace qi \
{ \
template <> \
class QI_API TypeOfTemplate<name> : public detail::StaticObjectTypeBase \
{ \
public: \
virtual TypeInterface* templateArgument() = 0; \
}; \
template <typename T> \
class TypeOfTemplateImpl<name, T> : public TypeOfTemplate<name> \
{ \
public: \
TypeOfTemplateImpl() \
{ \
/* early self registering to avoid recursive init */ \
::qi::registerType(qi::typeId<name<T>>(), this); \
ObjectTypeBuilder<name<T> > b(false); \
b.setThreadingModel(model); \
QI_VAARGS_APPLY(__QI_REGISTER_ELEMENT, name<T>, __VA_ARGS__) \
this->initialize(b.metaObject(), b.typeData()); \
} \
TypeInterface* templateArgument() override { return typeOf<T>(); } \
using Methods = DefaultTypeImplMethods<name<T>>; \
_QI_BOUNCE_TYPE_METHODS(Methods); \
}; \
} \
QI_TEMPLATE_TYPE_DECLARE(name)
qi::typeId
TypeIndex typeId()
Definition: typeinterface.hpp:33
__QI_REGISTER_ELEMENT
#define __QI_REGISTER_ELEMENT(_, name, field)
Definition: objecttypebuilder.hpp:174
QI_API
#define QI_API
Definition: api.hpp:33
qi::registerType
bool registerType(const TypeIndex &typeId, TypeInterface *type)
Runtime Type factory setter.
_QI_BOUNCE_TYPE_METHODS
#define _QI_BOUNCE_TYPE_METHODS(Bounce)
Implement all methods of Type as bouncers to Bouncer.
Definition: typeimpl.hxx:273
QI_VAARGS_APPLY
#define QI_VAARGS_APPLY(Macro, Arg,...)
Call Macro(useless, Arg, elem) for each elem (extra argument).
Definition: preproc.hpp:416
qi::log::env::QI_DEFAULT_LOGHANDLER::name
char const *const name
QI_TEMPLATE_TYPE_DECLARE
QI_TEMPLATE_TYPE_DECLARE(qi::Promise)

Definition at line 227 of file objecttypebuilder.hpp.

#define _QI_TYPE_OBJECTTYPEBUILDER_HPP_

Definition at line 8 of file objecttypebuilder.hpp.

#define ADVERTISE | ( |  | meth | ) | b.advertiseMethod(#meth, &FutT<T>::meth)

#define QI_MT_TEMPLATE_OBJECT | ( |  | name,
|  |  | ...
| ) |  |

Value:
_QI_REGISTER_TEMPLATE_OBJECT(name, ObjectThreadingModel_MultiThread, \
__VA_ARGS__)
qi::ObjectThreadingModel_MultiThread
Object is thread safe, multiple calls can occur in different threads in parallel. ...
Definition: manageable.hpp:38
_QI_REGISTER_TEMPLATE_OBJECT
#define _QI_REGISTER_TEMPLATE_OBJECT(name, model,...)
Definition: objecttypebuilder.hpp:227
qi::log::env::QI_DEFAULT_LOGHANDLER::name
char const *const name

Same as QI_TEMPLATE_OBJECT for multithread objects

Definition at line 271 of file objecttypebuilder.hpp.

#define QI_OBJECT_BUILDER_ADVERTISE | ( |  | builder,
|  |  | cls,
|  |  | name
| ) |  | builder.advertise(BOOST_PP_STRINGIZE(name), &cls::name)

Advertise a member on a builder.

Parameters

  builder | The builder on which to advertise
  cls | The class to register
  name | The name of the member

Definition at line 158 of file objecttypebuilder.hpp.

#define QI_OBJECT_BUILDER_ADVERTISE_OVERLOAD | ( |  | builder,
|  |  | cls,
|  |  | name,
|  |  | ret,
|  |  | args
| ) |  | builder.advertiseMethod(BOOST_PP_STRINGIZE(name), static_cast<ret (cls::*)args>(&cls::name))

Advertise an overloaded function on a builder.

Parameters

  builder | The builder on which to advertise
  cls | The class to register
  name | The name of the function
  ret | The return type
  args | The arguments as a tuple (ex: (const std::string&))

You must use this macro with the exact types of your method with references, pointers, cv-qualifiers (to the arguments and the method).

Definition at line 171 of file objecttypebuilder.hpp.

#define QI_REGISTER_IMPLEMENTATION | ( |  | parent,
|  |  | name
| ) |  |

Value:
static bool BOOST_PP_CAT(__qi_registration_func, __LINE__)() \
{ \
qi::detail::ForceProxyInclusion<parent>().dummyCall(); \
qi::registerType(qi::typeId<name>(), qi::typeOf<parent>()); \
name* ptr = static_cast<name*>(reinterpret_cast<void*>(0x10000)); \
parent* pptr = ptr; \
intptr_t offset = reinterpret_cast<intptr_t>(pptr) - reinterpret_cast<intptr_t>(ptr); \
if (offset) \
{ \
qiLogError("qitype.register") << "non-zero offset for implementation " << #name << " of " << #parent \
<< ", call will fail at runtime"; \
throw std::runtime_error("non-zero offset between implementation and interface"); \
} \
return true; \
} \
static bool BOOST_PP_CAT(__qi_registration, __LINE__) = BOOST_PP_CAT(__qi_registration_func, __LINE__)();
qi::registerType
bool registerType(const TypeIndex &typeId, TypeInterface *type)
Runtime Type factory setter.
qiLogError
#define qiLogError(...)
Log in error mode.
Definition: log.hpp:120
qi::log::env::QI_DEFAULT_LOGHANDLER::name
char const *const name

Register object `name` as implementation of `parent` FIXME: support inheritance with offset. This implementation just bounces to parent's TypeInterfac. If that doesn't fit your need, you can always re-register everything from the interface on your class.

Definition at line 209 of file objecttypebuilder.hpp.

#define QI_REGISTER_MT_OBJECT | ( |  | name,
|  |  | ...
| ) |  |

Value:
static bool BOOST_PP_CAT(__qi_registration, __LINE__) QI_ATTR_UNUSED = [] \
{ \
::qi::ObjectTypeBuilder<name> b; \
b.setThreadingModel(qi::ObjectThreadingModel_MultiThread); \
QI_VAARGS_APPLY(__QI_REGISTER_ELEMENT, name, __VA_ARGS__) \
b.registerType(); \
return true; \
}();
__QI_REGISTER_ELEMENT
#define __QI_REGISTER_ELEMENT(_, name, field)
Definition: objecttypebuilder.hpp:174
qi::ObjectThreadingModel_MultiThread
Object is thread safe, multiple calls can occur in different threads in parallel. ...
Definition: manageable.hpp:38
qi::ObjectTypeBuilderBase::setThreadingModel
void setThreadingModel(ObjectThreadingModel model)
QI_VAARGS_APPLY
#define QI_VAARGS_APPLY(Macro, Arg,...)
Call Macro(useless, Arg, elem) for each elem (extra argument).
Definition: preproc.hpp:416
qi::ObjectTypeBuilder
Definition: objecttypebuilder.hpp:115
qi::log::env::QI_DEFAULT_LOGHANDLER::name
char const *const name
QI_ATTR_UNUSED
#define QI_ATTR_UNUSED
This macro tags a attribute as unused.
Definition: macro.hpp:262

Definition at line 193 of file objecttypebuilder.hpp.

#define QI_REGISTER_OBJECT | ( |  | name,
|  |  | ...
| ) |  |

Value:
static bool BOOST_PP_CAT(__qi_registration, __LINE__) QI_ATTR_UNUSED = [] \
{ \
::qi::ObjectTypeBuilder<name> b; \
QI_VAARGS_APPLY(__QI_REGISTER_ELEMENT, name, __VA_ARGS__) \
b.registerType(); \
return true; \
}();
__QI_REGISTER_ELEMENT
#define __QI_REGISTER_ELEMENT(_, name, field)
Definition: objecttypebuilder.hpp:174
QI_VAARGS_APPLY
#define QI_VAARGS_APPLY(Macro, Arg,...)
Call Macro(useless, Arg, elem) for each elem (extra argument).
Definition: preproc.hpp:416
qi::ObjectTypeBuilder
Definition: objecttypebuilder.hpp:115
qi::log::env::QI_DEFAULT_LOGHANDLER::name
char const *const name
QI_ATTR_UNUSED
#define QI_ATTR_UNUSED
This macro tags a attribute as unused.
Definition: macro.hpp:262

Register an object to the typesystem

Parameters

  name | the class name, without any namespace
  ... | the names of the methods, signals and properties of the class

Warning
  must be called from an unique compilation unit (not a header), from within the namespace of the class

Definition at line 184 of file objecttypebuilder.hpp.

#define QI_REGISTER_TEMPLATE_OBJECT | ( |  | name,
|  |  | ...
| ) |  | QI_TEMPLATE_OBJECT(name, __VA_ARGS__)

Deprecated:
  since 2.3, use QI_TEMPLATE_OBJECT

Definition at line 266 of file objecttypebuilder.hpp.

#define QI_TEMPLATE_OBJECT | ( |  | name,
|  |  | ...
| ) |  |

Value:
_QI_REGISTER_TEMPLATE_OBJECT(name, ObjectThreadingModel_SingleThread, \
__VA_ARGS__)
_QI_REGISTER_TEMPLATE_OBJECT
#define _QI_REGISTER_TEMPLATE_OBJECT(name, model,...)
Definition: objecttypebuilder.hpp:227
qi::log::env::QI_DEFAULT_LOGHANDLER::name
char const *const name
qi::ObjectThreadingModel_SingleThread
Object is not thread safe, all method calls must occur in the same thread.
Definition: manageable.hpp:36

Register name as a template object type Remaining arguments are the methods, signals and properties of the object. Use QI_TEMPLATE_TYPE_GET() to access the TypeOfTemplate<T> from a Type.

Definition at line 260 of file objecttypebuilder.hpp.

## Function Documentation

QI_TEMPLATE_TYPE_DECLARE | ( | qi::Promise |  | ) |