ACF $AcfVersion:0$
Public Types | Public Member Functions | List of all members
iprm::IParamsManager Class Referenceabstract

Manager of parameter sets. More...

#include <IParamsManager.h>

Inheritance diagram for iprm::IParamsManager:
iprm::ISelectionParam iser::ISerializable istd::IChangeable istd::IPolymorphic iprm::CParamsManagerCompBase iprm::CMultiParamsManagerComp iprm::CParamsManagerComp

Public Types

enum  ParamsOperationFlags {
  MF_COUNT_FIXED = 1 , MF_SUPPORT_RENAME = 2 , MF_SUPPORT_INSERT = 4 , MF_SUPPORT_DELETE = 8 ,
  MF_SUPPORT_SWAP = 16 , MF_DISABLE_ALLOWED = 32 , MF_SUPPORT_EDIT = 64 , MF_INACTIVE = 128
}
 Bitwise coded flags used to find out supported features. More...
 
enum  ChangeFlags { CF_SET_INSERTED = 0x5af60 , CF_SET_REMOVED , CF_SET_NAME_CHANGED , CF_SET_ENABLE_CHANGED }
 Possible changes of the manager's data model. More...
 
typedef QSet< QByteArray > TypeIds
 
- Public Types inherited from iprm::ISelectionParam
enum  ChangeFlags { CF_SELECTION_CHANGED = 0x67364be }
 Data model change notification flags. More...
 
enum  { NO_SELECTION = -1 }
 
- Public Types inherited from istd::IChangeable
enum  ChangeFlags {
  CF_ACF_INTERNAL = 0 , CF_ALL_DATA , CF_ANY , CF_DESTROYING ,
  CF_DELEGATED , CF_NO_UNDO
}
 Data model change notification flags. More...
 
enum  SupportedOperations {
  SO_NONE = 0 , SO_OBSERVE = 1 << 0 , SO_COPY = 1 << 1 , SO_CLONE = 1 << 2 ,
  SO_COMPARE = 1 << 3 , SO_RESET = 1 << 4
}
 Flags for supported operations. More...
 
enum  CompatibilityMode { CM_STRICT , CM_WITHOUT_REFS , CM_WITH_REFS , CM_CONVERT }
 Control how relationship betweeen objects are interpreted. More...
 
typedef QMultiMap< QByteArray, QVariant > ChangeInfoMap
 

Public Member Functions

virtual int GetIndexOperationFlags (int index=-1) const =0
 Get operation control flags of some parameter set or whole manager.
 
virtual bool SetIndexOperationFlags (int index, int flags)=0
 Set operation control flags of some parameter-set.
 
virtual int GetParamsSetsCount () const =0
 Get number of managed parameter sets.
 
virtual const IOptionsListGetParamsTypeConstraints () const =0
 Get selection constraints describing each supported type.
 
virtual int InsertParamsSet (int typeIndex=-1, int index=-1)=0
 Insert new parameter set at selected position.
 
virtual bool RemoveParamsSet (int index)=0
 Remove parameter set at selected position.
 
virtual bool SwapParamsSet (int index1, int index2)=0
 Swap two parameter sets.
 
virtual IParamsSetGetParamsSet (int index) const =0
 Get selected parameter set.
 
virtual iprm::IParamsSetUniquePtr CreateParameterSet (int typeIndex=-1, int index=-1) const =0
 Create a new parameter set instance.
 
virtual QString GetParamsSetName (int index) const =0
 Get name of specified parameter set.
 
virtual bool SetParamsSetName (int index, const QString &name)=0
 Set name of specified parameter set.
 
virtual QString GetParamsSetDescription (int index) const =0
 Get the description of the specified parameter set.
 
virtual void SetParamsSetDescription (int index, const QString &description)=0
 Set the description of the specified parameter set.
 
- Public Member Functions inherited from iprm::ISelectionParam
virtual const IOptionsListGetSelectionConstraints () const =0
 Get constraints of this parameter.
 
