52 bool isParentOwner)
override;
88 return (m_contextPtr !=
nullptr);
103#define I_BEGIN_COMPONENT(ComponentType)\
104 typedef ComponentType CurrentComponentType;\
105 static const icomp::IRealComponentStaticInfo& InitStaticInfo(ComponentType* componentPtr)\
107 static icomp::TComponentStaticInfo<ComponentType> staticInfo(&BaseClass::InitStaticInfo(nullptr));\
108 static bool isStaticInitialized = false;\
109 if (isStaticInitialized && (componentPtr == nullptr)){\
112 isStaticInitialized = true;\
113 BaseClass::InitStaticInfo(componentPtr);
121#define I_BEGIN_BASE_COMPONENT(ComponentType)\
122 typedef ComponentType CurrentComponentType;\
123 static const icomp::IRealComponentStaticInfo& InitStaticInfo(ComponentType* componentPtr)\
125 static icomp::CBaseComponentStaticInfo staticInfo(&BaseClass::InitStaticInfo(nullptr));\
126 static bool isStaticInitialized = false;\
127 if (isStaticInitialized && (componentPtr == nullptr)){\
130 isStaticInitialized = true;\
131 BaseClass::InitStaticInfo(componentPtr);
140#define I_END_COMPONENT\
143 virtual const icomp::IRealComponentStaticInfo& GetComponentStaticInfo() const override\
145 return InitStaticInfo(nullptr);\
154#define I_REGISTER_INTERFACE(InterfaceType)\
156 static icomp::TInterfaceRegistrator<InterfaceType> staticRegistrator(staticInfo);\
157 Q_UNUSED(staticRegistrator);\
163#define I_REGISTER_SUBELEMENT(ElementName)\
164 static icomp::TSubelementStaticInfo<CurrentComponentType> subelementInfo_##ElementName(#ElementName, staticInfo);
172#define I_REGISTER_SUBELEMENT_INTERFACE(ElementName, InterfaceType, extractorFunction)\
174 static icomp::SubElementInterfaceRegistrator<InterfaceType, CurrentComponentType> staticRegistrator(\
175 subelementInfo_##ElementName,\
177 Q_UNUSED(staticRegistrator);\
186#define I_REGISTER_SUBELEMENT_INTERFACE_T(ElementName, InterfaceType, extractorFunction)\
188 static icomp::SubElementInterfaceRegistrator<InterfaceType, CurrentComponentType> staticRegistrator(\
189 subelementInfo_##ElementName,\
190 extractorFunction<InterfaceType>);\
191 Q_UNUSED(staticRegistrator);\
198#define I_USER_ATTR(attrType, member)\
199 typedef icomp::TAttributeMember< attrType > member##_Type;\
200 typedef icomp::TAttributeMember< attrType >::AttributeType member##_AttrType;\
201 icomp::TAttributeMember< attrType > member
214#define I_ATTR(attrType, member)\
215 I_USER_ATTR(iattr::TAttribute< attrType >, member)
223#define I_TEXTATTR(member)\
224 typedef icomp::CTextAttributeMember member##_Type;\
225 typedef icomp::CTextAttributeMember::AttributeType member##_AttrType;\
226 icomp::CTextAttributeMember member
232#define I_USER_MULTIATTR(attrType, member)\
233 typedef icomp::TMultiAttributeMember< attrType > member##_Type;\
234 typedef icomp::TMultiAttributeMember< attrType >::AttributeType member##_AttrType;\
235 icomp::TMultiAttributeMember< attrType > member
247#define I_MULTIATTR(attrType, member)\
248 I_USER_MULTIATTR(iattr::TMultiAttribute< attrType >, member)
255#define I_MULTITEXTATTR(member)\
256 typedef icomp::CMultiTextAttributeMember member##_Type;\
257 typedef icomp::CMultiTextAttributeMember::AttributeType member##_AttrType;\
258 icomp::CMultiTextAttributeMember member
266#define I_REF(interfaceType, member)\
267 typedef icomp::TReferenceMember<interfaceType> member##_Type;\
268 typedef icomp::TReferenceMember<interfaceType>::AttributeType member##_AttrType;\
269 icomp::TReferenceMember<interfaceType> member
276#define I_TREF(interfaceType, member)\
277 typedef icomp::TReferenceMember<interfaceType> member##_Type;\
278 typedef typename icomp::TReferenceMember<interfaceType>::AttributeType member##_AttrType;\
279 icomp::TReferenceMember<interfaceType> member
286#define I_TMULTIREF(interfaceType, member)\
287 typedef icomp::TMultiReferenceMember<interfaceType> member##_Type;\
288 typedef typename icomp::TMultiReferenceMember<interfaceType>::AttributeType member##_AttrType;\
289 icomp::TMultiReferenceMember<interfaceType> member
297#define I_MULTIREF(interfaceType, member)\
298 typedef icomp::TMultiReferenceMember<interfaceType> member##_Type;\
299 typedef icomp::TMultiReferenceMember<interfaceType>::AttributeType member##_AttrType;\
300 icomp::TMultiReferenceMember<interfaceType> member
307#define I_FACT(interfaceType, member)\
308 typedef icomp::TFactoryMember<interfaceType> member##_Type;\
309 typedef icomp::TFactoryMember<interfaceType>::AttributeType member##_AttrType;\
310 icomp::TFactoryMember<interfaceType> member;
317#define I_TFACT(interfaceType, member)\
318 typedef icomp::TFactoryMember<interfaceType> member##_Type;\
319 typedef typename icomp::TFactoryMember<interfaceType>::AttributeType member##_AttrType;\
320 icomp::TFactoryMember<interfaceType> member
327#define I_MULTIFACT(interfaceType, member)\
328 typedef icomp::TMultiFactoryMember<interfaceType> member##_Type;\
329 typedef icomp::TMultiFactoryMember<interfaceType>::AttributeType member##_AttrType;\
330 icomp::TMultiFactoryMember<interfaceType> member
337#define I_ASSIGN_BASE(member, id, description, isObligatory)\
338 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>());\
339 if (componentPtr != nullptr){\
340 componentPtr->member.Init(componentPtr, member##_Info);\
349#define I_ASSIGN(member, id, description, isObligatory, defaultValue)\
350 static member##_AttrType member##_Default(defaultValue);\
351 I_ASSIGN_BASE(member, id, description, isObligatory)
356#define I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)\
357 static member##_AttrType member##_Default(int(sizeof(member##_DefaultElements) / sizeof(member##_AttrType::ValueType)), member##_DefaultElements);\
358 I_ASSIGN_BASE(member, id, description, isObligatory)
365#define I_ASSIGN_MULTI_0(member, id, description, isObligatory)\
366 static member##_AttrType member##_Default(0, nullptr);\
367 I_ASSIGN_BASE(member, id, description, isObligatory)
374#define I_ASSIGN_MULTI_1(member, id, description, isObligatory, defaultValue1)\
375 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1};\
376 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
383#define I_ASSIGN_MULTI_2(member, id, description, isObligatory, defaultValue1, defaultValue2)\
384 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2};\
385 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
392#define I_ASSIGN_MULTI_3(member, id, description, isObligatory, defaultValue1, defaultValue2, defaultValue3)\
393 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2, defaultValue3};\
394 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
401#define I_ASSIGN_MULTI_4(member, id, description, isObligatory, defaultValue1, defaultValue2, defaultValue3, defaultValue4)\
402 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2, defaultValue3, defaultValue4};\
403 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
410#define I_ASSIGN_MULTI_5(member, id, description, isObligatory, defaultValue1, defaultValue2, defaultValue3, defaultValue4, defaultValue5)\
411 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2, defaultValue3, defaultValue4, defaultValue5};\
412 I_ASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
419#define I_TASSIGN_BASE(member, id, description, isObligatory)\
420 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>());\
421 if (componentPtr != nullptr){\
422 componentPtr->member.Init(componentPtr, member##_Info);\
430#define I_TASSIGN(member, id, description, isObligatory, defaultValue)\
431 static member##_AttrType member##_Default(defaultValue);\
432 I_TASSIGN_BASE(member, id, description, isObligatory)
439#define I_TASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)\
440 static member##_AttrType member##_Default(int(sizeof(member##_DefaultElements) / sizeof(member##_AttrType::ValueType)), member##_DefaultElements);\
441 I_TASSIGN_BASE(member, id, description, isObligatory)
448#define I_TASSIGN_MULTI_0(member, id, description, isObligatory)\
449 static member##_AttrType member##_Default(0, nullptr);\
450 I_TASSIGN_BASE(member, id, description, isObligatory)
457#define I_TASSIGN_MULTI_1(member, id, description, isObligatory, defaultValue1)\
458 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1};\
459 I_TASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
466#define I_TASSIGN_MULTI_2(member, id, description, isObligatory, defaultValue1, defaultValue2)\
467 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2};\
468 I_TASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
475#define I_TASSIGN_MULTI_3(member, id, description, isObligatory, defaultValue1, defaultValue2, defaultValue3)\
476 static member##_AttrType::ValueType member##_DefaultElements[] = {defaultValue1, defaultValue2, defaultValue3};\
477 I_TASSIGN_MULTI_BASE(member, id, description, isObligatory, defaultValue)
485#define I_ASSIGN_TO(member, baseAttribute, isObligatory)\
486 static icomp::CRelatedInfoRegistrator member##_Info(baseAttribute##_Info, icomp::IComponentStaticInfo::MGI_INTERFACES, istd::CClassInfo::GetInfo<member##_Type::InterfaceType>().GetName(), isObligatory? member##_AttrType::DAF_OBLIGATORY: member##_AttrType::DAF_OPTIONAL);\
487 Q_UNUSED(member##_Info);\
488 if (componentPtr != nullptr){\
489 componentPtr->member.Init(componentPtr, baseAttribute##_Info);\
497#define I_TASSIGN_TO(member, baseAttribute, isObligatory)\
498 static icomp::CRelatedInfoRegistrator member##_Info(baseAttribute##_Info, icomp::IComponentStaticInfo::MGI_INTERFACES, istd::CClassInfo::GetInfo<typename member##_Type::InterfaceType>().GetName(), isObligatory? member##_AttrType::DAF_OBLIGATORY: member##_AttrType::DAF_OPTIONAL);\
499 Q_UNUSED(member##_Info);\
500 if (componentPtr != nullptr){\
501 componentPtr->member.Init(componentPtr, baseAttribute##_Info);\
514 if (componentPtr !=
nullptr){
517 if (parentComponentPtr !=
nullptr){
520 if (retVal !=
nullptr){
526 return dynamic_cast<Dest*
>(objectPtr);
540 if (componentPtr !=
nullptr){
542 if (parentComponentPtr !=
nullptr){
545 if (retVal !=
nullptr){
551 return dynamic_cast<const Dest*
>(objectPtr);
564 if (componentPtr !=
nullptr) {
566 if (parentComponentPtr !=
nullptr) {
568 if (retVal !=
nullptr) {
572 return QueryInterface<Dest>(parentComponentPtr, componentId);
Base class for component implementation.
static QByteArray GetComponentId(const icomp::IComponentContext *componentContextPtr, const QByteArray &contextId=QByteArray())
virtual void OnComponentDestroyed()
static const icomp::IRealComponentStaticInfo & InitStaticInfo(IComponent *componentPtr)
bool IsComponentActive() const
Check if component is active.
virtual IComponentContextSharedPtr GetComponentContext() const override
Get access to component context describing all application-specified component information loaded fro...
virtual const icomp::IRealComponentStaticInfo & GetComponentStaticInfo() const =0
Get access to static info of this component.
virtual void * GetInterface(const istd::CClassInfo &interfaceType, const QByteArray &subId="") override
Get access to specified component interface.
virtual void OnComponentCreated()
CComponentBase()
Create component and assign it to specific context.
virtual void SetComponentContext(const IComponentContextSharedPtr &contextPtr, const icomp::IComponent *parentPtr, bool isParentOwner) override
Set component context of this component.
virtual const icomp::IComponent * GetParentComponent(bool ownerOnly=false) const override
Get parent of this component.
Provide session context of component.
Main component interface.
virtual const icomp::IComponent * GetParentComponent(bool ownerOnly=false) const =0
Get parent of this component.
virtual void * GetInterface(const istd::CClassInfo &interfaceType, const QByteArray &subId="")=0
Get access to specified 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.
Base interface for all used interfaces and implementations.
Dest * QueryInterface(istd::IPolymorphic *objectPtr, const QByteArray &componentId=QByteArray())
Queries an object for a specified interface.
Dest * CompCastPtr(istd::IPolymorphic *objectPtr)
Cast to specified interface trying to use component interface query.
Package with interfaces and class used for components concept.
std::shared_ptr< icomp::IComponentContext > IComponentContextSharedPtr