ICF 3.1.1.10
Technical documentation of ICF Libraries
CInspectionTaskComp.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#ifndef iinsp_CInspectionTaskComp_included
7#define iinsp_CInspectionTaskComp_included
8
9
10// Qt includes
11#include <QtCore/QMap>
12
13// ICF includes
16#include <imod/IModel.h>
17#include <imod/TModelWrap.h>
23
24
25namespace iinsp
26{
27
28
40 virtual public IInspectionTask,
41 virtual public iinsp::ISupplier,
42 virtual public istd::IInformationProvider,
44{
45public:
48
50 {
53 };
54
55 I_BEGIN_COMPONENT(CInspectionTaskComp);
56 I_REGISTER_INTERFACE(IInspectionTask);
57 I_REGISTER_INTERFACE(iser::ISerializable);
58 I_REGISTER_INTERFACE(iinsp::ISupplier);
59 I_REGISTER_INTERFACE(istd::IInformationProvider);
60 I_REGISTER_SUBELEMENT(Parameters);
61 I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, iprm::IParamsSet, ExtractParameters);
62 I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, iser::ISerializable, ExtractParameters);
63 I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, istd::IChangeable, ExtractParameters);
64 I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, imod::IModel, ExtractParameters);
65 I_ASSIGN_MULTI_0(m_subtasksCompPtr, "Subtasks", "List of subtasks (suppliers)", true);
66 I_ASSIGN_TO(m_subtaskModelsCompPtr, m_subtasksCompPtr, true);
67 I_ASSIGN_TO(m_subtaskInspectionCompPtr, m_subtasksCompPtr, false);
68 I_ASSIGN_TO(m_subtaskInfoProviderCompPtr, m_subtasksCompPtr, false);
69 I_ASSIGN_MULTI_0(m_additionalSupppliersCompPtr, "AdditionalSuppliers", "Set of suppliers will be initialized and controlled together with subtasks, but they will be not listed as subtasks", false);
70 I_ASSIGN(m_serializeSuppliersAttrPtr, "SerializeSuppliers", "If it is true, parameters of suppliers will be serialized", true, true);
71 I_ASSIGN(m_reduceHierarchyAttrPtr, "ReduceHierarchy", "If it is true, sub inspection tasks will be rolled out", true, false);
72 I_ASSIGN(m_generalParamsCompPtr, "GeneralParams", "Optional general parameter set, it will be always serialized", false, "GeneralParams");
73 I_ASSIGN_TO(m_generalParamsModelCompPtr, m_generalParamsCompPtr, true);
74 I_ASSIGN(m_diagnosticNameAttrPtr, "DiagnosticName", "Name of this supplier for diagnostic, if it is not set, no diagnostic log message will be send", false, "");
75 I_ASSIGN(m_supportTempMessagesAttrPtr, "SupportTempMessages", "If enabled cumulation of temporary messages will be supported", true, false);
76 I_END_COMPONENT;
77
79
80 // reimplemented (iinsp::IInspectionTask)
81 int GetSubtasksCount() const override;
82 iinsp::ISupplier* GetSubtask(int subtaskIndex) const override;
84
85 // reimplemented (iser::ISerializable)
86 bool Serialize(iser::IArchive& archive) override;
87
88 // reimplemented (iinsp::ISupplier)
89 int GetWorkStatus() const override;
91 void InvalidateSupplier() override;
92 void EnsureWorkInitialized() override;
93 void EnsureWorkFinished() override;
94 void ClearWorkResults() override;
95 const ilog::IMessageContainer* GetWorkMessages(int messageType) const override;
97
98 // reimplemented (istd::IInformationProvider)
99 QDateTime GetInformationTimeStamp() const override;
101 int GetInformationId() const override;
102 QString GetInformationDescription() const override;
103 QString GetInformationSource() const override;
104 int GetInformationFlags() const override;
105
106protected:
108
109 // reimplemented (icomp::CComponentBase)
110 void OnComponentCreated() override;
111 void OnComponentDestroyed() override;
112
113 // reimplemented (imod::IObserver)
114 void AfterModelChange(imod::IModel* modelPtr, const istd::IChangeable::ChangeSet& changeSet) override;
115
116protected:
118 {
119 public:
121
123
124 // reimplemented (ilog::IMessageContainer)
126 Messages GetMessages() const override;
127 void ClearMessages() override;
128
129 // reimplemented (iser::ISerializable)
130 bool Serialize(iser::IArchive& archive) override;
131
132 private:
133 CInspectionTaskComp* m_parentPtr;
135 };
136
138 virtual public iprm::IParamsSet,
140 {
141 public:
143
145
146 // reimplemented (iprm::IParamsSet)
147 Ids GetParamIds(bool editableOnly = false) const override;
148 const iser::ISerializable* GetParameter(const QByteArray& id) const override;
149 iser::ISerializable* GetEditableParameter(const QByteArray& id) override;
150
151 // reimplemented (iser::ISerializable)
152 bool Serialize(iser::IArchive& archive) override;
153
154 // reimplemented (istd::IChangeable)
156
157 // reimplemented (istd::IChangeable)
159
160 private:
161 CInspectionTaskComp* m_parentPtr;
162 };
163
165 {
166 public:
168
170
171 // reimplemented (imod::IObserver)
172 virtual void AfterModelChange(imod::IModel* modelPtr, const istd::IChangeable::ChangeSet& changeSet);
173
174 private:
175 CInspectionTaskComp* m_parentPtr;
176 };
177
178 class Status: virtual public istd::IChangeable
179 {
180 public:
182
183 int GetSupplierState() const;
184 void SetSupplierState(int state);
185
186 private:
187 int m_state;
188 };
189
191
192 I_MULTIREF(iinsp::ISupplier, m_subtasksCompPtr);
193 I_MULTIREF(imod::IModel, m_subtaskModelsCompPtr);
194 I_MULTIREF(IInspectionTask, m_subtaskInspectionCompPtr);
195 I_MULTIREF(istd::IInformationProvider, m_subtaskInfoProviderCompPtr);
196 I_MULTIREF(iinsp::ISupplier, m_additionalSupppliersCompPtr);
197 I_ATTR(bool, m_serializeSuppliersAttrPtr);
198 I_ATTR(bool, m_reduceHierarchyAttrPtr);
199 I_REF(iprm::IParamsSet, m_generalParamsCompPtr);
200 I_REF(imod::IModel, m_generalParamsModelCompPtr);
201 I_ATTR(QString, m_diagnosticNameAttrPtr);
202 I_ATTR(bool, m_supportTempMessagesAttrPtr);
203
204 typedef QVector<iinsp::ISupplier*> Suppliers;
206
209
210 template <class InterfaceType>
211 static InterfaceType* ExtractParameters(CInspectionTaskComp& component)
212 {
213 return &component.m_parameters;
214 }
215
217
221
224
226 typedef std::unique_ptr<istd::CChangeNotifier> NotifierPtr;
227
228 typedef std::map<iinsp::ISupplier*, NotifierPtr> SubtaskNotifiers;
230
232
234};
235
236
237} // namespace iinsp
238
239
240#endif // !iinsp_CInspectionTaskComp_included
241
242
istd::IInformationProvider::InformationCategory GetWorstCategory() const override
bool Serialize(iser::IArchive &archive) override
MessageContainer(CInspectionTaskComp *parentPtr, iinsp::ISupplier::MessageContainerType containerType)
const iser::ISerializable * GetParameter(const QByteArray &id) const override
Get any parameter.
iser::ISerializable * GetEditableParameter(const QByteArray &id) override
Get access to editable parameter.
bool ResetData(CompatibilityMode mode=CM_WITHOUT_REFS) override
Reset data to its default state.
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
Ids GetParamIds(bool editableOnly=false) const override
Get list of used parameter IDs in the parameter set.
void SetParent(CInspectionTaskComp *parentPtr)
bool CopyFrom(const istd::IChangeable &object, istd::IChangeable::CompatibilityMode mode=CM_WITHOUT_REFS) override
Copy this object from another one.
virtual void AfterModelChange(imod::IModel *modelPtr, const istd::IChangeable::ChangeSet &changeSet)
This function will be called after update of the observer contents occures.
TaskStatusObserver(CInspectionTaskComp *parentPtr)
Standard component implementation of interface iinsp::IInspectionTask.
imod::CModelUpdateBridge BaseClass2
const ilog::IMessageContainer * GetWorkMessages(int messageType) const override
Get messages outputted by this work.
int GetInformationId() const override
Get binary ID of the information using to automatical identification of this information type.
std::unique_ptr< istd::CChangeNotifier > NotifierPtr
iprm::IParamsSet * GetGeneralParameters() const override
Get general parameters additionaly stored next to parameters stored in suppliers.
bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
std::map< iinsp::ISupplier *, NotifierPtr > SubtaskNotifiers
void ClearWorkResults() override
Remove all stored work results.
iinsp::ISupplier * GetSubtask(int subtaskIndex) const override
Get single inspection steps (subtasks).
iprm::IParamsSet * GetModelParametersSet() const override
Get parameter set using by this supplier.
int GetInformationFlags() const override
Get flags of the information.
void OnComponentDestroyed() override
int GetSubtasksCount() const override
Get number of inspection steps (subtasks).
static InterfaceType * ExtractParameters(CInspectionTaskComp &component)
int GetWorkStatus() const override
Get status of last work.
void OnComponentCreated() override
TaskStatusObserver m_subTaskStatusObserver
imod::TModelWrap< Parameters > ParametersModel
InformationCategory GetInformationCategory() const override
Get category of the information.
void AfterModelChange(imod::IModel *modelPtr, const istd::IChangeable::ChangeSet &changeSet) override
This function will be called after update of the observer contents occures.
QString GetInformationSource() const override
Get the source of the information.
QDateTime GetInformationTimeStamp() const override
Get optional time stamp of the information.
void EnsureWorkFinished() override
Ensure that all objects are produced.
QString GetInformationDescription() const override
Get the text description of the information.
InformationCategory m_resultCategory
ilog::CLoggerComponentBase BaseClass
void InvalidateSupplier() override
Called to signalize that this supplier is invalid.
istd::IChangeable::ChangeSet m_supplierResultsChangeSet
imod::TModelWrap< Status > StatusModel
imod::IModel * GetWorkStatusModel() const override
Get access to the status model of the supplier.
QVector< iinsp::ISupplier * > Suppliers
void EnsureWorkInitialized() override
Force the supplier to initialize its work.
Representation of complete inspection task.
Base interface for suppliers providing calculating of objects on demand ("pull data" model).
Definition ISupplier.h:28
Basic implementation of a message container.
Common interface for a message container.
Wrapper provider of log-functionality for component based implementations.
Reflects the changes of observed objects as changes of some other object (over istd::IChangeable),...
Basic implementation of a multiple model observer.
Common interface for model objects, that supports Model/Observer design pattern.
Definition IModel.h:29
This model wrapper provides a simple connection between a concrete istd::IChangeable implementation a...
Definition TModelWrap.h:28
Set of general parameters.
Definition IParamsSet.h:29
QSet< QByteArray > Ids
Definition IParamsSet.h:31
Represent input/output persistence archive.
Definition IArchive.h:34
Common class for all classes which objects can be archived or restored from archive.
Set of change flags (its IDs).
Definition IChangeable.h:38
Common interface for data model objects, which can be changed.
Definition IChangeable.h:32
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.
Common interface for class providing some basic information object.
InformationCategory
Category of information.
Library containing inspection related classes and components.

© Witold Gantzke and Kirill Lepskiy