virtual int GetSelectedOptionIndex () const =0
 Get selected index.
 
virtual bool SetSelectedOptionIndex (int index)=0
 Set index of selected option.
 
virtual ISelectionParamGetSubselection (int index) const =0
 Get sub-selection for specified option.
 
- Public Member Functions inherited from iser::ISerializable
virtual bool Serialize (IArchive &archive)=0
 Load or store state of this object as a archive stream.
 
virtual quint32 GetMinimalVersion (int versionId) const
 Get minimal needed version to correct storing of this data.
 
- Public Member Functions inherited from istd::IChangeable
virtual int GetSupportedOperations () const
 Get set of flags for supported operations.
 
virtual bool CopyFrom (const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS)
 Copy this object from another one.
 
virtual bool IsEqual (const IChangeable &object) const
 Compare this object with another object.
 
virtual istd::TUniqueInterfacePtr< istd::IChangeableCloneMe (CompatibilityMode mode=CM_WITHOUT_REFS) const
 Make a copy of this object.
 
virtual bool ResetData (CompatibilityMode mode=CM_WITHOUT_REFS)
 Reset data to its default state.
 
virtual void BeginChanges (const ChangeSet &changeSet)
 Starts the change transaction.
 
virtual void EndChanges (const ChangeSet &changeSet)
 Ends the change transaction.
 
virtual void BeginChangeGroup (const ChangeSet &changeSet)
 Starts group of changes.
 
virtual void EndChangeGroup (const ChangeSet &changeSet)
 Ends group of changes.
 
- Public Member Functions inherited from istd::IPolymorphic
virtual ~IPolymorphic ()
 

Additional Inherited Members

- Static Public Member Functions inherited from istd::IChangeable
static const ChangeSetGetNoChanges ()
 Get empty set of changes.
 
static const ChangeSetGetAnyChange ()
 Get anonymous change set.
 
static const ChangeSetGetAllChanges ()
 Get anonymous change set.
 
static const ChangeSetGetDelegatedChanges ()
 Get delegated change set.
 
- Protected Member Functions inherited from istd::IChangeable
virtual void OnBeginChanges ()
 Callback function for begin change event.
 
virtual void OnEndChanges (const ChangeSet &changeSet)
 Callback function for end change event.
 

Detailed Description

Manager of parameter sets.

IParamsManager manages a collection of parameter sets (IParamsSet instances). It provides operations for creating, deleting, renaming, and organizing multiple parameter sets. The manager also acts as a selection parameter, allowing selection of the active parameter set.

The manager supports various operation modes controlled by flags:

Usage Example

