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/TChangeNotifier.h"
11 #include "imod/IModel.h"
12 #include "imod/TModelWrap.h"
14 #include "ilog/CMessageContainer.h"
15 #include "ilog/TLoggerCompWrap.h"
16 
17 // ACF-Solutions includes
18 #include "iinsp/IInspectionTask.h"
19 
20 
21 namespace iinsp
22 {
23 
24 
31  virtual public IInspectionTask,
32  virtual public iproc::ISupplier,
33  virtual public istd::IInformationProvider,
35 {
36 public:
39 
40  enum MessageId
41  {
44  };
45 
46  I_BEGIN_COMPONENT(CInspectionTaskComp);
47  I_REGISTER_INTERFACE(IInspectionTask);
48  I_REGISTER_INTERFACE(iser::ISerializable);
49  I_REGISTER_INTERFACE(iproc::ISupplier);
50  I_REGISTER_INTERFACE(ilog::IMessageContainer);
51  I_REGISTER_INTERFACE(istd::IInformationProvider);
52  I_REGISTER_SUBELEMENT(Parameters);
53  I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, iprm::IParamsSet, ExtractParameters);
54  I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, iser::ISerializable, ExtractParameters);
55  I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, istd::IChangeable, ExtractParameters);
56  I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, imod::IModel, ExtractParameters);
57  I_ASSIGN_MULTI_0(m_subtasksCompPtr, "Subtasks", "List of subtasks (suppliers)", true);
58  I_ASSIGN_TO(m_subtaskModelsCompPtr, m_subtasksCompPtr, true);
59  I_ASSIGN_TO(m_subtaskInspectionCompPtr, m_subtasksCompPtr, false);
60  I_ASSIGN_TO(m_subtaskInfoProviderCompPtr, m_subtasksCompPtr, false);
61  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)
62  I_ASSIGN(m_serializeSuppliersAttrPtr, "SerializeSuppliers", "If it is true, parameters of suppliers will be serialized", true, true);
63  I_ASSIGN(m_reduceHierarchyAttrPtr, "ReduceHierarchy", "If it is true, sub inspection tasks will be rolled out", true, false);
64  I_ASSIGN(m_generalParamsCompPtr, "GeneralParams", "Optional general parameter set, it will be always serialized", false, "GeneralParams");
65  I_ASSIGN_TO(m_generalParamsModelCompPtr, m_generalParamsCompPtr, true);
66  I_ASSIGN(m_diagnosticNameAttrPtr, "DiagnosticName", "Name of this supplier for diagnostic, if it is not set, no diagnostic log message will be send", false, "");
67  I_END_COMPONENT;
68 
70 
71  // reimplemented (iinsp::IInspectionTask)
72  virtual int GetSubtasksCount() const;
73  virtual iproc::ISupplier* GetSubtask(int subtaskIndex) const;
74  virtual iprm::IParamsSet* GetGeneralParameters() const;
75 
76  // reimplemented (iser::ISerializable)
77  virtual bool Serialize(iser::IArchive& archive);
78 
79  // reimplemented (iproc::ISupplier)
80  virtual int GetWorkStatus() const;
81  virtual void InvalidateSupplier();
82  virtual void EnsureWorkInitialized();
83  virtual void EnsureWorkFinished();
84  virtual void ClearWorkResults();
85  virtual const ilog::IMessageContainer* GetWorkMessages(int messageType) const;
86  virtual iprm::IParamsSet* GetModelParametersSet() const;
87 
88  // reimplemented (istd::IInformationProvider)
89  virtual QDateTime GetInformationTimeStamp() const;
90  virtual InformationCategory GetInformationCategory() const;
91  virtual int GetInformationId() const;
92  virtual QString GetInformationDescription() const;
93  virtual QString GetInformationSource() const;
94  virtual int GetInformationFlags() const;
95 
96 protected:
97  void EnsureStatusKnown();
98 
99  // reimplemented (icomp::CComponentBase)
100  virtual void OnComponentCreated();
101  virtual void OnComponentDestroyed();
102 
103  // reimplemented (imod::IObserver)
104  virtual void AfterUpdate(imod::IModel* modelPtr, int updateFlags, istd::IPolymorphic* updateParamsPtr);
105 
106 private:
107  class MessageContainer: virtual public ilog::CMessageContainer
108  {
109  public:
111 
112  MessageContainer(CInspectionTaskComp* parentPtr);
113 
114  // reimplemented (ilog::IMessageContainer)
115  virtual int GetWorstCategory() const;
116  virtual Messages GetMessages() const;
117  virtual void ClearMessages();
118 
119  // reimplemented (iser::ISerializable)
120  virtual bool Serialize(iser::IArchive& archive);
121 
122  private:
123  CInspectionTaskComp* m_parentPtr;
124  };
125 
126  class Parameters:
128  virtual public iprm::IParamsSet
129  {
130  public:
131  Parameters();
132 
133  void SetParent(CInspectionTaskComp* parentPtr);
134 
135  // reimplemented (iprm::IParamsSet)
136  virtual Ids GetParamIds(bool editableOnly = false) const;
137  virtual const iser::ISerializable* GetParameter(const QByteArray& id) const;
138  virtual iser::ISerializable* GetEditableParameter(const QByteArray& id);
139 
140  // reimplemented (iser::ISerializable)
141  virtual bool Serialize(iser::IArchive& archive);
142 
143  private:
144  CInspectionTaskComp* m_parentPtr;
145  };
146 
147  I_MULTIREF(iproc::ISupplier, m_subtasksCompPtr);
148  I_MULTIREF(imod::IModel, m_subtaskModelsCompPtr);
149  I_MULTIREF(IInspectionTask, m_subtaskInspectionCompPtr);
150  I_MULTIREF(istd::IInformationProvider, m_subtaskInfoProviderCompPtr);
151  I_MULTIREF(iproc::ISupplier, m_additionalSupppliersCompPtr);
152  I_ATTR(bool, m_serializeSuppliersAttrPtr);
153  I_ATTR(bool, m_reduceHierarchyAttrPtr);
154  I_REF(iprm::IParamsSet, m_generalParamsCompPtr);
155  I_REF(imod::IModel, m_generalParamsModelCompPtr);
156  I_ATTR(QString, m_diagnosticNameAttrPtr);
157 
158  typedef QVector<iproc::ISupplier*> Suppliers;
159  Suppliers m_subtasks;
160 
161  typedef imod::TModelWrap<Parameters> ParametersModel;
162  mutable ParametersModel m_parameters;
163 
164  template <class InterfaceType>
165  static InterfaceType* ExtractParameters(CInspectionTaskComp& component)
166  {
167  return &component.m_parameters;
168  }
169 
170  bool m_isStatusKnown;
171 
172  QDateTime m_resultTypeStamp;
173  InformationCategory m_resultCategory;
174  QString m_resultDescription;
175 
176  MessageContainer m_messageContainer;
177 
178  istd::CChangeNotifier m_productChangeNotifier;
179 
180  typedef QMap<iproc::ISupplier*, istd::CChangeNotifier> SubtaskNotifiers;
181  SubtaskNotifiers m_subtaskNotifiers;
182 };
183 
184 
185 } // namespace iinsp
186 
187 
188 #endif // !iinsp_CInspectionTaskComp_included
189 
190 
Standard component implementation of interface iinsp::IInspectionTask.
virtual QDateTime GetInformationTimeStamp() const
virtual bool Serialize(iser::IArchive &archive)
I_REGISTER_SUBELEMENT_INTERFACE_T(Parameters, iprm::IParamsSet, ExtractParameters)
I_REGISTER_SUBELEMENT(Parameters)
virtual int GetSubtasksCount() const
Get number of inspection steps (subtasks).
virtual void AfterUpdate(imod::IModel *modelPtr, int updateFlags, istd::IPolymorphic *updateParamsPtr)
virtual QString GetInformationDescription() const
virtual iprm::IParamsSet * GetGeneralParameters() const
Get general parameters additionaly stored next to parameters stored in suppliers. ...
virtual void EnsureWorkFinished()
Ensure that all objects are produced.
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 int GetInformationFlags() const
virtual iproc::ISupplier * GetSubtask(int subtaskIndex) const
Get single inspection steps (subtasks).
I_ASSIGN_TO(m_subtaskModelsCompPtr, m_subtasksCompPtr, true)
Base interface for suppliers providing synchrone processing of single object with "pull data" model...
Definition: ISupplier.h:22
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.
virtual void ClearWorkResults()
Remove all stored work results.
imod::CMultiModelBridgeBase BaseClass2
virtual InformationCategory GetInformationCategory() const
virtual void OnComponentDestroyed()
ilog::CLoggerComponentBase BaseClass

© 2007-2011 Witold Gantzke and Kirill Lepskiy