ACF $AcfVersion:0$
Classes | Typedefs | Functions
iprm Namespace Reference

Contains interfaces and implementations of flexible parameter concept. More...

Classes

class  CComposedParamsSetComp
 Implementation of interface IParamsSet as component. More...
 
class  CDelegatedEnableableParamComp
 
class  CEnableableParam
 Basic implementation of IEnableableParam interface. More...
 
class  CEnableableParamComp
 
class  CFilteredOptionsListComp
 Implementation of an option list filter. More...
 
class  CIdParam
 Implementation of a named object over iprm::INameParam interface. More...
 
class  CIdParamComp
 Component for automatic creation of the Universally Unique Identifier (UUID) More...
 
class  CManagerParamsSetShadowerComp
 Keep parameter set with selected one synchronized. More...
 
class  CMultiParamsManagerComp
 Implementation of parameter manager. More...
 
class  CNameParam
 Implementation of a named object over iprm::INameParam interface. More...
 
class  CNameParamComp
 Component for automatic creation of the Universally Unique Identifier (UUID) More...
 
class  COptionsManager
 Implementation of a simple options manager. More...
 
class  COptionsManagerComp
 Implementation of selection constraints. More...
 
class  CParameterStateProviderComp
 Component implementation of iprm::IParameterStateProvider interface. More...
 
class  CParamsManagerComp
 Implementation of parameter manager. More...
 
class  CParamsManagerCompBase
 Implementation of parameter manager. More...
 
class  CParamsManagerCompBaseAttr
 
class  CParamsSet
 Basic implementation of interface IParamsSet. More...
 
class  CParamsSetDelegatorComp
 Delegator of the parameter set interface. More...
 
class  CSelectableParamsSetComp
 Interface allowing to select single option from list of options. More...
 
class  CSelectionBasedParameterStateProviderComp
 Component implementation of iprm::IParameterStateProvider interface. More...
 
class  CSelectionConstraintsComp
 Implementation of selection constraints. More...
 
class  CSelectionParam
 Basic implementation of selection parameter. More...
 
class  CSelectionParamComp
 Component level implementation of selection parameter. More...
 
class  CTextParam
 Implementation of the text value over iprm::ITextParam interface. More...
 
class  CTextParamComp
 Component for automatic creation of the Universally Unique Identifier (UUID) More...
 
class  CVariableParamComp
 
class  IEnableableParam
 Interface for objects which can be enabled/disabled. More...
 
class  IIdParam
 Interface for an ID parameter. More...
 
class  INameParam
 Interface for an object containing a name. More...
 
class  IOptionsList
 Constraints of selection from set of possibilities. More...
 
class  IOptionsManager
 Common interface for the management of dynamic selection constraints. More...
 
class  IParameterStateProvider
 Provider of state information for a parameter inside a parameter set. More...
 
class  IParamsInfoProvider
 Provider of parameter information (name and description). More...
 
class  IParamsManager
 Manager of parameter sets. More...
 
class  IParamsSet
 Set of general parameters. More...
 
class  IParamsSetValidator
 Interface for consistency checking of a parameter set. More...
 
class  ISelectionParam
 Interface allowing to select single option from list of options. More...
 
class  ITextParam
 Interface for an object containing simple text. More...
 
class  IVariableParam
 Represents a parameter which can change its type. More...
 
class  TEditableParamsPtr
 
class  TParamsPtr
 
class  TParamsPtrBase
 Help pointer wrapper for management of a parameter from the parameter set. More...
 

Typedefs

typedef istd::TUniqueInterfacePtr< IParamsManagerIParamsManagerUniquePtr
 
typedef istd::TSharedInterfacePtr< IParamsManagerIParamsManagerSharedPtr
 
typedef istd::TUniqueInterfacePtr< iprm::IParamsSetIParamsSetUniquePtr
 
typedef istd::TSharedInterfacePtr< iprm::IParamsSetIParamsSetSharedPtr
 

Functions

int FindOptionIndexById (const QByteArray &id, const iprm::IOptionsList &list)
 Find the option index by the given ID.
 

Detailed Description

Contains interfaces and implementations of flexible parameter concept.

The iprm namespace provides a comprehensive parameter management framework that enables applications to create, manage, and manipulate structured parameter collections with support for various parameter types, validation, serialization, and change notification.

Overview

The iprm library is designed to handle complex parameter management scenarios in applications that require:

Core Concepts

Parameters

Individual parameter types in the iprm library:

All parameters implement iser::ISerializable for persistence.

Parameter Sets

IParamsSet** is a container that groups related parameters together. Each parameter in a set is identified by a unique QByteArray ID. Parameter sets distinguish between:

Parameter Manager

IParamsManager** manages multiple parameter sets and provides:

Options and Constraints

Selection parameters are constrained by option lists:

Options can be:

Usage Patterns

Simple Parameter Usage

// Create a text parameter
param.SetText("Hello");
QString value = param.GetText();
Implementation of the text value over iprm::ITextParam interface.
Definition CTextParam.h:17
virtual void SetText(const QString &text) override
Set the text value.
virtual QString GetText() const override
Get the text value.

Selection Parameter Usage

// Create options and selection
options.InsertOption("Option A", "opt_a", "First option");
options.InsertOption("Option B", "opt_b", "Second option");
selection.SetSelectionConstraints(&options);
Implementation of a simple options manager.
virtual bool InsertOption(const QString &optionName, const QByteArray &optionId, const QString &optionDescription=QString(), int index=-1) override
Insert an option at some position.
Basic implementation of selection parameter.
virtual bool SetSelectedOptionIndex(int index) override
Set index of selected option.
void SetSelectionConstraints(const IOptionsList *constraintsPtr)
Set selection constraints for this selection object.

Parameter Manager Usage

// Work with parameter manager
// Check capabilities
int flags = manager->GetIndexOperationFlags(-1);
{
// Insert new parameter set
int index = manager->InsertParamsSet();
manager->SetParamsSetName(index, "My Parameters");
}
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 int InsertParamsSet(int typeIndex=-1, int index=-1)=0
Insert new parameter set at selected position.
@ MF_SUPPORT_INSERT
Active if insert of parameters is possible.

Serialization

All parameter types support serialization through the iser framework:

iser::CMemoryWriteArchive writeArchive(nullptr);
param.Serialize(writeArchive); // Save
iser::CMemoryReadArchive readArchive(writeArchive);
param.Serialize(readArchive); // Load
virtual bool Serialize(iser::IArchive &archive) override
Load or store state of this object as a archive stream.
Implementation of archive using memory buffer to read the persistent objects.
Implementation of archive using memory buffer to store the persistent objects.

Change Notification

Parameters support the observer pattern through the istd::IChangeable interface. Each parameter type defines ChangeFlags to identify specific changes:

// ISelectionParam::CF_SELECTION_CHANGED
// INameParam::CF_RENAME
// IEnableableParam::CF_ENABLED
// IParamsManager::CF_SET_INSERTED, CF_SET_REMOVED, etc.

Validation

Parameter sets can be validated using IParamsSetValidator:

bool isValid = validator->IsParamsSetConsistent(
"contextId",
paramSet,
&messageConsumer);
Interface for consistency checking of a parameter set.
virtual bool IsParamsSetConsistent(const QByteArray &validationContextId, const IParamsSet &paramsSet, ilog::IMessageConsumer *validationMessagesConsumerPtr=NULL) const =0
Return true if the parameter set is consistent, false otherwise.

Best Practices

  1. Always check operation flags before attempting operations
  2. Use smart pointers (TUniqueInterfacePtr, TSharedInterfacePtr) for memory management
  3. Validate parameter sets before persisting or processing
  4. Use option IDs rather than indices for stable selection references
  5. Implement observers for reactive parameter updates
  6. Clone parameters when you need independent copies

Main Classes

Interfaces:**

Typedef Documentation

◆ IParamsManagerSharedPtr

Definition at line 523 of file IParamsManager.h.

◆ IParamsManagerUniquePtr

Definition at line 522 of file IParamsManager.h.

◆ IParamsSetSharedPtr

Definition at line 207 of file IParamsSet.h.

◆ IParamsSetUniquePtr

Definition at line 206 of file IParamsSet.h.

Function Documentation

◆ FindOptionIndexById()

int iprm::FindOptionIndexById ( const QByteArray &  id,
const iprm::IOptionsList list 
)

Find the option index by the given ID.

Searches through the options list to find an option with a matching ID. This is useful for converting stable option IDs to current indices.

Parameters
idID to search for.
listOptions list to search in.
Returns
Found index (0-based), or -1 if no option with the given ID was found.
// Save option ID for later reference
QByteArray savedId = options->GetOptionId(selectedIndex);
// ... later, after options might have been reordered ...
// Find the option again by its stable ID
int currentIndex = iprm::FindOptionIndexById(savedId, *options);
if (currentIndex >= 0)
{
qDebug() << "Option found at index:" << currentIndex;
selectionParam.SetSelectedOptionIndex(currentIndex);
}
else
{
qDebug() << "Option no longer exists";
}
int FindOptionIndexById(const QByteArray &id, const iprm::IOptionsList &list)
Find the option index by the given ID.
See also
IOptionsList::GetOptionId