CParamsSet.h
Go to the documentation of this file.
1 #ifndef iprm_CParamsSet_included
2 #define iprm_CParamsSet_included
3 
4 
5 // Qt includes
6 #include <QtCore/QMap>
7 
8 // ACF includes
9 #include <istd/TOptDelPtr.h>
10 #include <istd/TPointerVector.h>
12 #include <iprm/IParamsSet.h>
13 
14 
15 namespace iprm
16 {
17 
18 
22 class CParamsSet: virtual public IParamsSet
23 {
24 public:
26  {
27  ParameterInfo(const QByteArray& parameterId, iser::ISerializable* parameterPtr, bool releaseFlag = false)
28  {
29  this->parameterPtr.SetPtr(parameterPtr, releaseFlag);
30  this->parameterId = parameterId;
31  }
32 
33  QByteArray parameterId;
35  };
37 
38  explicit CParamsSet(const IParamsSet* slaveSetPtr = NULL);
39 
45  const IParamsSet* GetSlaveSet() const;
51  void SetSlaveSet(const IParamsSet* slaveSetPtr);
52 
57  virtual bool SetEditableParameter(const QByteArray& id, iser::ISerializable* parameterPtr, bool releaseFlag = false);
58 
62  const ParameterInfos& GetParameterInfos() const;
63 
67  const QByteArray& GetParametersTypeId() const;
71  void SetParametersTypeId(const QByteArray& id);
72 
73  // reimplemented (iser::IObject)
74  virtual QByteArray GetFactoryId() const;
75 
76  // reimplemented (iprm::IParamsSet)
77  virtual Ids GetParamIds(bool editableOnly = false) const;
78  virtual const iser::ISerializable* GetParameter(const QByteArray& id) const;
79  virtual iser::ISerializable* GetEditableParameter(const QByteArray& id);
80 
81  // reimplemented (iser::ISerializable)
82  virtual bool Serialize(iser::IArchive& archive);
83  virtual quint32 GetMinimalVersion(int versionId) const;
84 
85  // reimplemented (istd::IChangeable)
86  virtual bool CopyFrom(const IChangeable& object, CompatibilityMode mode = CM_WITHOUT_REFS);
87  virtual bool ResetData(CompatibilityMode mode = CM_WITHOUT_REFS);
88 
89 protected:
90  const ParameterInfo* FindParameterInfo(const QByteArray& parameterId) const;
91 
92 private:
93  ParameterInfos m_params;
94 
95  QByteArray m_paramsTypeId;
96 
97  const IParamsSet* m_slaveSetPtr;
98 
99  imod::CModelUpdateBridge m_updateBridge;
100 };
101 
102 
103 // inline methods
104 
105 inline const IParamsSet* CParamsSet::GetSlaveSet() const
106 {
107  return m_slaveSetPtr;
108 }
109 
110 
111 inline void CParamsSet::SetSlaveSet(const IParamsSet* slaveSetPtr)
112 {
113  m_slaveSetPtr = slaveSetPtr;
114 }
115 
116 
117 } // namespace iprm
118 
119 
120 #endif // !iprm_CParamsSet_included
121 
122 
const IParamsSet * GetSlaveSet() const
Get slave parameter set.
Definition: CParamsSet.h:105
CParamsSet(const IParamsSet *slaveSetPtr=NULL)
QSet< QByteArray > Ids
Definition: IParamsSet.h:26
External references are simple ignored.
Definition: IChangeable.h:197
CompatibilityMode
Control how relationship betweeen objects are interpreted.
Definition: IChangeable.h:186
istd::TOptDelPtr< iser::ISerializable > parameterPtr
Definition: CParamsSet.h:34
const ParameterInfo * FindParameterInfo(const QByteArray &parameterId) const
Common class for all classes which objects can be archived or restored from archive.
Definition: ISerializable.h:23
virtual bool ResetData(CompatibilityMode mode=CM_WITHOUT_REFS)
Reset data to its default state.
void SetParametersTypeId(const QByteArray &id)
Set ID of this parameters type.
const ParameterInfos & GetParameterInfos() const
Get access to all parameters.
Represent input/output persistence archive.
Definition: IArchive.h:30
virtual QByteArray GetFactoryId() const
void SetSlaveSet(const IParamsSet *slaveSetPtr)
Set slave parameter set.
Definition: CParamsSet.h:111
virtual bool SetEditableParameter(const QByteArray &id, iser::ISerializable *parameterPtr, bool releaseFlag=false)
Set editable parameter in this set.
istd::TPointerVector< ParameterInfo > ParameterInfos
Definition: CParamsSet.h:36
virtual const iser::ISerializable * GetParameter(const QByteArray &id) const
Get any parameter.
#define NULL
Definition: istd.h:64
Reflects the changes of observed objects as changes of some other object (over istd::IChangeable), typically delegated to itself.
virtual Ids GetParamIds(bool editableOnly=false) const
Get list of used parameter IDs in the parameter set.
virtual bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS)
ParameterInfo(const QByteArray &parameterId, iser::ISerializable *parameterPtr, bool releaseFlag=false)
Definition: CParamsSet.h:27
virtual bool Serialize(iser::IArchive &archive)
Load or store state of this object as a archive stream.
const QByteArray & GetParametersTypeId() const
Get ID of this parameters type.
Basic implementation of interface IParamsSet.
Definition: CParamsSet.h:22
virtual iser::ISerializable * GetEditableParameter(const QByteArray &id)
Get access to editable parameter.
virtual quint32 GetMinimalVersion(int versionId) const
Get minimal needed version to correct storing of this data.
Set of general parameters.
Definition: IParamsSet.h:23

© 2007-2017 Witold Gantzke and Kirill Lepskiy