USRP Hardware Driver and USRP Manual  Version: 3.11.0.HEAD-0-g13c32cef
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 
108  Val pop(const Key &key);
109 
125  void update(const dict<Key, Val> &new_dict, bool fail_on_conflict=true);
126 
127  private:
128  typedef std::pair<Key, Val> pair_t;
129  std::list<pair_t> _map; //private container
130  };
131 
132 } //namespace uhd
133 
134 #include <uhd/types/dict.ipp>
135 
136 #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:129
std::size_t size(void) const
Definition: dict.ipp:47
Val pop(const Key &key)
Definition: dict.ipp:116
Definition: dict.hpp:20
dict(void)
Definition: dict.ipp:35
Definition: build_info.hpp:14
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