USRP Hardware Driver and Device Manual Version: 4.10.0.0_release
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
18namespace uhd {
19
23template <typename Key, typename Val>
25{
26public:
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
152private:
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>
std::vector< Key > keys(void) const
Definition dict.ipp:59
std::vector< Val > vals(void) const
Definition dict.ipp:69
bool operator==(const dict< Key, Val > &other) const
Definition dict.ipp:136
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition dict.ipp:170
const Val & operator[](const Key &key) const
Definition dict.ipp:115
std::size_t size(void) const
Definition dict.ipp:53
bool operator!=(const dict< Key, Val > &other) const
Definition dict.ipp:150
bool has_key(const Key &key) const
Definition dict.ipp:79
dict(void)
Definition dict.ipp:34
const Val & get(const Key &key, const Val &other) const
Definition dict.ipp:89
Val pop(const Key &key)
Definition dict.ipp:156
void set(const Key &key, const Val &val)
Definition dict.ipp:109
#define UHD_API_HEADER
Definition config.h:88
Definition build_info.hpp:12