Yingdi Yu | 5ff6210 | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
| 4 | * Yingdi Yu |
| 5 | * |
| 6 | * BSD license, See the LICENSE file for more information |
| 7 | * |
| 8 | * Author: Yingdi Yu <yingdi@cs.ucla.edu> |
| 9 | */ |
| 10 | |
| 11 | #ifndef LINKNDN_PROFILE_H |
| 12 | #define LINKNDN_PROFILE_H |
| 13 | |
| 14 | #include <ndn.cxx/common.h> |
| 15 | #include <ndn.cxx/fields/name.h> |
| 16 | #include <ndn.cxx/fields/blob.h> |
| 17 | #include <map> |
| 18 | #include <string> |
| 19 | |
| 20 | class Profile |
| 21 | { |
| 22 | public: |
| 23 | typedef std::map<std::string, ndn::Blob>::iterator iterator; |
| 24 | typedef std::map<std::string, ndn::Blob>::const_iterator const_iterator; |
| 25 | public: |
| 26 | Profile() {} |
| 27 | |
| 28 | Profile(const ndn::Name& identityName); |
| 29 | |
| 30 | Profile(const ndn::Name& identityName, |
| 31 | const std::string& name, |
| 32 | const std::string& institution); |
| 33 | |
| 34 | Profile(const Profile& profile); |
| 35 | |
| 36 | virtual |
| 37 | ~Profile() {} |
| 38 | |
| 39 | void |
| 40 | setProfileEntry(const std::string& profileType, |
| 41 | const ndn::Blob& profileValue); |
| 42 | |
| 43 | ndn::Ptr<const ndn::Blob> |
Yingdi Yu | 53b8a9c | 2013-10-14 09:36:31 -0700 | [diff] [blame] | 44 | getProfileEntry(const std::string& profileType) const; |
Yingdi Yu | 5ff6210 | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 45 | |
| 46 | inline Profile::iterator |
| 47 | begin() |
| 48 | { return m_entries.begin(); } |
| 49 | |
| 50 | inline Profile::const_iterator |
| 51 | begin() const |
| 52 | { return m_entries.begin(); } |
| 53 | |
| 54 | inline Profile::iterator |
| 55 | end() |
| 56 | { return m_entries.end(); } |
| 57 | |
| 58 | inline Profile::const_iterator |
| 59 | end() const |
| 60 | { return m_entries.end(); } |
| 61 | |
| 62 | ndn::Ptr<ndn::Blob> |
| 63 | toDerBlob() const; |
| 64 | |
| 65 | static ndn::Ptr<Profile> |
| 66 | fromDerBlob(const ndn::Blob& derBlob); |
| 67 | |
Yingdi Yu | 79c25a2 | 2013-10-21 13:38:38 -0700 | [diff] [blame] | 68 | inline const std::map<std::string, ndn::Blob>& |
| 69 | getEntries() const |
| 70 | { return m_entries; } |
| 71 | |
Yingdi Yu | 5ff6210 | 2013-10-13 17:24:50 -0700 | [diff] [blame] | 72 | protected: |
| 73 | ndn::Name m_identityName; |
| 74 | std::map<std::string, ndn::Blob> m_entries; |
| 75 | }; |
| 76 | |
| 77 | |
| 78 | |
| 79 | #endif |