USRP Hardware Driver and USRP Manual Version: 20250718.0.git40403b7c.fc43
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 <cstddef>
12#include <list>
13#include <map>
14#include <utility>
15#include <vector>
16
17namespace uhd {
18
22template <typename Key, typename Val>
24{
25public:
29 dict(void);
30
37 template <typename InputIterator>
38 dict(InputIterator first, InputIterator last);
39
44 std::size_t size(void) const;
45
51 std::vector<Key> keys(void) const;
52
58 std::vector<Val> vals(void) const;
59
65 bool has_key(const Key& key) const;
66
73 const Val& get(const Key& key, const Val& other) const;
74
80 const Val& get(const Key& key) const;
81
87 void set(const Key& key, const Val& val);
88
96 const Val& operator[](const Key& key) const;
97
104 Val& operator[](const Key& key);
105
111 bool operator==(const dict<Key, Val>& other) const;
112
118 bool operator!=(const dict<Key, Val>& other) const;
119
126 Val pop(const Key& key);
127
143 void update(const dict<Key, Val>& new_dict, bool fail_on_conflict = true);
144
147 operator std::map<Key, Val>() const;
148
149private:
150 typedef std::pair<Key, Val> pair_t;
151 std::list<pair_t> _map; // private container
152};
153
154} // namespace uhd
155
156#include <uhd/types/dict.ipp>
std::vector< Key > keys(void) const
Definition dict.ipp:52
std::vector< Val > vals(void) const
Definition dict.ipp:62
bool operator==(const dict< Key, Val > &other) const
Definition dict.ipp:129
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition dict.ipp:163
const Val & operator[](const Key &key) const
Definition dict.ipp:108
std::size_t size(void) const
Definition dict.ipp:46
bool operator!=(const dict< Key, Val > &other) const
Definition dict.ipp:143
bool has_key(const Key &key) const
Definition dict.ipp:72
dict(void)
Definition dict.ipp:33
const Val & get(const Key &key, const Val &other) const
Definition dict.ipp:82
Val pop(const Key &key)
Definition dict.ipp:149
void set(const Key &key, const Val &val)
Definition dict.ipp:102
#define UHD_API_HEADER
Definition config.h:88
Definition build_info.hpp:12