// Assuming manager is obtained from a component
iprm::IParamsManager* manager = component->GetInterface<iprm::IParamsManager>("ParamsManager");
// Check capabilities
int flags = manager->GetIndexOperationFlags(-1);
bool canInsert = (flags & iprm::IParamsManager::MF_SUPPORT_INSERT) != 0;
bool canDelete = (flags & iprm::IParamsManager::MF_SUPPORT_DELETE) != 0;
bool canRename = (flags & iprm::IParamsManager::MF_SUPPORT_RENAME) != 0;
bool canSwap = (flags & iprm::IParamsManager::MF_SUPPORT_SWAP) != 0;
// Get current number of parameter sets
int count = manager->GetParamsSetsCount();
qDebug() << "Parameter sets:" << count;
// Insert a new parameter set
if (canInsert)
{
int newIndex = manager->InsertParamsSet();
if (newIndex >= 0)
{
manager->SetParamsSetName(newIndex, "New Configuration");
manager->SetParamsSetDescription(newIndex, "Custom settings");
}
}
// Iterate through all parameter sets
for (int i = 0; i < count; ++i)
{
QString name = manager->GetParamsSetName(i);
iprm::IParamsSet* paramsSet = manager->GetParamsSet(i);
// Work with the parameter set
iprm::IParamsSet::Ids ids = paramsSet->GetParamIds();
// ...
}
// Select active parameter set
int activeIndex = manager->GetSelectedOptionIndex();
// Remove a parameter set
if (canDelete)
{
manager->RemoveParamsSet(2);
}
// Swap two parameter sets
if (canSwap)
{
manager->SwapParamsSet(0, 1);
}
Manager of parameter sets.
virtual bool SetParamsSetName(int index, const QString &name)=0
Set name of specified parameter set.
virtual int GetIndexOperationFlags(int index=-1) const =0
Get operation control flags of some parameter set or whole manager.
virtual bool SwapParamsSet(int index1, int index2)=0
Swap two parameter sets.
virtual int InsertParamsSet(int typeIndex=-1, int index=-1)=0
Insert new parameter set at selected position.
virtual int GetParamsSetsCount() const =0
Get number of managed parameter sets.
virtual IParamsSet * GetParamsSet(int index) const =0
Get selected parameter set.
virtual void SetParamsSetDescription(int index, const QString &description)=0
Set the description of the specified parameter set.
virtual bool RemoveParamsSet(int index)=0
Remove parameter set at selected position.
virtual QString GetParamsSetName(int index) const =0
Get name of specified parameter set.
@ MF_SUPPORT_DELETE
Active if delete of parameters is possible.
@ MF_SUPPORT_INSERT
Active if insert of parameters is possible.
@ MF_SUPPORT_RENAME
Active if rename of parameters is supported.
@ MF_SUPPORT_SWAP
Active if swap of parameters with the other one is possible.
Set of general parameters.
Definition IParamsSet.h:81
virtual Ids GetParamIds(bool editableOnly=false) const =0
Get list of used parameter IDs in the parameter set.
QSet< QByteArray > Ids
Definition IParamsSet.h:83
virtual int GetSelectedOptionIndex() const =0
Get selected index.
virtual bool SetSelectedOptionIndex(int index)=0
Set index of selected option.
Note
The manager inherits from ISelectionParam, allowing selection of active parameter set.
Always check operation flags before attempting modifications.
See also
IParamsSet, ISelectionParam, IOptionsList

Definition at line 95 of file IParamsManager.h.

Member Typedef Documentation

◆ TypeIds

typedef QSet<QByteArray> iprm::IParamsManager::TypeIds

Definition at line 98 of file IParamsManager.h.

Member Enumeration Documentation

◆ ChangeFlags

Possible changes of the manager's data model.

These change flags are used with the change notification system to indicate what type of modification occurred in the parameter manager.

See also
istd::IChangeable::ChangeSet
Enumerator
CF_SET_INSERTED 

A parameter set was inserted.

CF_SET_REMOVED 

A parameter set was removed.

CF_SET_NAME_CHANGED 

A parameter set name was changed.

CF_SET_ENABLE_CHANGED 

A parameter set enable state was changed.

Definition at line 167 of file IParamsManager.h.

◆ ParamsOperationFlags

Bitwise coded flags used to find out supported features.

These flags indicate what operations are supported by the parameter manager or individual parameter sets. Use GetIndexOperationFlags() to retrieve these flags.

See also
GetIndexOperationFlags, SetIndexOperationFlags
Enumerator
MF_COUNT_FIXED 

Active if number of parameters is fixed.

When set, insert and delete operations are not allowed.

MF_SUPPORT_RENAME 

Active if rename of parameters is supported.

When set, SetParamsSetName() can be used to rename parameter sets.

MF_SUPPORT_INSERT 

Active if insert of parameters is possible.

When set, InsertParamsSet() can add new parameter sets.

MF_SUPPORT_DELETE 

Active if delete of parameters is possible.

When set, RemoveParamsSet() can delete parameter sets.

MF_SUPPORT_SWAP 

Active if swap of parameters with the other one is possible.

When set, SwapParamsSet() can reorder parameter sets.

