#include <uhd/types/dict.hpp>
| Public Member Functions | |
| dict (void) | |
| template<typename InputIterator> | |
| dict (InputIterator first, InputIterator last) | |
| std::size_t | size (void) const | 
| std::vector< Key > | keys (void) const | 
| std::vector< Val > | vals (void) const | 
| bool | has_key (const Key &key) const | 
| const Val & | get (const Key &key, const Val &other) const | 
| const Val & | get (const Key &key) const | 
| void | set (const Key &key, const Val &val) | 
| const Val & | operator[] (const Key &key) const | 
| Val & | operator[] (const Key &key) | 
| bool | operator== (const dict< Key, Val > &other) const | 
| bool | operator!= (const dict< Key, Val > &other) const | 
| Val | pop (const Key &key) | 
| void | update (const dict< Key, Val > &new_dict, bool fail_on_conflict=true) | 
| operator std::map< Key, Val > () const | |
A templated dictionary class with a python-like interface.
| uhd::dict< Key, Val >::dict | ( | void | ) | 
Create a new empty dictionary.
| uhd::dict< Key, Val >::dict | ( | InputIterator | first, | 
| InputIterator | last ) | 
Input iterator constructor: Makes boost::assign::map_list_of work.
| first | the begin iterator | 
| last | the end iterator | 
| const Val & uhd::dict< Key, Val >::get | ( | const Key & | key | ) | const | 
Get a value in the dict or throw.
| key | the key to look for | 
| const Val & uhd::dict< Key, Val >::get | ( | const Key & | key, | 
| const Val & | other ) const | 
Get a value in the dict or default.
| key | the key to look for | 
| other | use if key not found | 
| bool uhd::dict< Key, Val >::has_key | ( | const Key & | key | ) | const | 
Does the dictionary contain this key?
| key | the key to look for | 
| std::vector< Key > uhd::dict< Key, Val >::keys | ( | void | ) | const | 
Get a list of the keys in this dict. Key order depends on insertion precedence.
| uhd::dict< Key, Val >::operator std::map< Key, Val > | ( | ) | const | 
Typecast operator to std::map<>
| bool uhd::dict< Key, Val >::operator!= | ( | const dict< Key, Val > & | other | ) | const | 
Not equal operator for the dict type
| other | the dict being compared to this | 
| bool uhd::dict< Key, Val >::operator== | ( | const dict< Key, Val > & | other | ) | const | 
Equals operator for the dict type
| other | the dict being compared to this | 
| Val & uhd::dict< Key, Val >::operator[] | ( | const Key & | key | ) | 
Set a value for the given key, however, in reality it really returns a reference which can be assigned to.
| key | the key to set to | 
| const Val & uhd::dict< Key, Val >::operator[] | ( | const Key & | key | ) | const | 
Get a value for the given key if it exists. If the key is not found throw an error.
| key | the key to look for | 
| an | exception when not found | 
| Val uhd::dict< Key, Val >::pop | ( | const Key & | key | ) | 
Pop an item out of the dictionary.
| key | the item key | 
| an | exception when not found | 
| void uhd::dict< Key, Val >::set | ( | const Key & | key, | 
| const Val & | val ) | 
Set a value in the dict at the key.
| key | the key to set at | 
| val | the value to set | 
| std::size_t uhd::dict< Key, Val >::size | ( | void | ) | const | 
Get the number of elements in this dict.
| void uhd::dict< Key, Val >::update | ( | const dict< Key, Val > & | new_dict, | 
| bool | fail_on_conflict = true ) | 
Update this dictionary with values from another.
Basically, this copies all the key/value pairs from new_dict into this dict. When the key is already present in the current dict, it either overwrites the current value (if fail_on_conflict is false) or it throws (if fail_on_conflict is true and the values differ).
With the exception of fail_on_conflict, this behaves analogously to Python's dict.update() method.
| new_dict | The arguments to copy. | 
| fail_on_conflict | If true, throws. | 
| uhd::value_error | 
| std::vector< Val > uhd::dict< Key, Val >::vals | ( | void | ) | const | 
Get a list of the values in this dict. Value order depends on insertion precedence.