API 4.4.1-2022-10-19-2c4045e59
For MATLAB, Python, Java, and C++ users
OpenSim::ValueArrayDictionary Class Reference

ValueArrayDictionary represents an associative array mapping from a string to an AbstractValueArray. More...

Public Member Functions

bool hasKey (const std::string &key) const
 Does a key-value pair corresponding to the given key currently exist ? More...
 
const AbstractValuegetValueForKey (const std::string &key) const
 Get the first entry of the array corresponding to the given key. More...
 
template<typename ValueType >
bool setValueForKey (const std::string &key, const ValueType &value)
 Set the value corresponding to a given key. More...
 
const AbstractValueArraygetValueArrayForKey (const std::string &key) const
 Get the array corresponding to a given key. More...
 
bool setValueArrayForKey (const std::string &key, const AbstractValueArray &abstractValueArray)
 Set the array corresponding to a given key. More...
 
AbstractValueArrayupdValueArrayForKey (const std::string &key)
 Get a writable reference to the array corresponding to a given key. More...
 
void removeValueForKey (const std::string &key)
 Remove a key and its associated array. More...
 
void removeValueArrayForKey (const std::string &key)
 Remove a key and its associated array. More...
 
std::vector< std::string > getKeys () const
 Get all the existing keys as a std::vector. More...
 
Dictionary::const_iterator getKeyValueBegin () const
 Get begin iterator to the associative array. More...
 
Dictionary::const_iterator getKeyValueEnd () const
 Get begin iterator to the associative array. More...
 
std::string getValueAsString (const std::string &key) const
 Get value corresponding to the given key as string. More...
 

Detailed Description

ValueArrayDictionary represents an associative array mapping from a string to an AbstractValueArray.


Member Typedef Documentation

◆ AbstractValue

using OpenSim::ValueArrayDictionary::AbstractValue = SimTK::AbstractValue

Member Function Documentation

◆ getKeys()

std::vector< std::string > OpenSim::ValueArrayDictionary::getKeys ( ) const
inline

◆ getKeyValueBegin()

Dictionary::const_iterator OpenSim::ValueArrayDictionary::getKeyValueBegin ( ) const
inline

Get begin iterator to the associative array.


◆ getKeyValueEnd()

Dictionary::const_iterator OpenSim::ValueArrayDictionary::getKeyValueEnd ( ) const
inline

Get begin iterator to the associative array.


◆ getValueArrayForKey()

const AbstractValueArray & OpenSim::ValueArrayDictionary::getValueArrayForKey ( const std::string &  key) const
inline

Get the array corresponding to a given key.


Exceptions
KeyNotFoundIf key is not found.

References hasKey().

Referenced by OpenSim::DataTable_< ETX, ETY >::appendRow(), and OpenSim::DataTable_< ETX, ETY >::validateDependentsMetaData().

◆ getValueAsString()

std::string OpenSim::ValueArrayDictionary::getValueAsString ( const std::string &  key) const
inline

Get value corresponding to the given key as string.

Exceptions
KeyNotFoundIf key is not found.

References hasKey().

◆ getValueForKey()

const AbstractValue & OpenSim::ValueArrayDictionary::getValueForKey ( const std::string &  key) const
inline

Get the first entry of the array corresponding to the given key.


Exceptions
KeyNotFoundIf key is not found.

References hasKey().

Referenced by OpenSim::DataTable_< ETX, ETY >::validateIndependentMetaData().

◆ hasKey()

bool OpenSim::ValueArrayDictionary::hasKey ( const std::string &  key) const
inline

◆ removeValueArrayForKey()

void OpenSim::ValueArrayDictionary::removeValueArrayForKey ( const std::string &  key)
inline

Remove a key and its associated array.


Referenced by OpenSim::DataTable_< ETX, ETY >::DataTable_().

◆ removeValueForKey()

void OpenSim::ValueArrayDictionary::removeValueForKey ( const std::string &  key)
inline

Remove a key and its associated array.


◆ setValueArrayForKey()

bool OpenSim::ValueArrayDictionary::setValueArrayForKey ( const std::string &  key,
const AbstractValueArray abstractValueArray 
)
inline

Set the array corresponding to a given key.

Value array is set only if the key does not already exist.

Return values
trueIf the value was set for the given key.
falseIf the value was not set because key already present.

References OpenSim::AbstractValueArray::clone().

◆ setValueForKey()

template<typename ValueType >
bool OpenSim::ValueArrayDictionary::setValueForKey ( const std::string &  key,
const ValueType &  value 
)
inline

Set the value corresponding to a given key.

Value is set only if the key does not already exist.

Return values
trueIf the value was set for the given key.
falseIf the value was not set because key already present.

References OpenSim::ValueArray< T >::upd().

Referenced by OpenSim::DelimFileAdapter< T >::extendRead().

◆ updValueArrayForKey()

AbstractValueArray & OpenSim::ValueArrayDictionary::updValueArrayForKey ( const std::string &  key)
inline

Get a writable reference to the array corresponding to a given key.

Exceptions
KeyNotFoundIf key is not found.

References hasKey().

Referenced by OpenSim::DataTable_< ETX, ETY >::DataTable_().


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