ALPSCore reference
Public Types | Public Member Functions | Friends | List of all members
alps::params_ns::dictionary Class Reference

Python-like dictionary. More...

#include <dictionary.hpp>

Inheritance diagram for alps::params_ns::dictionary:
Inheritance graph
Collaboration diagram for alps::params_ns::dictionary:
Collaboration graph

Public Types

typedef dict_value value_type
 
typedef map_type::const_iterator const_iterator
 

Public Member Functions

const_iterator begin () const
 Const-iterator to the beginning of the contained map. More...
 
const_iterator end () const
 Const-iterator to the end of the contained map. More...
 
virtual ~dictionary ()
 Virtual destructor to make dictionary inheritable. More...
 
bool empty () const
 True if the cdictionary does not contain elements (even empty ones) More...
 
std::size_t size () const
 Size of the dictionary (including empty elements) More...
 
void erase (const std::string &key)
 Erase an element if it exists. More...
 
value_typeoperator[] (const std::string &key)
 Access with intent to assign. More...
 
const value_typeoperator[] (const std::string &key) const
 Read-only access. More...
 
const_iterator find (const std::string &key) const
 Obtain read-only iterator to a name. More...
 
bool exists (const std::string &key) const
 Check if a key exists and has a value (without creating the key) More...
 
template<typename T >
bool exists (const std::string &key) const
 Check if a key exists and has a value of a particular type (without creating the key) More...
 
bool equals (const dictionary &rhs) const
 Compare two dictionaries (true if all entries are of the same type and value) More...
 
void save (alps::hdf5::archive &ar) const
 Save the dictionary to an archive. More...
 
void load (alps::hdf5::archive &ar)
 Load the dictionary from an archive. More...
 

Friends

void swap (dictionary &d1, dictionary &d2)
 Swap the dictionaries. More...
 
std::ostream & operator<< (std::ostream &, const dictionary &)
 

Detailed Description

Python-like dictionary.

Definition at line 18 of file dictionary.hpp.

Member Typedef Documentation

typedef map_type::const_iterator alps::params_ns::dictionary::const_iterator

Definition at line 27 of file dictionary.hpp.

Definition at line 20 of file dictionary.hpp.

Constructor & Destructor Documentation

virtual alps::params_ns::dictionary::~dictionary ( )
inlinevirtual

Virtual destructor to make dictionary inheritable.

Definition at line 36 of file dictionary.hpp.

Member Function Documentation

const_iterator alps::params_ns::dictionary::begin ( ) const
inline

Const-iterator to the beginning of the contained map.

Definition at line 30 of file dictionary.hpp.

bool alps::params_ns::dictionary::empty ( ) const
inline

True if the cdictionary does not contain elements (even empty ones)

Definition at line 39 of file dictionary.hpp.

const_iterator alps::params_ns::dictionary::end ( ) const
inline

Const-iterator to the end of the contained map.

Definition at line 33 of file dictionary.hpp.

bool alps::params_ns::dictionary::equals ( const dictionary rhs) const

Compare two dictionaries (true if all entries are of the same type and value)

Definition at line 63 of file dictionary.cpp.

void alps::params_ns::dictionary::erase ( const std::string &  key)
inline

Erase an element if it exists.

Definition at line 45 of file dictionary.hpp.

bool alps::params_ns::dictionary::exists ( const std::string &  key) const
inline

Check if a key exists and has a value (without creating the key)

Definition at line 65 of file dictionary.hpp.

template<typename T >
bool alps::params_ns::dictionary::exists ( const std::string &  key) const
inline

Check if a key exists and has a value of a particular type (without creating the key)

Definition at line 71 of file dictionary.hpp.

const_iterator alps::params_ns::dictionary::find ( const std::string &  key) const
inline

Obtain read-only iterator to a name.

Definition at line 54 of file dictionary.hpp.

void alps::params_ns::dictionary::load ( alps::hdf5::archive ar)

Load the dictionary from an archive.

Definition at line 75 of file dictionary.cpp.

dictionary::value_type & alps::params_ns::dictionary::operator[] ( const std::string &  key)

Access with intent to assign.

Definition at line 31 of file dictionary.cpp.

const dictionary::value_type & alps::params_ns::dictionary::operator[] ( const std::string &  key) const

Read-only access.

Definition at line 44 of file dictionary.cpp.

void alps::params_ns::dictionary::save ( alps::hdf5::archive ar) const

Save the dictionary to an archive.

Definition at line 70 of file dictionary.cpp.

std::size_t alps::params_ns::dictionary::size ( ) const
inline

Size of the dictionary (including empty elements)

Definition at line 42 of file dictionary.hpp.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const dictionary d 
)
friend

Definition at line 84 of file dictionary.cpp.

void swap ( dictionary d1,
dictionary d2 
)
friend

Swap the dictionaries.

Definition at line 77 of file dictionary.hpp.


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