USRP Hardware Driver and USRP Manual  Version: 4.1.0.4-3
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 #pragma once
9 
10 #include <uhd/config.hpp>
11 #include <list>
12 #include <map>
13 #include <vector>
14 
15 namespace uhd {
16 
20 template <typename Key, typename Val>
21 class dict
22 {
23 public:
27  dict(void);
28 
35  template <typename InputIterator>
36  dict(InputIterator first, InputIterator last);
37 
42  std::size_t size(void) const;
43 
49  std::vector<Key> keys(void) const;
50 
56  std::vector<Val> vals(void) const;
57 
63  bool has_key(const Key& key) const;
64 
71  const Val& get(const Key& key, const Val& other) const;
72 
78  const Val& get(const Key& key) const;
79 
85  void set(const Key& key, const Val& val);
86 
94  const Val& operator[](const Key& key) const;
95 
102  Val& operator[](const Key& key);
103 
109  bool operator==(const dict<Key, Val>& other) const;
110 
116  bool operator!=(const dict<Key, Val>& other) const;
117 
124  Val pop(const Key& key);
125 
141  void update(const dict<Key, Val>& new_dict, bool fail_on_conflict = true);
142 
145  operator std::map<Key, Val>() const;
146 
147 private:
148  typedef std::pair<Key, Val> pair_t;
149  std::list<pair_t> _map; // private container
150 };
151 
152 } // namespace uhd
153 
154 #include <uhd/types/dict.ipp>
Definition: dict.hpp:22
std::vector< Key > keys(void) const
Definition: dict.ipp:51
std::vector< Val > vals(void) const
Definition: dict.ipp:60
bool operator==(const dict< Key, Val > &other) const
Definition: dict.ipp:115
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition: dict.ipp:146
const Val & operator[](const Key &key) const
Definition: dict.ipp:98
std::size_t size(void) const
Definition: dict.ipp:46
bool operator!=(const dict< Key, Val > &other) const
Definition: dict.ipp:128
bool has_key(const Key &key) const
Definition: dict.ipp:69
dict(void)
Definition: dict.ipp:34
const Val & get(const Key &key, const Val &other) const
Definition: dict.ipp:77
Val pop(const Key &key)
Definition: dict.ipp:133
void set(const Key &key, const Val &val)
Definition: dict.ipp:93
Definition: build_info.hpp:12