| USRP Hardware Driver and Device Manual Version: 4.10.0.0 UHD and USRP Manual |

Loading...
Searching...
No Matches
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 <initializer_list>
12#include <cstddef>
13#include <list>
14#include <map>
15#include <utility>
16#include <vector>
17
18 namespace uhd {
19
23 template <typename Key, typename Val>
24 class UHD_API_HEADER dict
25{
26 public:
30 dict(void);
31
38 template <typename InputIterator>
39 dict(InputIterator first, InputIterator last);
40
41 dict(std::initializer_list<std::pair<Key, Val>> l);
42
47 std::size_t size(void) const;
48
54 std::vector<Key> keys(void) const;
55
61 std::vector<Val> vals(void) const;
62
68 bool has_key(const Key& key) const;
69
76 const Val& get(const Key& key, const Val& other) const;
77
83 const Val& get(const Key& key) const;
84
90 void set(const Key& key, const Val& val);
91
99 const Val& operator[](const Key& key) const;
100
107 Val& operator[](const Key& key);
108
114 bool operator==(const dict<Key, Val>& other) const;
115
121 bool operator!=(const dict<Key, Val>& other) const;
122
129 Val pop(const Key& key);
130
146 void update(const dict<Key, Val>& new_dict, bool fail_on_conflict = true);
147
150 operator std::map<Key, Val>() const;
151
152 private:
153 typedef std::pair<Key, Val> pair_t;
154 std::list<pair_t> _map; // private container
155};
156
157} // namespace uhd
158
159#include <uhd/types/dict.ipp>
uhd::dict::keys
std::vector< Key > keys(void) const
Definition dict.ipp:59
uhd::dict::vals
std::vector< Val > vals(void) const
Definition dict.ipp:69
uhd::dict::operator==
bool operator==(const dict< Key, Val > &other) const
Definition dict.ipp:136
uhd::dict::update
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition dict.ipp:170
uhd::dict::operator[]
const Val & operator[](const Key &key) const
Definition dict.ipp:115
uhd::dict::size
std::size_t size(void) const
Definition dict.ipp:53
uhd::dict::operator!=
bool operator!=(const dict< Key, Val > &other) const
Definition dict.ipp:150
uhd::dict::has_key
bool has_key(const Key &key) const
Definition dict.ipp:79
uhd::dict::dict
dict(void)
Definition dict.ipp:34
uhd::dict::get
const Val & get(const Key &key, const Val &other) const
Definition dict.ipp:89
uhd::dict::pop
Val pop(const Key &key)
Definition dict.ipp:156
uhd::dict::set
void set(const Key &key, const Val &val)
Definition dict.ipp:109
UHD_API_HEADER
#define UHD_API_HEADER
Definition config.h:88
config.hpp
dict.ipp
uhd
Definition build_info.hpp:12