7 #ifndef _QITYPE_DETAILS_OBJECTTYPEBUILDER_HXX_
8 #define _QITYPE_DETAILS_OBJECTTYPEBUILDER_HXX_
10 #include <boost/function_types/is_member_function_pointer.hpp>
11 #include <boost/mpl/front.hpp>
22 return (static_cast<T*>(instance)->*member)();
26 typename boost::enable_if<boost::is_base_of<Actor, T>,
AnyFunction>::type
33 typename boost::disable_if<boost::is_base_of<Actor, T>,
AnyFunction>::type
51 template <
typename FUNCTION_TYPE>
53 FUNCTION_TYPE
function,
66 template <
typename FUNCTION_TYPE>
68 FUNCTION_TYPE
function,
83 typename boost::remove_reference<U>::type>(), offset);
92 T* ptr =
reinterpret_cast<T*
>(0x10000);
94 intptr_t offset =
reinterpret_cast<intptr_t
>(pptr) - reinterpret_cast<intptr_t>(ptr);
95 qiLogDebug() <<
"Offset check T(" <<
typeid(ptr).name() <<
")= " << pptr <<
", U(" <<
typeid(ptr).name() <<
")= " << ptr <<
", T-U= " << offset;
96 return ObjectTypeBuilderBase::inherits<U>(offset);
106 typedef typename boost::function_types::parameter_types<F>::type ArgsType;
107 typedef typename boost::mpl::front<ArgsType>::type DecoratedClassType;
108 typedef typename boost::remove_reference<DecoratedClassType>::type ClassType;
109 builder.template inherits<ClassType>();
113 template <
typename T>
114 template <
typename FUNCTION_TYPE>
120 detail::checkRegisterParent<FUNCTION_TYPE>(
122 typename boost::function_types::is_member_function_pointer<FUNCTION_TYPE >::type());
128 template <
typename T>
129 template <
typename FUNCTION_TYPE>
135 detail::checkRegisterParent<FUNCTION_TYPE>(
137 typename boost::function_types::is_member_function_pointer<FUNCTION_TYPE >::type());
143 template <
typename T>
157 typename boost::enable_if<typename detail::Accessor<A>::is_accessor,
SignalBase*>::type
160 typedef typename detail::Accessor<A>::class_type class_type;
161 return &detail::Accessor<A>::access((class_type*)instance, acc);
165 typename boost::enable_if<typename detail::Accessor<A>::is_accessor, PropertyBase*>::type
168 typedef typename detail::Accessor<A>::class_type class_type;
169 return &detail::Accessor<A>::access((class_type*)instance, acc);
177 typedef typename detail::Accessor<A>::value_type::FunctionType FunctionType;
182 template <
typename A>
187 typedef typename detail::Accessor<A>::value_type::PropertyType PropertyType;
205 static const char* interfaceMarker =
"_interface_";
206 static const unsigned int interfaceMarkerLength = strlen(interfaceMarker);
220 static const unsigned value = 2;
227 static const unsigned value = 1;
231 static const unsigned value = 0;
241 std::string n = name;
242 if (n.size() > interfaceMarkerLength && n.substr(0, interfaceMarkerLength) == interfaceMarker)
243 n = name.substr(interfaceMarkerLength);
248 std::string n = name;
249 if (n.size() > interfaceMarkerLength && n.substr(0, interfaceMarkerLength) == interfaceMarker)
250 n = name.substr(interfaceMarkerLength);
255 return advertise(builder, name, accessor,
280 #endif // _QITYPE_DETAILS_OBJECTTYPEBUILDER_HXX_
unsigned int xAdvertiseProperty(const std::string &name, const qi::Signature &signature, PropertyMemberGetter getter, int id=-1)
void buildFor(bool autoRegister=true)
Declare the class type for which this StaticBuilder is.
static AnyFunction from(F func)
qi::Strand * callWithVoid(qi::Strand *(T::*member)() const, void *instance)
#define qiLogCategory(Cat)
boost::function< RF > bind(const AF &fun,...)
void inherits(int offset)
void xBuildFor(TypeInterface *type, bool autoRegister, qi::AnyFunction strandAccessor)
AnyObject object(T *ptr, boost::function< void(GenericObject *)> onDestroy=boost::function< void(GenericObject *)>())
unsigned int advertiseMethod(const std::string &name, FUNCTION_TYPE function, MetaCallType threadingModel=MetaCallType_Auto, int id=-1)
unsigned int advertiseSignal(const std::string &eventName, A accessor, int id=-1)
virtual void registerType()
Register type to typeOf<T>, to avoid both TypeImpl<T> and type() being present.
ObjectTypeBuilderBase & advertise(const std::string &name, T element)
unsigned int advertiseId(const std::string &name, T element)
AnyObject object(void *ptr, boost::function< void(GenericObject *)> onDestroy=boost::function< void(GenericObject *)>())
boost::function< SignalBase *(void *)> SignalMemberGetter
bool registerType(const std::type_info &typeId, TypeInterface *type)
Runtime Type factory setter.
void checkRegisterParent(ObjectTypeBuilder< T > &, boost::false_type)
boost::function< PropertyBase *(void *)> PropertyMemberGetter
unsigned int xAdvertiseSignal(const std::string &name, const qi::Signature &signature, SignalMemberGetter getter, int id=-1)
boost::enable_if< typename detail::Accessor< A >::is_accessor, SignalBase * >::type signalAccess(A acc, void *instance)
unsigned int advertiseMethod(const std::string &name, FUNCTION_TYPE function, MetaCallType threadingModel=MetaCallType_Auto, int id=-1)
unsigned int advertiseProperty(const std::string &propertyName, A accessor)
unsigned int advertiseBounce(ObjectTypeBuilderBase *builder, const std::string &name, A accessor, boost::true_type)
unsigned int advertise(ObjectTypeBuilderBase *builder, const std::string &name, A accessor, Dummy< 0 >)
boost::enable_if< boost::is_base_of< Actor, T >, AnyFunction >::type getStrandAccessor()
boost::enable_if< typename detail::Accessor< A >::is_accessor, PropertyBase * >::type propertyAccess(A acc, void *instance)
unsigned int xAdvertiseMethod(MetaMethodBuilder &builder, AnyFunction func, MetaCallType threadingModel=MetaCallType_Auto, int id=-1)