blob: 1ac30e1de43addcbe4e10fd60cd1100be949e4bd [file] [log] [blame]
Yingdi Yub8f8b342015-04-27 11:06:42 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
Yingdi Yu6ee2d362015-07-16 21:48:05 -07003 * Copyright (c) 2013-2017 Regents of the University of California.
Yingdi Yub8f8b342015-04-27 11:06:42 -07004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6 *
7 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU Lesser General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later version.
10 *
11 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13 * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14 *
15 * You should have received copies of the GNU General Public License and GNU Lesser
16 * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17 * <http://www.gnu.org/licenses/>.
18 *
19 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20 */
21
Alexander Afanasyev97709c02016-08-25 19:58:30 -070022#ifndef NDN_SECURITY_PIB_IDENTITY_CONTAINER_HPP
23#define NDN_SECURITY_PIB_IDENTITY_CONTAINER_HPP
Yingdi Yub8f8b342015-04-27 11:06:42 -070024
25#include <set>
26#include "identity.hpp"
27
28namespace ndn {
29namespace security {
Yingdi Yu6ee2d362015-07-16 21:48:05 -070030namespace pib {
Yingdi Yub8f8b342015-04-27 11:06:42 -070031
32class PibImpl;
33
34/// @brief A handler to search or enumerate identities in PIB.
35class IdentityContainer
36{
37public:
38 class const_iterator
39 {
40 public:
41 friend class IdentityContainer;
42
43 public:
44 Identity
45 operator*();
46
47 const_iterator&
48 operator++();
49
50 const_iterator
51 operator++(int);
52
53 bool
54 operator==(const const_iterator& other);
55
56 bool
57 operator!=(const const_iterator& other);
58
59 private:
60 const_iterator(std::set<Name>::const_iterator it, shared_ptr<PibImpl> impl);
61
62 private:
63 Name m_identity;
64 std::set<Name>::const_iterator m_it;
65 shared_ptr<PibImpl> m_impl;
66 };
67
68 typedef const_iterator iterator;
69
70public:
71 IdentityContainer();
72
73 IdentityContainer(std::set<Name>&& identities, shared_ptr<PibImpl> impl);
74
75 const_iterator
76 begin() const;
77
78 const_iterator
79 end() const;
80
81 const_iterator
82 find(const Name& keyId) const;
83
84 size_t
85 size() const;
86
87private:
88 std::set<Name> m_identities;
89 shared_ptr<PibImpl> m_impl;
90};
91
Yingdi Yu6ee2d362015-07-16 21:48:05 -070092} // namespace pib
93
94using pib::IdentityContainer;
95
Yingdi Yub8f8b342015-04-27 11:06:42 -070096} // namespace security
97} // namespace ndn
98
Alexander Afanasyev97709c02016-08-25 19:58:30 -070099#endif // NDN_SECURITY_PIB_IDENTITY_CONTAINER_HPP