USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-gdca39145
UHD and USRP Manual
dict.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011,2015 Ettus Research LLC
3 //
4 // SPDX-License-Identifier: GPL-3.0
5 //
6 
7 #ifndef INCLUDED_UHD_TYPES_DICT_HPP
8 #define INCLUDED_UHD_TYPES_DICT_HPP
9 
10 #include <uhd/config.hpp>
11 #include <vector>
12 #include <list>
13 
14 namespace uhd{
15 
19  template <typename Key, typename Val> class dict{
20  public:
24  dict(void);
25 
32  template <typename InputIterator>
33  dict(InputIterator first, InputIterator last);
34 
39  std::size_t size(void) const;
40 
46  std::vector<Key> keys(void) const;
47 
53  std::vector<Val> vals(void) const;
54 
60  bool has_key(const Key &key) const;
61 
68  const Val &get(const Key &key, const Val &other) const;
69 
75  const Val &get(const Key &key) const;
76 
82  void set(const Key &key, const Val &val);
83 
91  const Val &operator[](const Key &key) const;
92 
99  Val &operator[](const Key &key);
100 
107  Val pop(const Key &key);
108 
124  void update(const dict<Key, Val> &new_dict, bool fail_on_conflict=true);
125 
126  private:
127  typedef std::pair<Key, Val> pair_t;
128  std::list<pair_t> _map; //private container
129  };
130 
131 } //namespace uhd
132 
133 #include <uhd/types/dict.ipp>
134 
135 #endif /* INCLUDED_UHD_TYPES_DICT_HPP */
const Val & operator[](const Key &key) const
Definition: dict.ipp:98
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition: dict.ipp:128
std::size_t size(void) const
Definition: dict.ipp:46
Val pop(const Key &key)
Definition: dict.ipp:115
Definition: dict.hpp:19
dict(void)
Definition: dict.ipp:34
Definition: build_info.hpp:14
std::vector< Val > vals(void) const
Definition: dict.ipp:60
bool has_key(const Key &key) const
Definition: dict.ipp:69
std::vector< Key > keys(void) const
Definition: dict.ipp:51