CInspectionTaskComp.h
Go to the documentation of this file.
1 #ifndef iinsp_CInspectionTaskComp_included
2 #define iinsp_CInspectionTaskComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QMap>
7 
8 // ACF includes
10 #include <istd/CChangeNotifier.h>
11 #include <imod/IModel.h>
12 #include <imod/TModelWrap.h>
15 #include <ilog/CMessageContainer.h>
16 #include <ilog/TLoggerCompWrap.h>
17 
18 // ACF-Solutions includes
19 #include <iinsp/IInspectionTask.h>
20 
21 
22 namespace iinsp
23 {
24 
25 
37  virtual public IInspectionTask,
38  virtual public iinsp::ISupplier,
39  virtual public istd::IInformationProvider,
40  protected imod::CModelUpdateBridge
41 {
42 public:
45 
46  enum MessageId
47  {
51  };
52 
53  I_BEGIN_COMPONENT(CInspectionTaskComp);
54  I_REGISTER_INTERFACE(IInspectionTask);
55  I_REGISTER_INTERFACE(iser::ISerializable);
56  I_REGISTER_INTERFACE(iinsp::ISupplier);
57  I_REGISTER_INTERFACE(istd::IInformationProvider);
58  I_REGISTER_SUBELEMENT(Parameters);
63  I_ASSIGN_MULTI_0(m_subtasksCompPtr, "Subtasks", "List of subtasks (suppliers)", true);
64  I_ASSIGN_TO(m_subtaskModelsCompPtr, m_subtasksCompPtr, true);
65  I_ASSIGN_TO(m_subtaskInspectionCompPtr, m_subtasksCompPtr, false);
66  I_ASSIGN_TO(m_subtaskInfoProviderCompPtr, m_subtasksCompPtr, false);
67  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)
68  I_ASSIGN(m_serializeSuppliersAttrPtr, "SerializeSuppliers", "If it is true, parameters of suppliers will be serialized", true, true);
69  I_ASSIGN(m_reduceHierarchyAttrPtr, "ReduceHierarchy", "If it is true, sub inspection tasks will be rolled out", true, false);
70  I_ASSIGN(m_generalParamsCompPtr, "GeneralParams", "Optional general parameter set, it will be always serialized", false, "GeneralParams");
71  I_ASSIGN_TO(m_generalParamsModelCompPtr, m_generalParamsCompPtr, true);
72  I_ASSIGN(m_diagnosticNameAttrPtr, "DiagnosticName", "Name of this supplier for diagnostic, if it is not set, no diagnostic log message will be send", false, "");
73  I_ASSIGN(m_supportTempMessagesAttrPtr, "SupportTempMessages", "If enabled cumulation of temporary messages will be supported", true, false);
74  I_END_COMPONENT;
75 
77 
78  // reimplemented (iinsp::IInspectionTask)
79  virtual int GetSubtasksCount() const;
80  virtual iinsp::ISupplier* GetSubtask(int subtaskIndex) const;
81  virtual iprm::IParamsSet* GetGeneralParameters() const;
82 
83  // reimplemented (iser::ISerializable)
84  virtual bool Serialize(iser::IArchive& archive);
85 
86  // reimplemented (iinsp::ISupplier)
87  virtual int GetWorkStatus() const;
88  virtual imod::IModel* GetWorkStatusModel() const;
89  virtual void InvalidateSupplier();
90  virtual void EnsureWorkInitialized();
91  virtual void EnsureWorkFinished();
92  virtual void ClearWorkResults();
93  virtual const ilog::IMessageContainer* GetWorkMessages(int messageType) const;
94  virtual iprm::IParamsSet* GetModelParametersSet() const;
95 
96  // reimplemented (istd::IInformationProvider)
97  virtual QDateTime GetInformationTimeStamp() const;
98  virtual InformationCategory GetInformationCategory() const;
99  virtual int GetInformationId() const;
100  virtual QString GetInformationDescription() const;
101  virtual QString GetInformationSource() const;
102  virtual int GetInformationFlags() const;
103 
104 protected:
105  void EnsureStatusKnown();
106 
107  // reimplemented (icomp::CComponentBase)
108  virtual void OnComponentCreated();
109  virtual void OnComponentDestroyed();
110 
111  // reimplemented (imod::IObserver)
112  virtual void AfterUpdate(imod::IModel* modelPtr, const istd::IChangeable::ChangeSet& changeSet);
113 
114 protected:
115  class MessageContainer: virtual public ilog::CMessageContainer
116  {
117  public:
119 
121 
122  // reimplemented (ilog::IMessageContainer)
123  virtual int GetWorstCategory() const;
124  virtual Messages GetMessages() const;
125  virtual void ClearMessages();
126 
127  // reimplemented (iser::ISerializable)
128  virtual bool Serialize(iser::IArchive& archive);
129 
130  private:
131  CInspectionTaskComp* m_parentPtr;
133  };
134 
135  class Parameters:
136  virtual public iprm::IParamsSet,
138  {
139  public:
140  Parameters();
141 
142  void SetParent(CInspectionTaskComp* parentPtr);
143 
144  // reimplemented (iprm::IParamsSet)
145  virtual Ids GetParamIds(bool editableOnly = false) const;
146  virtual const iser::ISerializable* GetParameter(const QByteArray& id) const;
147  virtual iser::ISerializable* GetEditableParameter(const QByteArray& id);
148 
149  // reimplemented (iser::ISerializable)
150  virtual bool Serialize(iser::IArchive& archive);
151 
152  // reimplemented (istd::IChangeable)
153  virtual bool ResetData(CompatibilityMode mode = CM_WITHOUT_REFS);
154 
155  private:
156  CInspectionTaskComp* m_parentPtr;
157  };
158 
160  {
161  public:
163 
165 
166  // reimplemented (imod::IObserver)
167  virtual void AfterUpdate(imod::IModel* modelPtr, const istd::IChangeable::ChangeSet& changeSet);
168 
169  private:
170  CInspectionTaskComp* m_parentPtr;
171  };
172 
173  class Status: virtual public istd::IChangeable
174  {
175  public:
176  Status();
177 
178  int GetSupplierState() const;
179  void SetSupplierState(int state);
180 
181  private:
182  int m_state;
183  };
184 
186 
187  I_MULTIREF(iinsp::ISupplier, m_subtasksCompPtr);
188  I_MULTIREF(imod::IModel, m_subtaskModelsCompPtr);
189  I_MULTIREF(IInspectionTask, m_subtaskInspectionCompPtr);
190  I_MULTIREF(istd::IInformationProvider, m_subtaskInfoProviderCompPtr);
191  I_MULTIREF(iinsp::ISupplier, m_additionalSupppliersCompPtr);
192  I_ATTR(bool, m_serializeSuppliersAttrPtr);
193  I_ATTR(bool, m_reduceHierarchyAttrPtr);
194  I_REF(iprm::IParamsSet, m_generalParamsCompPtr);
195  I_REF(imod::IModel, m_generalParamsModelCompPtr);
196  I_ATTR(QString, m_diagnosticNameAttrPtr);
197  I_ATTR(bool, m_supportTempMessagesAttrPtr);
198 
199  typedef QVector<iinsp::ISupplier*> Suppliers;
201 
204 
205  template <class InterfaceType>
206  static InterfaceType* ExtractParameters(CInspectionTaskComp& component)
207  {
208  return &component.m_parameters;
209  }
210 
212 
213  QDateTime m_resultTypeStamp;
214  InformationCategory m_resultCategory;
216 
219 
222 
223  typedef QMap<iinsp::ISupplier*, NotifierPtr> SubtaskNotifiers;
225 
227 
229 };
230 
231 
232 } // namespace iinsp
233 
234 
235 #endif // !iinsp_CInspectionTaskComp_included
236 
237 
Standard component implementation of interface iinsp::IInspectionTask.
virtual QDateTime GetInformationTimeStamp() const
istd::IChangeable::ChangeSet m_supplierResultsChangeSet
imod::TModelWrap< Parameters > ParametersModel
imod::TModelWrap< Status > StatusModel
virtual bool Serialize(iser::IArchive &archive)
virtual const iser::ISerializable * GetParameter(const QByteArray &id) const
imod::CModelUpdateBridge BaseClass2
TaskStatusObserver(CInspectionTaskComp *parentPtr)
I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, iprm::IParamsSet, ExtractParameters)
virtual int GetSubtasksCount() const
Get number of inspection steps (subtasks).
virtual bool Serialize(iser::IArchive &archive)
virtual imod::IModel * GetWorkStatusModel() const
Get access to the status model of the supplier.
InformationCategory m_resultCategory
virtual QString GetInformationDescription() const
virtual iprm::IParamsSet * GetGeneralParameters() const
Get general parameters additionaly stored next to parameters stored in suppliers. ...
virtual void AfterUpdate(imod::IModel *modelPtr, const istd::IChangeable::ChangeSet &changeSet)
virtual void EnsureWorkFinished()
Ensure that all objects are produced.
QVector< iinsp::ISupplier * > Suppliers
QMap< iinsp::ISupplier *, NotifierPtr > SubtaskNotifiers
virtual void AfterUpdate(imod::IModel *modelPtr, const istd::IChangeable::ChangeSet &changeSet)
virtual bool ResetData(CompatibilityMode mode=CM_WITHOUT_REFS)
virtual int GetWorkStatus() const
Get status of last work.
virtual iprm::IParamsSet * GetModelParametersSet() const
Get parameter set using by this supplier.
virtual int GetInformationId() const
virtual const ilog::IMessageContainer * GetWorkMessages(int messageType) const
Get messages outputted by this work.
Representation of complete inspection task.
virtual Ids GetParamIds(bool editableOnly=false) const
virtual int GetInformationFlags() const
virtual iinsp::ISupplier * GetSubtask(int subtaskIndex) const
Get single inspection steps (subtasks).
istd::TDelPtr< istd::CChangeNotifier > NotifierPtr
static InterfaceType * ExtractParameters(CInspectionTaskComp &component)
virtual void EnsureWorkInitialized()
Force the supplier to initialize its work.
virtual QString GetInformationSource() const
virtual void OnComponentCreated()
virtual void InvalidateSupplier()
Called to signalize that this supplier is invalid.
TaskStatusObserver m_subTaskStatusObserver
virtual void ClearWorkResults()
Remove all stored work results.
virtual iser::ISerializable * GetEditableParameter(const QByteArray &id)
Base interface for suppliers providing calculating of objects on demand ("pull data" model)...
Definition: ISupplier.h:22
virtual InformationCategory GetInformationCategory() const
virtual void OnComponentDestroyed()
void SetParent(CInspectionTaskComp *parentPtr)
ilog::CLoggerComponentBase BaseClass

© 2007-2017 Witold Gantzke and Kirill Lepskiy