USRP Hardware Driver and USRP Manual  Version: 3.15.0.0-2+b1
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 */
uhd::dict::keys
std::vector< Key > keys(void) const
Definition: dict.ipp:52
uhd::dict::pop
Val pop(const Key &key)
Definition: dict.ipp:134
config.hpp
uhd::dict::update
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition: dict.ipp:147
uhd::dict::operator==
bool operator==(const dict< Key, Val > &other) const
Definition: dict.ipp:116
uhd::dict::size
std::size_t size(void) const
Definition: dict.ipp:47
uhd::dict::dict
dict(void)
Definition: dict.ipp:35
uhd::dict::operator!=
bool operator!=(const dict< Key, Val > &other) const
Definition: dict.ipp:129
uhd
Definition: build_info.hpp:13
uhd::dict::has_key
bool has_key(const Key &key) const
Definition: dict.ipp:70
uhd::dict::vals
std::vector< Val > vals(void) const
Definition: dict.ipp:61
uhd::dict::set
void set(const Key &key, const Val &val)
Definition: dict.ipp:94
uhd::dict::get
const Val & get(const Key &key, const Val &other) const
Definition: dict.ipp:78
dict.ipp
uhd::dict
Definition: dict.hpp:21
uhd::dict::operator[]
const Val & operator[](const Key &key) const
Definition: dict.ipp:99