89 return (m_contextPtr !=
nullptr);
102#define I_BEGIN_COMPONENT(ComponentType)\
103 typedef ComponentType CurrentComponentType;\
104 static const icomp::IRealComponentStaticInfo& InitStaticInfo(ComponentType* componentPtr)\
106 static icomp::TComponentStaticInfo<ComponentType> staticInfo(&BaseClass::InitStaticInfo(nullptr));\
107 static bool isStaticInitialized = false;\
108 if (isStaticInitialized && (componentPtr == nullptr)){\
111 isStaticInitialized = true;\
112 BaseClass::InitStaticInfo(componentPtr);
119#define I_BEGIN_BASE_COMPONENT(ComponentType)\
120 typedef ComponentType CurrentComponentType;\
121 static const icomp::IRealComponentStaticInfo& InitStaticInfo(ComponentType* componentPtr)\
123 static icomp::CBaseComponentStaticInfo staticInfo(&BaseClass::InitStaticInfo(nullptr));\
124 static bool isStaticInitialized = false;\
125 if (isStaticInitialized && (componentPtr == nullptr)){\
128 isStaticInitialized = true;\
129 BaseClass::InitStaticInfo(componentPtr);
136#define I_END_COMPONENT\
139 virtual const icomp::IRealComponentStaticInfo& GetComponentStaticInfo() const override\
141 return InitStaticInfo(nullptr);\
148#define I_REGISTER_INTERFACE(InterfaceType)\
150 static icomp::TInterfaceRegistrator<InterfaceType> staticRegistrator(staticInfo);\
151 Q_UNUSED(staticRegistrator);\
158#define I_REGISTER_SUBELEMENT(ElementName)\
159 static icomp::TSubelementStaticInfo<CurrentComponentType> subelementInfo_##ElementName(#ElementName, staticInfo);
168#define I_REGISTER_SUBELEMENT_INTERFACE(ElementName, InterfaceType, extractorFunction)\
170 static icomp::SubElementInterfaceRegistrator<InterfaceType, CurrentComponentType> staticRegistrator(\
171 subelementInfo_##ElementName,\
173 Q_UNUSED(staticRegistrator);\
183#define I_REGISTER_SUBELEMENT_INTERFACE_T(ElementName, InterfaceType, extractorFunction)\
185 static icomp::SubElementInterfaceRegistrator<InterfaceType, CurrentComponentType> staticRegistrator(\
186 subelementInfo_##ElementName,\
187 extractorFunction<InterfaceType>);\
188 Q_UNUSED(staticRegistrator);\
194#define I_USER_ATTR(attrType, member)\
195 typedef icomp::TAttributeMember< attrType > member##_Type;\
196 typedef icomp::TAttributeMember< attrType >::AttributeType member##_AttrType;\
197 icomp::TAttributeMember< attrType > member
209#define I_ATTR(attrType, member)\
210 I_USER_ATTR(iattr::TAttribute< attrType >, member)
217#define I_TEXTATTR(member)\
218 typedef icomp::CTextAttributeMember member##_Type;\
219 typedef icomp::CTextAttributeMember::AttributeType member##_AttrType;\
220 icomp::CTextAttributeMember member
225#define I_USER_MULTIATTR(attrType, member)\
226 typedef icomp::TMultiAttributeMember< attrType > member##_Type;\
227 typedef icomp::TMultiAttributeMember< attrType >::AttributeType member##_AttrType;\
228 icomp::TMultiAttributeMember< attrType > member
240#define I_MULTIATTR(attrType, member)\
241 I_USER_MULTIATTR(iattr::TMultiAttribute< attrType >, member)
248#define I_MULTITEXTATTR(member)\
249 typedef icomp::CMultiTextAttributeMember member##_Type;\
250 typedef icomp::CMultiTextAttributeMember::AttributeType member##_AttrType;\
251 icomp::CMultiTextAttributeMember member
258#define I_REF(interfaceType, member)\
259 typedef icomp::TReferenceMember<interfaceType> member##_Type;\
260 typedef icomp::TReferenceMember<interfaceType>::AttributeType member##_AttrType;\
261 icomp::TReferenceMember<interfaceType> member
266#define I_TREF(interfaceType, member)\
267 typedef icomp::TReferenceMember<interfaceType> member##_Type;\
268 typedef typename icomp::TReferenceMember<interfaceType>::AttributeType member##_AttrType;\
269 icomp::TReferenceMember<interfaceType> member
274#define I_TMULTIREF(interfaceType, member)\
275 typedef icomp::TMultiReferenceMember<interfaceType> member##_Type;\
276 typedef typename icomp::TMultiReferenceMember<interfaceType>::AttributeType member##_AttrType;\
277 icomp::TMultiReferenceMember<interfaceType> member
285#define I_MULTIREF(interfaceType, member)\
286 typedef icomp::TMultiReferenceMember<interfaceType> member##_Type;\
287 typedef icomp::TMultiReferenceMember<interfaceType>::AttributeType member##_AttrType;\
288 icomp::TMultiReferenceMember<interfaceType> member
295#define I_FACT(interfaceType, member)\
296 typedef icomp::TFactoryMember<interfaceType> member##_Type;\
297 typedef icomp::TFactoryMember<interfaceType>::AttributeType member##_AttrType;\
298 icomp::TFactoryMember<interfaceType> member;
300#define I_TFACT(interfaceType, member)\
301 typedef icomp::TFactoryMember<interfaceType> member##_Type;\
302 typedef typename icomp::TFactoryMember<interfaceType>::AttributeType member##_AttrType;\
303 icomp::TFactoryMember<interfaceType> member
309#define I_MULTIFACT(interfaceType, member)\
310 typedef icomp::TMultiFactoryMember<interfaceType> member##_Type;\
311 typedef icomp::TMultiFactoryMember<interfaceType>::AttributeType member##_AttrType;\
312 icomp::TMultiFactoryMember<interfaceType> member
317#define I_ASSIGN_BASE(member, id, description, isObligatory)\
318 static icomp::TAttributeStaticInfo<member##_AttrType> member##_Info(staticInfo, id, description, &member##_Default, isObligatory? member##_AttrType::DAF_OBLIGATORY: member##_AttrType::DAF_OPTIONAL, istd::CClassInfo::GetInfo<typename member##_Type::InterfaceType>());\
319 if (componentPtr != nullptr){\
320 componentPtr->member.Init(componentPtr, member##_Info);\
327#define I_ASSIGN(member, id, description, isObligatory, defaultValue)\
328 static member##_AttrType member##_Default(defaultValue);\
329 I_ASSIGN_BASE(member, id, description, isObligatory)
334#define I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)\
335 static member##_AttrType member##_Default(int(sizeof(member##_DefaultElements) / sizeof(member##_AttrType::ValueType)), member##_DefaultElements);\
336 I_ASSIGN_BASE(member, id, description, isObligatory)
342#define I_ASSIGN_MULTI_0(member, id, description, isObligatory)\
343 static member##_AttrType member##_Default(0, nullptr);\
344 I_ASSIGN_BASE(member, id, description, isObligatory)
350#define I_ASSIGN_MULTI_1(member, id, description, isObligatory, defaultValue1)\
351 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1};\
352 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
357#define I_ASSIGN_MULTI_2(member, id, description, isObligatory, defaultValue1, defaultValue2)\
358 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2};\
359 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
364#define I_ASSIGN_MULTI_3(member, id, description, isObligatory, defaultValue1, defaultValue2, defaultValue3)\
365 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2, defaultValue3};\
366 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
371#define I_ASSIGN_MULTI_4(member, id, description, isObligatory, defaultValue1, defaultValue2, defaultValue3, defaultValue4)\
372 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2, defaultValue3, defaultValue4};\
373 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
378#define I_ASSIGN_MULTI_5(member, id, description, isObligatory, defaultValue1, defaultValue2, defaultValue3, defaultValue4, defaultValue5)\
379 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2, defaultValue3, defaultValue4, defaultValue5};\
380 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
386#define I_TASSIGN_BASE(member, id, description, isObligatory)\
387 static icomp::TAttributeStaticInfo<member##_AttrType> member##_Info(staticInfo, id, description, &member##_Default, isObligatory? member##_AttrType::DAF_OBLIGATORY: member##_AttrType::DAF_OPTIONAL, istd::CClassInfo::GetInfo<typename member##_Type::InterfaceType>());\
388 if (componentPtr != nullptr){\
389 componentPtr->member.Init(componentPtr, member##_Info);\
395#define I_TASSIGN(member, id, description, isObligatory, defaultValue)\
396 static member##_AttrType member##_Default(defaultValue);\
397 I_TASSIGN_BASE(member, id, description, isObligatory)
402#define I_TASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)\
403 static member##_AttrType member##_Default(int(sizeof(member##_DefaultElements) / sizeof(member##_AttrType::ValueType)), member##_DefaultElements);\
404 I_TASSIGN_BASE(member, id, description, isObligatory)
409#define I_TASSIGN_MULTI_0(member, id, description, isObligatory)\
410 static member##_AttrType member##_Default(0, nullptr);\
411 I_TASSIGN_BASE(member, id, description, isObligatory)
416#define I_TASSIGN_MULTI_1(member, id, description, isObligatory, defaultValue1)\
417 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1};\
418 I_TASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
423#define I_TASSIGN_MULTI_2(member, id, description, isObligatory, defaultValue1, defaultValue2)\
424 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2};\
425 I_TASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
430#define I_TASSIGN_MULTI_3(member, id, description, isObligatory, defaultValue1, defaultValue2, defaultValue3)\
431 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2, defaultValue3};\
432 I_TASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
438#define I_ASSIGN_TO(member, baseAttribute, isObligatory)\
439 static icomp::CRelatedInfoRegistrator member##_Info(baseAttribute##_Info, icomp::IElementStaticInfo::MetaGroupId::Interfaces, istd::CClassInfo::GetInfo<member##_Type::InterfaceType>().GetName(), isObligatory? member##_AttrType::DAF_OBLIGATORY: member##_AttrType::DAF_OPTIONAL);\
440 Q_UNUSED(member##_Info);\
441 if (componentPtr != nullptr){\
442 componentPtr->member.Init(componentPtr, baseAttribute##_Info);\
448#define I_TASSIGN_TO(member, baseAttribute, isObligatory)\
449 static icomp::CRelatedInfoRegistrator member##_Info(baseAttribute##_Info, icomp::IElementStaticInfo::MetaGroupId::Interfaces, istd::CClassInfo::GetInfo<typename member##_Type::InterfaceType>().GetName(), isObligatory? member##_AttrType::DAF_OBLIGATORY: member##_AttrType::DAF_OPTIONAL);\
450 Q_UNUSED(member##_Info);\
451 if (componentPtr != nullptr){\
452 componentPtr->member.Init(componentPtr, baseAttribute##_Info);\
465 if (Dest* retVal = (Dest*)parentComponentPtr->GetInterface(
istd::CClassInfo(
typeid(Dest)))) {
471 return dynamic_cast<Dest*
>(objectPtr);
481inline const Dest*
CompCastPtr(
const istd::IPolymorphic* objectPtr)
485 if (
const Dest* retVal = (
const Dest*)parentComponentPtr->GetInterface(
istd::CClassInfo(
typeid(Dest)))) {
491 return dynamic_cast<const Dest*
>(objectPtr);
Dest * CompCastPtr(istd::IPolymorphic *objectPtr)
Cast to specified interface trying to use component interface query.
Base class for component implementation.
virtual void OnComponentDestroyed()
virtual const ICompositeComponent * GetParentComponent(bool ownerOnly=false) const
Get parent of this component.
static QByteArray GetComponentId(const IComponentContext *componentContextPtr, const QByteArray &contextId=QByteArray())
bool IsComponentActive() const
Check if component is active.
CComponentBase(const CComponentBase &)=delete
virtual void OnComponentCreated()
CComponentBase()
Create component and assign it to specific context.
CComponentBase & operator=(const CComponentBase &)=delete
virtual void SetComponentContext(const IComponentContext *contextPtr, const ICompositeComponent *parentPtr, bool isParentOwner)
Set component context of this component.
static const IRealComponentStaticInfo & InitStaticInfo(IComponent *componentPtr)
virtual void * GetInterface(const istd::CClassInfo &interfaceType, const QByteArray &subId="")
Get access to specified component interface.
virtual const IComponentContext * GetComponentContext() const
Get access to component context describing all application-specified component information loaded fro...
virtual const IRealComponentStaticInfo & GetComponentStaticInfo() const =0
Get access to static info of this component.
Provide session context of component.
Main component interface.
Composite component interface.
Interface adding to component static info functionality existing only for real components.
Represents platform independent type info and provide set of static class manipulation functions.
Package with interfaces and class used for components concept.