OSFI-C++
3.10.0
OpenSF Integration Library
|
#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::TimeValue > | getVectorTime () const |
DynamicArray< double > | getMatrixDouble () const |
DynamicArray< int > | getMatrixInt () const |
DynamicArray< string > | getMatrixString () const |
DynamicArray< string > | getMatrixFile () const |
DynamicArray< bool > | getMatrixBoolean () const |
DynamicArray< osfi::confm::TimeValue > | getMatrixTime () 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 ArrayNode & | getRootNode () const |
const ArrayNode & | getNode (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::TimeValue > | getVectorTime (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 |
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.
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.
Parameter::Parameter | ( | string | aName, |
string | aDescription, | ||
string | aType, | ||
ArrayNode | root, | ||
string | aUnits, | ||
string | aMin, | ||
string | aMax, | ||
vector< int > | dims | ||
) |
Constructor for ARRAY-type parameters.
aName | Full path, including parent groups. |
aDescription | Optional description. |
aType | Type. One of the names from ElementType |
root | Value, as a tree structure containing unparsed values. |
aUnits | Units. Blank or "-" for unitless parameters. |
aMin | Minimum valid value, may be empty. |
aMax | Maximum valid value, may be empty. |
dims | Dimensions of the parameter. |
Parameter::Parameter | ( | string | aName, |
string | aDescription, | ||
string | aType, | ||
string | aValue | ||
) |
Minimal constructor, for use with scalar values.
aName | Full path, including parent groups. |
aDescription | Optional description. |
aType | Type. One of the names from ElementType |
aValue | Value as read from the XML. |
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.
aName | Full path, including parent groups. |
aDescription | Description. |
aType | Type. One of the names from ElementType |
aValue | Value as read from the XML. |
aUnits | Units. Blank or "-" for unitless parameters. |
aMin | Minimum valid value, may be empty. |
aMax | Maximum valid value, may be empty. |
dims | Dimensions sizes, empty for a scalar. |
Parameter::Parameter | ( | string | aName, |
string | aMin, | ||
string | aMax | ||
) |
"Range" Constructor. Creates a parameter instance defining only its name and values range.
aName | Name. |
aMin | Minimum valid value. |
aMax | Maximum value value. |
Parameter::Parameter | ( | ) |
Constructor for a "dummy" parameter with an empty name.
DynamicArray<bool> Parameter::fileExist | ( | ) | const |
Checks the existence of the files specified within a FILE parameter.
Not valid for ARRAY parameters.
bool Parameter::getBooleanValue | ( | ) | const |
Parse the parameter value. Throws on parsing errors.
string Parameter::getDescription | ( | ) | const |
const vector<int>& Parameter::getDims | ( | ) | const |
[nCol,nRow] int Parameter::getDims | ( | const vector< int > & | indexs | ) | const |
Equivalent to calling ArrayNode::getDims() on the result of getNode()
double Parameter::getDoubleValue | ( | ) | const |
Parse the parameter value. Throws on parsing errors.
ElementType Parameter::getElementType | ( | ) | const |
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.
int Parameter::getIntValue | ( | ) | const |
Parse the parameter value. Throws on parsing errors.
string Parameter::getLocalName | ( | ) | const |
DynamicArray<bool> Parameter::getMatrixBoolean | ( | ) | const |
Parse the parameter value. Logs and returns an empty matrix on parsing errors.
DynamicArray<double> Parameter::getMatrixDouble | ( | ) | const |
Parse the parameter value. Logs and returns an empty matrix on parsing errors.
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.
DynamicArray<int> Parameter::getMatrixInt | ( | ) | const |
Parse the parameter value. Logs and returns an empty matrix on parsing errors.
DynamicArray<string> Parameter::getMatrixString | ( | ) | const |
Parse the parameter value. Logs and returns an empty matrix on parsing errors.
DynamicArray<osfi::confm::TimeValue> Parameter::getMatrixTime | ( | ) | const |
Gets the value of the parameter as a dynamic matrix of time code values.
string Parameter::getMax | ( | ) | const |
string Parameter::getMin | ( | ) | const |
int Parameter::getNdims | ( | ) | const |
const ArrayNode& Parameter::getNode | ( | const vector< int > & | indexs | ) | const |
std::out_of_range | for invalid indices, or if too many indices are given. |
string Parameter::getPath | ( | ) | const |
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.
const ArrayNode& Parameter::getRootNode | ( | ) | const |
If this parameter is of type ARRAY, returns the root node.
string Parameter::getStringValue | ( | ) | const |
Parse the parameter value, which is a no-op for string scalars.
osfi::confm::TimeValue Parameter::getTimeValue | ( | ) | const |
Parse the parameter value. Throws on parsing errors.
string Parameter::getType | ( | ) | const |
string Parameter::getUnits | ( | ) | const |
string Parameter::getValue | ( | ) |
vector<bool> Parameter::getVectorBoolean | ( | ) | const |
Parse the parameter value. Logs and returns an empty vector on parsing errors.
vector<bool> Parameter::getVectorBoolean | ( | const vector< int > & | indexs | ) | const |
Equivalent to calling ArrayNode::getVectorBoolean() on the result of getNode()
vector<double> Parameter::getVectorDouble | ( | ) | const |
Parse the parameter value. Logs and returns an empty vector on parsing errors.
vector<double> Parameter::getVectorDouble | ( | const vector< int > & | indexs | ) | const |
Equivalent to calling ArrayNode::getVectorDouble() on the result of getNode()
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.
vector<string> Parameter::getVectorFile | ( | const vector< int > & | indexs | ) | const |
Equivalent to calling ArrayNode::getVectorFile() on the result of getNode()
vector<int> Parameter::getVectorInt | ( | ) | const |
Parse the parameter value. Logs and returns an empty vector on parsing errors.
vector<int> Parameter::getVectorInt | ( | const vector< int > & | indexs | ) | const |
Equivalent to calling ArrayNode::getVectorInt() on the result of getNode()
vector<string> Parameter::getVectorString | ( | ) | const |
Parse the parameter value. Logs and returns an empty vector on parsing errors.
vector<string> Parameter::getVectorString | ( | const vector< int > & | indexs | ) | const |
Equivalent to calling ArrayNode::getVectorString() on the result of getNode()
vector<osfi::confm::TimeValue> Parameter::getVectorTime | ( | ) | const |
Parse the parameter value. Logs and returns an empty vector on parsing errors.
vector<osfi::confm::TimeValue> Parameter::getVectorTime | ( | const vector< int > & | indexs | ) | const |
Equivalent to calling ArrayNode::getVectorTime() on the result of getNode()
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.
bool Parameter::isLeaf | ( | const vector< int > & | indexs | ) | const |
Equivalent to calling ArrayNode::isLeaf() on the result of getNode()
Parameter::OSFI_DEPRECATED | ( | "Ambiguous | function, |
instead use getLocalName or getPath" | |||
) |
Parameter::OSFI_DEPRECATED | ( | "Superseded by getElementType and isArray" | ) |
void Parameter::print | ( | ) | const |
Prints a textual description of the parameter to the OSFI log.
void Parameter::setValue | ( | string | aValue | ) |
Sets the parameter value as a string. Useful only in non-ARRAY parameters.
aValue | Parameter value. |
|
static |
Character for delimiting parameter values and dimensions.
|
static |
Character for delimiting string and file parameter values.