USRP Hardware Driver and USRP Manual: dict.hpp Source File

| USRP Hardware Driver and USRP Manual Version: 4.8.0.makepkg-0-g308126a4 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>
23 class UHD_API_HEADER dict
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>
uhd::dict::keys
std::vector< Key > keys(void) const
Definition dict.ipp:52
uhd::dict::get
const Val & get(const Key &key) const
Definition dict.ipp:92
uhd::dict::vals
std::vector< Val > vals(void) const
Definition dict.ipp:62
uhd::dict::operator==
bool operator==(const dict< Key, Val > &other) const
Definition dict.ipp:129
uhd::dict::update
void update(const dict< Key, Val > &new_dict, bool fail_on_conflict=true)
Definition dict.ipp:163
uhd::dict::dict
dict(InputIterator first, InputIterator last)
Definition dict.ipp:40
uhd::dict::operator[]
const Val & operator[](const Key &key) const
Definition dict.ipp:108
uhd::dict::size
std::size_t size(void) const
Definition dict.ipp:46
uhd::dict::operator[]
Val & operator[](const Key &key)
Definition dict.ipp:118
uhd::dict::operator!=
bool operator!=(const dict< Key, Val > &other) const
Definition dict.ipp:143
uhd::dict::has_key
bool has_key(const Key &key) const
Definition dict.ipp:72
uhd::dict::dict
dict(void)
Definition dict.ipp:33
uhd::dict::get
const Val & get(const Key &key, const Val &other) const
Definition dict.ipp:82
uhd::dict::pop
Val pop(const Key &key)
Definition dict.ipp:149
uhd::dict::set
void set(const Key &key, const Val &val)
Definition dict.ipp:102
UHD_API_HEADER
#define UHD_API_HEADER
Definition config.h:88
config.hpp
dict.ipp
uhd
Definition build_info.hpp:12