ALPSCore reference
|
Python-like dictionary. More...
#include <dictionary.hpp>
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_type & | operator[] (const std::string &key) |
Access with intent to assign. More... | |
const value_type & | operator[] (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 &) |
Python-like dictionary.
Definition at line 18 of file dictionary.hpp.
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.
|
inlinevirtual |
Virtual destructor to make dictionary inheritable.
Definition at line 36 of file dictionary.hpp.
|
inline |
Const-iterator to the beginning of the contained map.
Definition at line 30 of file dictionary.hpp.
|
inline |
True if the cdictionary does not contain elements (even empty ones)
Definition at line 39 of file dictionary.hpp.
|
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.
|
inline |
Erase an element if it exists.
Definition at line 45 of file dictionary.hpp.
|
inline |
Check if a key exists and has a value (without creating the key)
Definition at line 65 of file dictionary.hpp.
|
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.
|
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.
|
inline |
Size of the dictionary (including empty elements)
Definition at line 42 of file dictionary.hpp.
|
friend |
Definition at line 84 of file dictionary.cpp.
|
friend |
Swap the dictionaries.
Definition at line 77 of file dictionary.hpp.