libRoadRunner C++ API  1.3
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | List of all members
rr::Dictionary Class Referenceabstract

This class is frozen, no new features A dictionary interface that objects can implement. These are automatically mapped to python dictionaries. More...

#include <Dictionary.h>

Inheritance diagram for rr::Dictionary:
rr::BasicDictionary rr::LoadSBMLOptions rr::SimulateOptions

Public Member Functions

virtual void setItem (const std::string &key, const rr::Variant &value)=0
 
virtual Variant getItem (const std::string &key) const =0
 
virtual bool hasKey (const std::string &key) const =0
 
virtual int deleteItem (const std::string &key)=0
 
virtual std::vector< std::string > getKeys () const =0
 
virtual ~Dictionary ()
 

Detailed Description

This class is frozen, no new features A dictionary interface that objects can implement. These are automatically mapped to python dictionaries.

Constructor & Destructor Documentation

virtual rr::Dictionary::~Dictionary ( )
inlinevirtual

Pure virtual interface, you should never have to delete an instance of this type directly.

Member Function Documentation

virtual int rr::Dictionary::deleteItem ( const std::string &  key)
pure virtual

remove a value

Implemented in rr::LoadSBMLOptions, and rr::BasicDictionary.

virtual Variant rr::Dictionary::getItem ( const std::string &  key) const
pure virtual

Get a value. Variants are POD. If the key does not exist, an std::exception will be thrown.

The Variant object has the assigment operator overloaded so it will automatically convert to any native C++ object. If the Variant can not be converted, it will raise an exception, i.e.

Dictionary* d = ...;
int a = d->getItem("someIntKey");
string s = d->getItem("someStrVal");
double val = d->getItem("someDoubleVal");

Implemented in rr::LoadSBMLOptions, and rr::BasicDictionary.

virtual std::vector<std::string> rr::Dictionary::getKeys ( ) const
pure virtual

list of keys in this object.

Implemented in rr::LoadSBMLOptions, and rr::BasicDictionary.

virtual bool rr::Dictionary::hasKey ( const std::string &  key) const
pure virtual

is there a key matching this name.

Implemented in rr::LoadSBMLOptions, and rr::BasicDictionary.

virtual void rr::Dictionary::setItem ( const std::string &  key,
const rr::Variant value 
)
pure virtual

Set the value for an arbitrary key.

The Variant object has a large number of creation operators so you only have to give the value as native C++ object i.e.

Dictionary*d = (...);
d->setItem("someIntKey", 1);
d->setItem("someStrKey", string("some string"));
d->setItem("someFloatVal, 0.123);

Implemented in rr::SimulateOptions, rr::LoadSBMLOptions, and rr::BasicDictionary.


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