All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
pib-identity-container.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_PIB_IDENTITY_CONTAINER_HPP
24 #define NDN_PIB_IDENTITY_CONTAINER_HPP
25 
26 #include <set>
27 #include <map>
28 #include "pib-identity.hpp"
29 
30 // Give friend access to the tests.
31 class TestPibIdentityContainer_Basic_Test;
32 class TestPibIdentityContainer_Errors_Test;
33 class TestKeyChain_Management_Test;
34 
35 namespace ndn {
36 
37 class PibImpl;
38 class PibIdentityImpl;
39 
45 public:
50  size_t
51  size() const { return identityNames_.size(); }
52 
59  ptr_lib::shared_ptr<PibIdentity>
60  add(const Name& identityName);
61 
69  void
70  remove(const Name& identityName);
71 
78  ptr_lib::shared_ptr<PibIdentity>
79  get(const Name& identityName);
80 
85  void
86  reset();
87 
94  bool
95  isConsistent() const;
96 
97 private:
98  friend class Pib;
99  // Give friend access to the tests.
100  friend TestPibIdentityContainer_Basic_Test;
101  friend TestPibIdentityContainer_Errors_Test;
102  friend TestKeyChain_Management_Test;
103 
109  PibIdentityContainer(const ptr_lib::shared_ptr<PibImpl>& pibImpl);
110 
111  // Disable the copy constructor and assignment operator.
113  PibIdentityContainer& operator=(const PibIdentityContainer& other);
114 
115  std::set<Name> identityNames_;
116  // Cache of loaded PibIdentityImpl objects.
117  std::map<Name, ptr_lib::shared_ptr<PibIdentityImpl>> identities_;
118 
119  ptr_lib::shared_ptr<PibImpl> pibImpl_;
120 };
121 
122 }
123 
124 #endif
void reset()
Reset the state of the container.
Definition: pib-identity-container.cpp:80
A PibIdentityContainer is used to search/enumerate the identities in a PIB.
Definition: pib-identity-container.hpp:44
size_t size() const
Get the number of identities in the container.
Definition: pib-identity-container.hpp:51
bool isConsistent() const
Check if the container is consistent with the backend storage.
Definition: pib-identity-container.cpp:87
ptr_lib::shared_ptr< PibIdentity > add(const Name &identityName)
Add an identity with name identityName into the container.
Definition: pib-identity-container.cpp:42
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
In general, a PIB (Public Information Base) stores the public portion of a user's cryptography keys...
Definition: pib.hpp:54