USRP Hardware Driver and USRP Manual  Version: 4.6.0.0-7-gece7c4811
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>
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>
UHD_INLINE bool operator!=(fp_compare_delta< float_t > lhs, fp_compare_delta< float_t > rhs)
Definition: fp_compare_delta.ipp:71
Definition: dict.hpp:21
#define UHD_API_HEADER
Definition: config.h:88
Definition: build_info.hpp:12
UHD_API bool operator==(const time_spec_t &, const time_spec_t &)
Implement equality_comparable interface.