MF_DISABLE_ALLOWED 

Active if it is possible to get the disabled option.

When set, parameter sets can be in disabled state.

MF_SUPPORT_EDIT 

Active if it is possible to edit parameter values.

When set, parameters within the set can be modified.

MF_INACTIVE 

Option is inactive (i.e., cannot be activated or selected).

When set, the parameter set cannot be selected as active.

Definition at line 108 of file IParamsManager.h.

Member Function Documentation

◆ CreateParameterSet()

virtual iprm::IParamsSetUniquePtr iprm::IParamsManager::CreateParameterSet ( int  typeIndex = -1,
int  index = -1 
) const
pure virtual

Create a new parameter set instance.

Creates a new, independent parameter set instance. Optionally, data from an existing parameter set can be copied to the new instance.

Parameters
typeIndexIndex of parameter type from GetParamsTypeConstraints().
  • Negative value: Type will be automatically selected (default).
  • Zero or positive: Use specified type index.
indexIf non-negative, the parameter set data at the given position will be copied to the created instance.
Returns
Unique pointer to the newly created parameter set.
Note
The caller is responsible for the memory management of the created parameter set.
The returned parameter set is independent and not managed by this manager.
// Create a new empty parameter set
iprm::IParamsSetUniquePtr newSet = manager->CreateParameterSet();
// Create a copy of existing parameter set
iprm::IParamsSetUniquePtr copy = manager->CreateParameterSet(-1, 0);
// Create a new parameter set of specific type
const iprm::IOptionsList* types = manager->GetParamsTypeConstraints();
if (types && types->GetOptionsCount() > 1)
{
iprm::IParamsSetUniquePtr typedSet = manager->CreateParameterSet(1);
}
Constraints of selection from set of possibilities.
virtual int GetOptionsCount() const =0
Get number of managed options.
Unique ownership smart pointer for interface types.
See also
GetParamsTypeConstraints

Implemented in iprm::CParamsManagerCompBase.

◆ GetIndexOperationFlags()

virtual int iprm::IParamsManager::GetIndexOperationFlags ( int  index = -1) const
pure virtual

Get operation control flags of some parameter set or whole manager.

This method returns flags indicating which operations are supported, either for the entire manager (index < 0) or for a specific parameter set.

Parameters
indexIndex addressing position in parameter set list.
  • Negative value: Returns general manager-level flags.
  • Zero or positive: Returns flags for specific parameter set at that position.
  • Value equal to count: Returns flags for potential insert at end position.
Returns
Bitwise OR combination of ParamsOperationFlags values.
// Check general manager capabilities
int managerFlags = manager->GetIndexOperationFlags(-1);
{
qDebug() << "Can insert new parameter sets";
}
// Check if first parameter set can be renamed
int firstSetFlags = manager->GetIndexOperationFlags(0);
{
manager->SetParamsSetName(0, "New Name");
}
// Check if we can insert at the end
int count = manager->GetParamsSetsCount();
int insertFlags = manager->GetIndexOperationFlags(count);
{
manager->InsertParamsSet(-1, count);
}
See also
ParamsOperationFlags, SetIndexOperationFlags

Implemented in iprm::CParamsManagerCompBase.

◆ GetParamsSet()

virtual IParamsSet * iprm::IParamsManager::GetParamsSet ( int  index) const
pure virtual

Get selected parameter set.

Retrieves the parameter set at the specified index.

Parameters
indexIndex of the parameter set (0-based).
Returns
Pointer to the parameter set, or NULL if index is out of range.
Note
The returned pointer is owned by the manager. Do not delete it.
int count = manager->GetParamsSetsCount();
for (int i = 0; i < count; ++i)
{
iprm::IParamsSet* paramSet = manager->GetParamsSet(i);
if (paramSet)
{
// Access parameters in the set
for (const QByteArray& id : ids)
{
const iser::ISerializable* param = paramSet->GetParameter(id);
// Process parameter...
}
}
}
virtual const iser::ISerializable * GetParameter(const QByteArray &id) const =0
Get any parameter (read-only access).
Common class for all classes which objects can be archived or restored from archive.
See also
GetParamsSetsCount, IParamsSet

