USRP Hardware Driver and USRP Manual  Version: 003.008.002-0-ge9d11b35
UHD and USRP Manual
dict.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2010-2011 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_UHD_TYPES_DICT_HPP
19 #define INCLUDED_UHD_TYPES_DICT_HPP
20 
21 #include <uhd/config.hpp>
22 #include <vector>
23 #include <list>
24 
25 namespace uhd{
26 
30  template <typename Key, typename Val> class dict{
31  public:
35  dict(void);
36 
43  template <typename InputIterator>
44  dict(InputIterator first, InputIterator last);
45 
50  std::size_t size(void) const;
51 
57  std::vector<Key> keys(void) const;
58 
64  std::vector<Val> vals(void) const;
65 
71  bool has_key(const Key &key) const;
72 
79  const Val &get(const Key &key, const Val &other) const;
80 
86  const Val &get(const Key &key) const;
87 
93  void set(const Key &key, const Val &val);
94 
102  const Val &operator[](const Key &key) const;
103 
110  Val &operator[](const Key &key);
111 
118  Val pop(const Key &key);
119 
120  private:
121  typedef std::pair<Key, Val> pair_t;
122  std::list<pair_t> _map; //private container
123  };
124 
125 } //namespace uhd
126 
127 #include <uhd/types/dict.ipp>
128 
129 #endif /* INCLUDED_UHD_TYPES_DICT_HPP */
const Val & operator[](const Key &key) const
Definition: dict.ipp:109
std::size_t size(void) const
Definition: dict.ipp:57
Val pop(const Key &key)
Definition: dict.ipp:126
Definition: dict.hpp:30
dict(void)
Definition: dict.ipp:45
Definition: convert.hpp:28
std::vector< Val > vals(void) const
Definition: dict.ipp:71
bool has_key(const Key &key) const
Definition: dict.ipp:80
std::vector< Key > keys(void) const
Definition: dict.ipp:62