USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-ge00f1f37
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 <vector>
13 #include <list>
14 
15 namespace uhd{
16 
20  template <typename Key, typename Val> class dict{
21  public:
25  dict(void);
26 
33  template <typename InputIterator>
34  dict(InputIterator first, InputIterator last);
35 
40  std::size_t size(void) const;
41 
47  std::vector<Key> keys(void) const;
48 
54  std::vector<Val> vals(void) const;
55 
61  bool has_key(const Key &key) const;
62 
69  const Val &get(const Key &key, const Val &other) const;
70 
76  const Val &get(const Key &key) const;
77 
83  void set(const Key &key, const Val &val);
84 
92  const Val &operator[](const Key &key) const;
93 
100  Val &operator[](const Key &key);
101 
107  bool operator==(const dict<Key, Val> &other) const;
108 
114  bool operator!=(const dict<Key, Val> &other) const;
115 
122  Val pop(const Key &key);
123 
139  void update(const dict<Key, Val> &new_dict, bool fail_on_conflict=true);
140 
141  private:
142  typedef std::pair<Key, Val> pair_t;
143  std::list<pair_t> _map; //private container
144  };
145 
146 } //namespace uhd
147 
148 #include <uhd/types/dict.ipp>
149 
150 #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:20
dict(void)
Definition: dict.ipp:35
Definition: build_info.hpp:14
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