Implemented in iprm::CParamsManagerCompBase.

◆ GetParamsSetDescription()

virtual QString iprm::IParamsManager::GetParamsSetDescription ( int  index) const
pure virtual

Get the description of the specified parameter set.

Parameters
indexIndex of the parameter set (0-based).
Returns
Description of the parameter set as QString.
QString description = manager->GetParamsSetDescription(0);
qDebug() << "Description:" << description;
See also
SetParamsSetDescription

Implemented in iprm::CParamsManagerCompBase.

◆ GetParamsSetName()

virtual QString iprm::IParamsManager::GetParamsSetName ( int  index) const
pure virtual

Get name of specified parameter set.

Parameters
indexIndex of the parameter set (0-based).
Returns
Name of the parameter set as QString.
int count = manager->GetParamsSetsCount();
for (int i = 0; i < count; ++i)
{
QString name = manager->GetParamsSetName(i);
qDebug() << "Set" << i << ":" << name;
}
See also
SetParamsSetName

Implemented in iprm::CParamsManagerCompBase.

◆ GetParamsSetsCount()

virtual int iprm::IParamsManager::GetParamsSetsCount ( ) const
pure virtual

Get number of managed parameter sets.

Returns
The count of parameter sets currently managed by this manager.
int count = manager->GetParamsSetsCount();
qDebug() << "Managing" << count << "parameter sets";

Implemented in iprm::CParamsManagerCompBase.

◆ GetParamsTypeConstraints()

virtual const IOptionsList * iprm::IParamsManager::GetParamsTypeConstraints ( ) const
pure virtual

Get selection constraints describing each supported type.

Returns an options list that describes the different types of parameter sets that can be created. This is used when inserting new parameter sets to determine available types.

Returns
Pointer to IOptionsList describing available types, or NULL if only one anonymous type is supported.
const iprm::IOptionsList* types = manager->GetParamsTypeConstraints();
if (types)
{
int typeCount = types->GetOptionsCount();
for (int i = 0; i < typeCount; ++i)
{
QString typeName = types->GetOptionName(i);
QByteArray typeId = types->GetOptionId(i);
qDebug() << "Type" << i << ":" << typeName;
}
}
virtual QByteArray GetOptionId(int index) const =0
Get option ID.
virtual QString GetOptionName(int index) const =0
Get name of specified option.
See also
InsertParamsSet

Implemented in iprm::CMultiParamsManagerComp, and iprm::CParamsManagerComp.

◆ InsertParamsSet()

virtual int iprm::IParamsManager::InsertParamsSet ( int  typeIndex = -1,
int  index = -1 
)
pure virtual

Insert new parameter set at selected position.

Creates and inserts a new parameter set into the manager. The type and position can be specified, or automatic selection can be used.

Parameters
typeIndexIndex of parameter type from GetParamsTypeConstraints().
  • Negative value: Type will be automatically selected (default).
  • Zero or positive: Use specified type index.
indexPosition in list where parameter set should be inserted.
  • Negative value: Use default position (typically at end).
  • Zero or positive: Insert at specified position.
Returns
Position of the newly inserted parameter set, or negative value if insertion was not possible.
Note
For specified index positions (non-negative index), returns the same index on success or negative value on failure.
Check MF_SUPPORT_INSERT flag before calling.
// Insert at default position with automatic type selection
int newIndex = manager->InsertParamsSet();
if (newIndex >= 0)
{
qDebug() << "Inserted at index" << newIndex;
manager->SetParamsSetName(newIndex, "New Set");
}
// Insert at specific position with specific type
const iprm::IOptionsList* types = manager->GetParamsTypeConstraints();
if (types && types->GetOptionsCount() > 1)
{
int typeIdx = 1;
int position = 2;
int inserted = manager->InsertParamsSet(typeIdx, position);
}
See also
GetParamsTypeConstraints, RemoveParamsSet, MF_SUPPORT_INSERT

