USRP Hardware Driver and USRP Manual  Version: 3.15.0.HEAD-0-gaea0e2de
UHD and USRP Manual
dict.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011,2015 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #ifndef INCLUDED_UHD_TYPES_DICT_HPP
9 #define INCLUDED_UHD_TYPES_DICT_HPP
10 
11 #include <uhd/config.hpp>
12 #include <list>
13 #include <map>
14 #include <vector>
15 
16 namespace uhd {
17 
21 template <typename Key, typename Val> class dict
22 {
23 public:
27  dict(void);
28 
35  template <typename InputIterator> dict(InputIterator first, InputIterator last);
36 
41  std::size_t size(void) const;
42 
48  std::vector<Key> keys(void) const;
49 
55  std::vector<Val> vals(void) const;
56 
62  bool has_key(const Key& key) const;
63 
70  const Val& get(const Key& key, const Val& other) const;
71 
77  const Val& get(const Key& key) const;
78 
84  void set(const Key& key, const Val& val);
85 
93  const Val& operator[](const Key& key) const;
94 
101  Val& operator[](const Key& key);
102 
108  bool operator==(const dict<Key, Val>& other) const;
109 
115  bool operator!=(const dict<Key, Val>& other) const;
116 
123  Val pop(const Key& key);
124 
140  void update(const dict<Key, Val>& new_dict, bool fail_on_conflict = true);
141 
144  operator std::map<Key, Val>() const;
145 
146 private:
147  typedef std::pair<Key, Val> pair_t;
148  std::list<pair_t> _map; // private container
149 };
150 
151 } // namespace uhd
152 
153 #include <uhd/types/dict.ipp>
154 
155 #endif /* INCLUDED_UHD_TYPES_DICT_HPP */
const Val & operator[](const Key &key) const
Definition: dict.ipp:99
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition: dict.ipp:147
bool operator==(const dict< Key, Val > &other) const
Definition: dict.ipp:116
std::size_t size(void) const
Definition: dict.ipp:47
Val pop(const Key &key)
Definition: dict.ipp:134
Definition: dict.hpp:21
dict(void)
Definition: dict.ipp:35
Definition: build_info.hpp:13
bool operator!=(const dict< Key, Val > &other) const
Definition: dict.ipp:129
std::vector< Val > vals(void) const
Definition: dict.ipp:61
bool has_key(const Key &key) const
Definition: dict.ipp:70
std::vector< Key > keys(void) const
Definition: dict.ipp:52