USRP Hardware Driver and USRP Manual  Version: 3.15.0.0-4+b1satnogs1
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>
22 class dict
23 {
24 public:
28  dict(void);
29 
36  template <typename InputIterator>
37  dict(InputIterator first, InputIterator last);
38 
43  std::size_t size(void) const;
44 
50  std::vector<Key> keys(void) const;
51 
57  std::vector<Val> vals(void) const;
58 
64  bool has_key(const Key& key) const;
65 
72  const Val& get(const Key& key, const Val& other) const;
73 
79  const Val& get(const Key& key) const;
80 
86  void set(const Key& key, const Val& val);
87 
95  const Val& operator[](const Key& key) const;
96 
103  Val& operator[](const Key& key);
104 
110  bool operator==(const dict<Key, Val>& other) const;
111 
117  bool operator!=(const dict<Key, Val>& other) const;
118 
125  Val pop(const Key& key);
126 
142  void update(const dict<Key, Val>& new_dict, bool fail_on_conflict = true);
143 
146  operator std::map<Key, Val>() const;
147 
148 private:
149  typedef std::pair<Key, Val> pair_t;
150  std::list<pair_t> _map; // private container
151 };
152 
153 } // namespace uhd
154 
155 #include <uhd/types/dict.ipp>
156 
157 #endif /* INCLUDED_UHD_TYPES_DICT_HPP */
Definition: dict.hpp:23
std::vector< Key > keys(void) const
Definition: dict.ipp:52
std::vector< Val > vals(void) const
Definition: dict.ipp:61
bool operator==(const dict< Key, Val > &other) const
Definition: dict.ipp:116
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition: dict.ipp:147
const Val & operator[](const Key &key) const
Definition: dict.ipp:99
std::size_t size(void) const
Definition: dict.ipp:47
bool operator!=(const dict< Key, Val > &other) const
Definition: dict.ipp:129
bool has_key(const Key &key) const
Definition: dict.ipp:70
dict(void)
Definition: dict.ipp:35
const Val & get(const Key &key, const Val &other) const
Definition: dict.ipp:78
Val pop(const Key &key)
Definition: dict.ipp:134
void set(const Key &key, const Val &val)
Definition: dict.ipp:94
Definition: build_info.hpp:13