MineLink
 All Data Structures Functions Variables Pages
delphos::Dict Class Reference

Abstact a dictionary to store and get attributes. More...

#include <dict.h>

Inheritance diagram for delphos::Dict:
Inheritance graph
Collaboration diagram for delphos::Dict:
Collaboration graph

Public Member Functions

 Dict ()
 Creates a new empty dictionary.
 
 Dict (const string &attr, const double &attr_value)
 Creates a new dictionary with a initial pair. More...
 
 Dict (const map< string, double > &m)
 Creates a new dictionary from a existing map container. More...
 
virtual ~Dict ()
 Destructor.
 
const double operator[] (const string &attr_name) const
 Enables the use of the [] on the instance to access values. More...
 
double & operator[] (const string &attr_name)
 Enables the use of the [] on the instance to access values. More...
 
const bool IsAttribute (const string &attr_name) const
 Query if a there is a key matching the argument on the dictionary. Return true on success, false on failure. More...
 
const unsigned int NumAttributes () const
 Return the amount of pairs on the dictionary.
 
void AddAttribute (const string &attr_name, double const &attr_value)
 Adds a new pair to the dictionary. More...
 
const map< string, double > GetAttributes () const
 Return a copy of the internal map container.
 
void SetAttributes (const map< string, double > attr_map)
 Overwrites or copy the argument on the internal container. More...
 
const double GetAttribute (const string &attr_name)
 Return the value associated with the given key. More...
 

Detailed Description

Abstact a dictionary to store and get attributes.

Constructor & Destructor Documentation

delphos::Dict::Dict ( const string &  attr,
const double &  attr_value 
)

Creates a new dictionary with a initial pair.

Parameters
attrThe key for the initial pair.
attr_valueThe value associated to the key.
delphos::Dict::Dict ( const map< string, double > &  m)

Creates a new dictionary from a existing map container.

Parameters
mA existing map-type container.

Member Function Documentation

void delphos::Dict::AddAttribute ( const string &  attr_name,
double const &  attr_value 
)

Adds a new pair to the dictionary.

Parameters
attr_nameThe key (name) to be inserted.
attr_valueThe value associated to the corresponding key (attr_name).
const double delphos::Dict::GetAttribute ( const string &  attr_name)

Return the value associated with the given key.

Parameters
attr_nameThe key (name) to be queried.
const bool delphos::Dict::IsAttribute ( const string &  attr_name) const

Query if a there is a key matching the argument on the dictionary. Return true on success, false on failure.

Parameters
attr_nameThe key (name) to be queried.
const double delphos::Dict::operator[] ( const string &  attr_name) const

Enables the use of the [] on the instance to access values.

Parameters
attr_nameThe key (name) to be queried.
double & delphos::Dict::operator[] ( const string &  attr_name)

Enables the use of the [] on the instance to access values.

Parameters
attr_nameThe key (name) to be queried.
void delphos::Dict::SetAttributes ( const map< string, double >  attr_map)

Overwrites or copy the argument on the internal container.

Parameters
attr_mapthe container to be inserted.

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