CMultiParamsManagerComp.h
Go to the documentation of this file.
1 #ifndef iprm_CMultiParamsManagerComp_included
2 #define iprm_CMultiParamsManagerComp_included
3 
4 
5 // Qt includes
6 #include <QtCore/QVector>
7 
8 // ACF includes
10 
11 
12 namespace iprm
13 {
14 
15 
20 {
21 public:
23 
24  I_BEGIN_COMPONENT(CMultiParamsManagerComp);
25  I_ASSIGN_MULTI_0(m_paramSetsFactoriesPtr, "ParamSetsFactories", "List of factories for parameter set creation", true);
26  I_ASSIGN_MULTI_0(m_factoryNameNameAttrPtr, "ParamSetsFactorieNames", "List of names associated with the parameter factories", true);
27  I_ASSIGN_MULTI_0(m_factoryDescriptionAttrPtr, "ParamSetsFactorieDesciption", "List of descriptions associated with the parameter factories", true);
28  I_END_COMPONENT;
29 
30  // reimplemented (iprm::IParamsManager)
31  virtual const IOptionsList* GetParamsTypeConstraints() const;
32 
33  // reimplemented (iser::ISerializable)
34  virtual bool Serialize(iser::IArchive& archive);
35 
36  // reimplemented (iprm::IOptionsManager)
37  virtual int GetOptionOperationFlags(int index = -1) const;
38  virtual bool SetOptionEnabled(int index, bool isEnabled = true);
39  virtual bool RemoveOption(int index);
40  virtual bool InsertOption(
41  const QString& optionName,
42  const QByteArray& optionId,
43  const QString& optionDescription = QString(),
44  int index = -1);
45  virtual bool SwapOptions(int index1, int index2);
46  virtual bool SetOptionName(int optionIndex, const QString& optionName);
47  virtual bool SetOptionDescription(int optionIndex, const QString& optionDescription);
48 
49 protected:
50  struct TypeInfo
51  {
53  QByteArray id;
54  QString name;
55  QString description;
56  };
57 
58  struct TypeInfoList: public IOptionsList
59  {
60  // reimplemented (iprm::IOptionsList)
61  virtual int GetOptionsFlags() const;
62  virtual int GetOptionsCount() const;
63  virtual QString GetOptionName(int index) const;
64  virtual QString GetOptionDescription(int index) const;
65  virtual QByteArray GetOptionId(int index) const;
66  virtual bool IsOptionEnabled(int index) const;
67 
68  QVector<TypeInfo> typeInfos;
69 
70  QMap<QByteArray, int> typeIdToIndexMap;
71  };
72 
82  bool EnsureParamExist(int index, const QByteArray& typeId, const QString& name, const QByteArray& uuid, bool isEnabled);
83 
84  // reimplemented (CParamsManagerCompBase)
85  virtual bool IsParameterCreationSupported() const;
86  virtual int GetCreatedParamsSetsCount() const;
87  virtual iprm::IParamsSet* CreateParamsSetInstance(int typeIndex = -1) const;
88 
89  // reimplemented (icomp::CComponentBase)
90  virtual void OnComponentCreated();
91  virtual void OnComponentDestroyed();
92 
93 private:
94  TypeInfoList m_typeInfoList;
95 
96 private:
97  I_MULTIFACT(iprm::IParamsSet, m_paramSetsFactoriesPtr);
98  I_MULTITEXTATTR(m_factoryNameNameAttrPtr);
99  I_MULTITEXTATTR(m_factoryDescriptionAttrPtr);
100 };
101 
102 
103 } // namespace iprm
104 
105 
106 #endif // !iprm_CMultiParamsManagerComp_included
107 
108 
virtual int GetOptionsFlags() const
Get constraints flags.
virtual int GetOptionOperationFlags(int index=-1) const
Get operation control flags of some option or whole manager.
virtual iprm::IParamsSet * CreateParamsSetInstance(int typeIndex=-1) const
Create a new instance of the parameter set.
virtual const IOptionsList * GetParamsTypeConstraints() const
Get selection contraints describing each supported type.
virtual bool SetOptionDescription(int optionIndex, const QString &optionDescription)
Set a new description for the option at the given index optionIndex.
Constraints of selection from set of possibilities.
Definition: IOptionsList.h:22
virtual bool SwapOptions(int index1, int index2)
Swap two options.
virtual bool RemoveOption(int index)
Remove an option at the given index.
virtual bool IsParameterCreationSupported() const
Return true if creation of parameter sets is supported by the implementation.
virtual bool SetOptionName(int optionIndex, const QString &optionName)
Set a new name for the option at the given index optionIndex.
bool EnsureParamExist(int index, const QByteArray &typeId, const QString &name, const QByteArray &uuid, bool isEnabled)
Ensure some parameter exist, has correct type and attributes.
Implementation of parameter manager.
Represent input/output persistence archive.
Definition: IArchive.h:30
virtual bool InsertOption(const QString &optionName, const QByteArray &optionId, const QString &optionDescription=QString(), int index=-1)
Insert an option at some position.
virtual int GetOptionsCount() const
Get number of managed options.
virtual QString GetOptionName(int index) const
Get name of specified option.
virtual bool IsOptionEnabled(int index) const
Return true if the option is enabled and can be selected.
virtual QByteArray GetOptionId(int index) const
Get option ID.
virtual void OnComponentDestroyed()
Implementation of parameter manager.
virtual QString GetOptionDescription(int index) const
Get human readable description for a option with the index index.
virtual void OnComponentCreated()
Set of general parameters.
Definition: IParamsSet.h:23
virtual bool SetOptionEnabled(int index, bool isEnabled=true)
Enables a given option.
virtual bool Serialize(iser::IArchive &archive)
Load or store state of this object as a archive stream.
virtual int GetCreatedParamsSetsCount() const
Get the number of parameter sets created at the run time.

© 2007-2017 Witold Gantzke and Kirill Lepskiy