Implemented in iprm::CParamsManagerCompBase.

◆ RemoveParamsSet()

virtual bool iprm::IParamsManager::RemoveParamsSet ( int  index)
pure virtual

Remove parameter set at selected position.

Deletes the parameter set at the specified index.

Parameters
indexPosition of the parameter set to remove (0-based).
Returns
true if removal succeeded, false otherwise.
Note
Check MF_SUPPORT_DELETE flag before calling.
int flags = manager->GetIndexOperationFlags(-1);
{
bool removed = manager->RemoveParamsSet(2);
if (removed)
{
qDebug() << "Parameter set removed successfully";
}
}
See also
InsertParamsSet, MF_SUPPORT_DELETE

Implemented in iprm::CParamsManagerCompBase.

◆ SetIndexOperationFlags()

virtual bool iprm::IParamsManager::SetIndexOperationFlags ( int  index,
int  flags 
)
pure virtual

Set operation control flags of some parameter-set.

Sets operation flags for a specific parameter set. Only flags related to a single parameter set can be modified (not manager-level flags).

Parameters
flagsOperation flags to be used (combination of ParamsOperationFlags).
indexIndex addressing position in parameter set list.
Returns
true if the operation succeeded, false otherwise.
Note
This method can only set per-set flags, not manager-level flags.
// Try to make a parameter set editable
bool success = manager->SetIndexOperationFlags(0,
@ MF_SUPPORT_EDIT
Active if it is possible to edit parameter values.
See also
ParamsOperationFlags, GetIndexOperationFlags

Implemented in iprm::CParamsManagerCompBase.

◆ SetParamsSetDescription()

virtual void iprm::IParamsManager::SetParamsSetDescription ( int  index,
const QString &  description 
)
pure virtual

Set the description of the specified parameter set.

Changes the description/tooltip text for a parameter set.

Parameters
indexIndex of the parameter set (0-based).
descriptionNew description text for the parameter set.
manager->SetParamsSetDescription(0, "This set contains advanced options");
See also
GetParamsSetDescription

Implemented in iprm::CParamsManagerCompBase.

◆ SetParamsSetName()

virtual bool iprm::IParamsManager::SetParamsSetName ( int  index,
const QString &  name 
)
pure virtual

Set name of specified parameter set.

Changes the display name of a parameter set.

Parameters
indexIndex of the parameter set (0-based).
nameNew name for the parameter set.
Returns
true if name was changed successfully, false otherwise.
Note
Check MF_SUPPORT_RENAME flag before calling.
int flags = manager->GetIndexOperationFlags(0);
{
bool renamed = manager->SetParamsSetName(0, "Updated Name");
if (renamed)
{
qDebug() << "Name changed successfully";
}
}
See also
GetParamsSetName, MF_SUPPORT_RENAME

Implemented in iprm::CParamsManagerCompBase.

◆ SwapParamsSet()

virtual bool iprm::IParamsManager::SwapParamsSet ( int  index1,
int  index2 
)
pure virtual

Swap two parameter sets.

Exchanges the positions of two parameter sets in the manager's list.

Parameters
index1Index of first parameter set.
index2Index of second parameter set.
Returns
true if swap succeeded, false otherwise.
Note
Check MF_SUPPORT_SWAP flag before calling.
// Swap first and third parameter sets
int flags = manager->GetIndexOperationFlags(-1);
{
bool swapped = manager->SwapParamsSet(0, 2);
if (swapped)
{
qDebug() << "Parameter sets swapped";
}
}
See also
MF_SUPPORT_SWAP

Implemented in iprm::CParamsManagerCompBase.


The documentation for this class was generated from the following file: