OSFI-C++  3.10.0
OpenSF Integration Library
Parameter Class Referencefinal

#include <Parameter.h>

Public Types

using ElementType = osfi::confm::ElementType
 

Public Member Functions

 Parameter (string aName, string aDescription, string aType, ArrayNode root, string aUnits, string aMin, string aMax, vector< int > dims)
 
 Parameter (string aName, string aDescription, string aType, string aValue)
 
 Parameter (string aName, string aDescription, string aType, string aValue, string aUnits, string aMin, string aMax, vector< int > dims)
 
 Parameter (string aName, string aMin, string aMax)
 
 Parameter ()
 
void print () const
 
string getValue ()
 
string getRawValue () const
 
int getIntValue () const
 
double getDoubleValue () const
 
bool getBooleanValue () const
 
string getStringValue () const
 
osfi::confm::TimeValue getTimeValue () const
 
string getFileValue () const
 
vector< string > getVectorString () const
 
vector< string > getVectorFile () const
 
vector< double > getVectorDouble () const
 
vector< int > getVectorInt () const
 
vector< bool > getVectorBoolean () const
 
vector< osfi::confm::TimeValuegetVectorTime () const
 
DynamicArray< double > getMatrixDouble () const
 
DynamicArray< int > getMatrixInt () const
 
DynamicArray< string > getMatrixString () const
 
DynamicArray< string > getMatrixFile () const
 
DynamicArray< bool > getMatrixBoolean () const
 
DynamicArray< osfi::confm::TimeValuegetMatrixTime () const
 
DynamicArray< bool > fileExist () const
 
void setValue (string aValue)
 
int getNdims () const
 
const vector< int > & getDims () const
 
 OSFI_DEPRECATED ("Ambiguous function, instead use getLocalName or getPath") string getName()
 
string getLocalName () const
 
string getPath () const
 
string getDescription () const
 
string getUnits () const
 
string getMax () const
 
string getMin () const
 
string getType () const
 
 OSFI_DEPRECATED ("Superseded by getElementType and isArray") int getParamType()
 
ElementType getElementType () const
 
bool isArray () const
 
const ArrayNodegetRootNode () const
 
const ArrayNodegetNode (const vector< int > &indexs) const
 
vector< bool > getVectorBoolean (const vector< int > &indexs) const
 
vector< string > getVectorString (const vector< int > &indexs) const
 
vector< string > getVectorFile (const vector< int > &indexs) const
 
vector< double > getVectorDouble (const vector< int > &indexs) const
 
vector< int > getVectorInt (const vector< int > &indexs) const
 
vector< osfi::confm::TimeValuegetVectorTime (const vector< int > &indexs) const
 
int getDims (const vector< int > &indexs) const
 
bool isLeaf (const vector< int > &indexs) const
 

Static Public Attributes

static const string delimitier
 
static const string stringDelimitier
 

Detailed Description

This class encapsulates every element of information from the configuration file. A parameter is a self-describing element that couples a name and a value, describing its contents and adding syntactic and semantic constraints.

Member Typedef Documentation

◆ ElementType

Parameter types described in the E2E-ICD Issue 1 Rev 4.2 section 2.2.6.2. Note that only element types are included; ARRAY and MATRIX types are detected and their element type is parsed.

Constructor & Destructor Documentation

◆ Parameter() [1/5]

Parameter::Parameter ( string  aName,
string  aDescription,
string  aType,
ArrayNode  root,
string  aUnits,
string  aMin,
string  aMax,
vector< int >  dims 
)

Constructor for ARRAY-type parameters.

Parameters
aNameFull path, including parent groups.
aDescriptionOptional description.
aTypeType. One of the names from ElementType
rootValue, as a tree structure containing unparsed values.
aUnitsUnits. Blank or "-" for unitless parameters.
aMinMinimum valid value, may be empty.
aMaxMaximum valid value, may be empty.
dimsDimensions of the parameter.

◆ Parameter() [2/5]

Parameter::Parameter ( string  aName,
string  aDescription,
string  aType,
string  aValue 
)

Minimal constructor, for use with scalar values.

Parameters
aNameFull path, including parent groups.
aDescriptionOptional description.
aTypeType. One of the names from ElementType
aValueValue as read from the XML.

◆ Parameter() [3/5]

Parameter::Parameter ( string  aName,
string  aDescription,
string  aType,
string  aValue,
string  aUnits,
string  aMin,
string  aMax,
vector< int >  dims 
)

Complete constructor for non-ARRAY parameters.

Parameters
aNameFull path, including parent groups.
aDescriptionDescription.
aTypeType. One of the names from ElementType
aValueValue as read from the XML.
aUnitsUnits. Blank or "-" for unitless parameters.
aMinMinimum valid value, may be empty.
aMaxMaximum valid value, may be empty.
dimsDimensions sizes, empty for a scalar.

◆ Parameter() [4/5]

Parameter::Parameter ( string  aName,
string  aMin,
string  aMax 
)

"Range" Constructor. Creates a parameter instance defining only its name and values range.

Parameters
aNameName.
aMinMinimum valid value.
aMaxMaximum value value.

◆ Parameter() [5/5]

Parameter::Parameter ( )

Constructor for a "dummy" parameter with an empty name.

Member Function Documentation

◆ fileExist()

DynamicArray<bool> Parameter::fileExist ( ) const

Checks the existence of the files specified within a FILE parameter.

  • For a scalar, the returned value is a 1x1 matrix, with the result in item
    [0][0]
    .
  • For a vector, the returned value is a 1xN matrix, with the result in the first "row".

Not valid for ARRAY parameters.

Returns
A matrix with a boolean for each slot in this parameter. A true value indicates that the corresponding path is an existing file, while false means that either the path does not exist, or it is not a file.
See also
getMatrixFile()

◆ getBooleanValue()

bool Parameter::getBooleanValue ( ) const

Parse the parameter value. Throws on parsing errors.

Returns
Value as bool.

◆ getDescription()

string Parameter::getDescription ( ) const
Returns
a brief description of the parameter. Optional metadata, untouched by OSFI.

◆ getDims() [1/2]

const vector<int>& Parameter::getDims ( ) const
Returns
Vector with dimension sizes, may be empty for a scalar.
Note
As described in the E2E-ICD, matrix sizes are represented as [nCol,nRow]

◆ getDims() [2/2]

int Parameter::getDims ( const vector< int > &  indexs) const

Equivalent to calling ArrayNode::getDims() on the result of getNode()

◆ getDoubleValue()

double Parameter::getDoubleValue ( ) const

Parse the parameter value. Throws on parsing errors.

Returns
Value as double

◆ getElementType()

ElementType Parameter::getElementType ( ) const
Returns
the data type of the elements in this parameter

◆ getFileValue()

string Parameter::getFileValue ( ) const

Parse the parameter value. Throws on parsing errors. For files, if the path in the XML is relative, it is resolved according to the configured base directory, see osfi::confm::ElementType::FILE.

Returns
Parameter value as path to a file or folder.

◆ getIntValue()

int Parameter::getIntValue ( ) const

Parse the parameter value. Throws on parsing errors.

Returns
Parameter value as integer

◆ getLocalName()

string Parameter::getLocalName ( ) const
Returns
The "local" part of the parameter path, that is, the part after the last "."

◆ getMatrixBoolean()

DynamicArray<bool> Parameter::getMatrixBoolean ( ) const

Parse the parameter value. Logs and returns an empty matrix on parsing errors.

Returns
Value as matrix of booleans.

◆ getMatrixDouble()

DynamicArray<double> Parameter::getMatrixDouble ( ) const

Parse the parameter value. Logs and returns an empty matrix on parsing errors.

Returns
Value as matrix of doubles.

◆ getMatrixFile()

DynamicArray<string> Parameter::getMatrixFile ( ) const

Parse the parameter value. Logs and returns an empty matrix on parsing errors. For files, if the paths in the XML are relative, they are resolved according to the configured base directory, see osfi::confm::ElementType::FILE.

Returns
Value as matrix of file names.

◆ getMatrixInt()

DynamicArray<int> Parameter::getMatrixInt ( ) const

Parse the parameter value. Logs and returns an empty matrix on parsing errors.

Returns
Value as matrix of integers.

◆ getMatrixString()

DynamicArray<string> Parameter::getMatrixString ( ) const

Parse the parameter value. Logs and returns an empty matrix on parsing errors.

Returns
Value as matrix of strings.

◆ getMatrixTime()

DynamicArray<osfi::confm::TimeValue> Parameter::getMatrixTime ( ) const

Gets the value of the parameter as a dynamic matrix of time code values.

Returns
Value as matrix of time codes.

◆ getMax()

string Parameter::getMax ( ) const
Returns
Maximum value (unparsed). Optional metadata, untouched by OSFI.

◆ getMin()

string Parameter::getMin ( ) const
Returns
Minimum value (unparsed). Optional metadata, untouched by OSFI.

◆ getNdims()

int Parameter::getNdims ( ) const
Returns
Number of dimensions, may be 0 for a scalar.

◆ getNode()

const ArrayNode& Parameter::getNode ( const vector< int > &  indexs) const
Returns
the node at the given indices, akin to repeatedly applying ArrayNode::getChild()
Exceptions
std::out_of_rangefor invalid indices, or if too many indices are given.

◆ getPath()

string Parameter::getPath ( ) const
Returns
The full path of the parameter, including parent groups.

◆ getRawValue()

string Parameter::getRawValue ( ) const

Returns the unparsed parameter value as a string. For ARRAY parameters the tree is first flattened and then the elements are joined with commas.

◆ getRootNode()

const ArrayNode& Parameter::getRootNode ( ) const

If this parameter is of type ARRAY, returns the root node.

◆ getStringValue()

string Parameter::getStringValue ( ) const

Parse the parameter value, which is a no-op for string scalars.

Returns
Parameter value as a string.

◆ getTimeValue()

osfi::confm::TimeValue Parameter::getTimeValue ( ) const

Parse the parameter value. Throws on parsing errors.

Returns
Parameter value as a time code.

◆ getType()

string Parameter::getType ( ) const
Returns
Type of the parameter, as a string

◆ getUnits()

string Parameter::getUnits ( ) const
Returns
units of measurement for the parameter. Optional metadata, untouched by OSFI.

◆ getValue()

string Parameter::getValue ( )

Gets the parameter value as a string.

Returns
Parameter value.
Deprecated:
Use getRawValue instead.

◆ getVectorBoolean() [1/2]

vector<bool> Parameter::getVectorBoolean ( ) const

Parse the parameter value. Logs and returns an empty vector on parsing errors.

Returns
Parameter value as a vector of booleans.

◆ getVectorBoolean() [2/2]

vector<bool> Parameter::getVectorBoolean ( const vector< int > &  indexs) const

Equivalent to calling ArrayNode::getVectorBoolean() on the result of getNode()

◆ getVectorDouble() [1/2]

vector<double> Parameter::getVectorDouble ( ) const

Parse the parameter value. Logs and returns an empty vector on parsing errors.

Returns
Value as vector of doubles.

◆ getVectorDouble() [2/2]

vector<double> Parameter::getVectorDouble ( const vector< int > &  indexs) const

Equivalent to calling ArrayNode::getVectorDouble() on the result of getNode()

◆ getVectorFile() [1/2]

vector<string> Parameter::getVectorFile ( ) const

Parse the parameter value. Logs and returns an empty vector on parsing errors. For files, if the paths in the XML are relative, they are resolved according to the configured base directory, see osfi::confm::ElementType::FILE.

Returns
Parameter value as a vector of file names.

◆ getVectorFile() [2/2]

vector<string> Parameter::getVectorFile ( const vector< int > &  indexs) const

Equivalent to calling ArrayNode::getVectorFile() on the result of getNode()

◆ getVectorInt() [1/2]

vector<int> Parameter::getVectorInt ( ) const

Parse the parameter value. Logs and returns an empty vector on parsing errors.

Returns
Value as vector of integers.

◆ getVectorInt() [2/2]

vector<int> Parameter::getVectorInt ( const vector< int > &  indexs) const

Equivalent to calling ArrayNode::getVectorInt() on the result of getNode()

◆ getVectorString() [1/2]

vector<string> Parameter::getVectorString ( ) const

Parse the parameter value. Logs and returns an empty vector on parsing errors.

Returns
Parameter value as a vector of strings.

◆ getVectorString() [2/2]

vector<string> Parameter::getVectorString ( const vector< int > &  indexs) const

Equivalent to calling ArrayNode::getVectorString() on the result of getNode()

◆ getVectorTime() [1/2]

vector<osfi::confm::TimeValue> Parameter::getVectorTime ( ) const

Parse the parameter value. Logs and returns an empty vector on parsing errors.

Returns
Parameter value as a vector of time codes.

◆ getVectorTime() [2/2]

vector<osfi::confm::TimeValue> Parameter::getVectorTime ( const vector< int > &  indexs) const

Equivalent to calling ArrayNode::getVectorTime() on the result of getNode()

◆ isArray()

bool Parameter::isArray ( ) const

Returns true if this parameter is of type ARRAY, and thus user code should call getNode and/or the getX(indices) family of functions to access the data.

◆ isLeaf()

bool Parameter::isLeaf ( const vector< int > &  indexs) const

Equivalent to calling ArrayNode::isLeaf() on the result of getNode()

◆ OSFI_DEPRECATED() [1/2]

Parameter::OSFI_DEPRECATED ( "Ambiguous  function,
instead use getLocalName or getPath  
)
Returns
string with the parameter full path.
Deprecated:
Ambiguous function, instead use getLocalName or getPath

◆ OSFI_DEPRECATED() [2/2]

Parameter::OSFI_DEPRECATED ( "Superseded by getElementType and isArray )
Returns
Integer representing with the type of the parameter.
Deprecated:
Use getElementType() instead for the data type, and isArray() to know whether this is an ARRAY and thus the user should call getNode/getVectorX(indices) to access the data.

◆ print()

void Parameter::print ( ) const

Prints a textual description of the parameter to the OSFI log.

◆ setValue()

void Parameter::setValue ( string  aValue)

Sets the parameter value as a string. Useful only in non-ARRAY parameters.

Parameters
aValueParameter value.

Member Data Documentation

◆ delimitier

const string Parameter::delimitier
static

Character for delimiting parameter values and dimensions.

◆ stringDelimitier

const string Parameter::stringDelimitier
static

Character for delimiting string and file parameter values.


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