12#include <boost/format.hpp> 
   13#include <boost/lexical_cast.hpp> 
   19template <
typename Key, 
typename Val>
 
   20struct key_not_found : uhd::key_error
 
   22    key_not_found(
const Key& key)
 
   23        : uhd::key_error(str(boost::format(
"key \"%s\" not found in dict(%s, %s)")
 
   24                             % boost::lexical_cast<std::string>(key) % typeid(Key).name()
 
   25                             % typeid(Val).name()))
 
   32template <
typename Key, 
typename Val>
 
 
   38template <
typename Key, 
typename Val>
 
   39template <
typename InputIterator>
 
 
   45template <
typename Key, 
typename Val>
 
 
   51template <
typename Key, 
typename Val>
 
   54    std::vector<Key> 
keys;
 
   55    for (
const pair_t& p : _map) {
 
   56        keys.push_back(p.first);
 
   61template <
typename Key, 
typename Val>
 
   64    std::vector<Val> 
vals;
 
   65    for (
const pair_t& p : _map) {
 
   66        vals.push_back(p.second);
 
   71template <
typename Key, 
typename Val>
 
   74    for (
const pair_t& p : _map) {
 
   81template <
typename Key, 
typename Val>
 
   84    for (
const pair_t& p : _map) {
 
   91template <
typename Key, 
typename Val>
 
   94    for (
const pair_t& p : _map) {
 
   98    throw key_not_found<Key, Val>(key);
 
  101template <
typename Key, 
typename Val>
 
  107template <
typename Key, 
typename Val>
 
  110    for (
const pair_t& p : _map) {
 
  114    throw key_not_found<Key, Val>(key);
 
  117template <
typename Key, 
typename Val>
 
  120    for (pair_t& p : _map) {
 
  124    _map.push_back(std::make_pair(key, Val()));
 
  125    return _map.back().second;
 
  128template <
typename Key, 
typename Val>
 
  134    for (
const pair_t& p : _map) {
 
  135        if (not(other.
has_key(p.first) and other.
get(p.first) == p.second)) {
 
 
  142template <
typename Key, 
typename Val>
 
  145    return not(*
this == other);
 
 
  148template <
typename Key, 
typename Val>
 
  151    typename std::list<pair_t>::iterator it;
 
  152    for (it = _map.begin(); it != _map.end(); it++) {
 
  153        if (it->first == key) {
 
  154            Val val = it->second;
 
  159    throw key_not_found<Key, Val>(key);
 
 
  162template <
typename Key, 
typename Val>
 
  165    for (
const Key& key : new_dict.
keys()) {
 
  166        if (fail_on_conflict and 
has_key(key) and 
get(key) != new_dict[key]) {
 
  168                str(boost::format(
"Option merge conflict: %s:%s != %s:%s") % key
 
  169                    % 
get(key) % key % new_dict[key]));
 
  171        set(key, new_dict[key]);
 
 
  175template <
typename Key, 
typename Val>
 
  178    std::map<Key, Val> new_map;
 
  179    for (
const pair_t& p : _map) {
 
  180        new_map[p.first] = p.second;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
std::vector< Key > keys(void) const
Definition dict.ipp:52
std::vector< Val > vals(void) const
Definition dict.ipp:62
bool operator==(const dict< Key, Val > &other) const
Definition dict.ipp:129
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition dict.ipp:163
const Val & operator[](const Key &key) const
Definition dict.ipp:108
std::size_t size(void) const
Definition dict.ipp:46
bool operator!=(const dict< Key, Val > &other) const
Definition dict.ipp:143
bool has_key(const Key &key) const
Definition dict.ipp:72
dict(void)
Definition dict.ipp:33
const Val & get(const Key &key, const Val &other) const
Definition dict.ipp:82
Val pop(const Key &key)
Definition dict.ipp:149
void set(const Key &key, const Val &val)
Definition dict.ipp:102
Definition build_info.hpp:12
Definition exception.hpp:109