7 #ifndef _QITYPE_DETAIL_PROXY_REGISTER_HPP_
8 #define _QITYPE_DETAIL_PROXY_REGISTER_HPP_
36 template<
class InterfaceType,
class ProxyType>
43 using ToProxy = boost::function<Proxy*(void*)>;
81 const std::vector<std::pair<TypeInterface*, std::ptrdiff_t> >&
parentTypes()
override
83 using ReturnType =
typename std::decay<decltype(parentTypes())>::type;
84 static ReturnType* parents =
nullptr;
86 static const auto init = []{
return new ReturnType{
87 { qi::typeOf<InterfaceType>(), []{
88 ProxyType* ptr =
static_cast<ProxyType*
>(
reinterpret_cast<void*
>(0x10000));
89 InterfaceType* pptr = ptr;
90 std::ptrdiff_t offset =
reinterpret_cast<intptr_t
>(pptr)-reinterpret_cast<intptr_t>(ptr);
123 return static_cast<Proxy*
>((ProxyImpl*)storage);
126 template<
class InterfaceType,
typename ProxyImpl>
135 template<
typename ProxyImpl>
138 boost::shared_ptr<ProxyImpl> sp(
new ProxyImpl(ptr));
149 template<
typename Proxy,
typename Interface>
155 registerType(qi::typeId<Proxy>(), detail::makeProxyInterface<Interface, Proxy>());
157 map[typeOf<Interface>()->
info()] = boost::function<AnyReference(AnyObject)>(&detail::makeProxy<Proxy>);
163 #define QI_REGISTER_PROXY(Proxy) \
165 static bool BOOST_PP_CAT(_qi_register_proxy_, Proxy) QI_ATTR_UNUSED = \
166 ::qi::registerProxy<Proxy>(); \
169 #define QI_REGISTER_PROXY_INTERFACE(Proxy, Interface) \
171 static bool BOOST_PP_CAT(_qi_register_proxy_, Proxy) QI_ATTR_UNUSED = \
172 ::qi::registerProxyInterface<Proxy, Interface>(); \
GenericObject * asGenericObject() const
_QI_BOUNCE_TYPE_METHODS(Methods)
qi::FutureSync< void > disconnect(SignalLink linkId) const
qi::Future< AnyValue > property(void *instance, AnyObject context, unsigned int id) override
bool registerProxyInterface()
bool registerType(const TypeIndex &typeId, TypeInterface *type)
Runtime Type factory setter.
qi::Future< void > disconnect(void *instance, AnyObject context, SignalLink linkId) override
Disconnect an event link. Returns if disconnection was successful.
const MetaObject & metaObject(void *instance) override
boost::function< Proxy *(void *)> ToProxy
#define qiLogVerbose(...)
Log in verbose mode. This level is not shown by default.
qi::Future< void > setProperty(void *instance, AnyObject context, unsigned int id, AnyValue value) override
qi::FutureSync< SignalLink > connect(const std::string &eventName, FUNCTOR_TYPE callback, MetaCallType threadingModel=MetaCallType_Auto) const
virtual qi::Future< void > setProperty(void *instance, AnyObject context, unsigned int id, AnyValue value)=0
virtual qi::Future< AnyValue > property(void *instance, AnyObject context, unsigned int id)=0
void metaPost(void *instance, AnyObject context, unsigned int signal, const GenericFunctionParameters ¶ms) override
const std::vector< std::pair< TypeInterface *, std::ptrdiff_t > > & parentTypes() override
qi::Future< SignalLink > connect(void *instance, AnyObject context, unsigned int event, const SignalSubscriber &subscriber) override
TypeProxy< InterfaceType, ProxyImpl > * makeProxyInterface()
ProxyGeneratorMap & proxyGeneratorMap()
Object< Empty > asObject() const
std::map< TypeInfo, boost::function< AnyReference(AnyObject)>> ProxyGeneratorMap
const MetaObject & metaObject() const
void metaPost(unsigned int event, const GenericFunctionParameters ¶ms) const
ObjectTypeInterface * type
#define QI_ONCE(code)
Execute code once, parallel calls are blocked until code finishes.
const char * infoString()
virtual const TypeInfo & info()=0
Get the TypeInfo corresponding to this type.
AnyReference makeProxy(AnyObject ptr)
ObjectUid uid(void *instance) const override
Object< Empty > AnyObject
#define QI_ASSERT_TRUE(expr__)
AnyReference clone() const
qi::Future< AnyReference > metaCall(unsigned int method, const GenericFunctionParameters ¶ms, MetaCallType callType=MetaCallType_Auto, Signature returnSignature=Signature()) const
qi::Future< AnyReference > metaCall(void *instance, AnyObject context, unsigned int method, const GenericFunctionParameters ¶ms, MetaCallType callType, Signature returnSignature) override
static AnyReference from(const T &ref)
Proxy * static_proxy_cast(void *storage)
TypeProxy(ToProxy toProxy)
void init(qi::LogLevel verb=qi::LogLevel_Info, qi::LogContext context=qi::LogContextAttr_ShortVerbosity|qi::LogContextAttr_Tid|qi::LogContextAttr_Category, bool synchronous=true)
Initialization of the logging system Creates and registers the default log handler according to QI_DE...
int context()
Get log context.