blob: 5c9ce24683e58754a3d5ff5c343d5d8e826dd92e [file] [log] [blame]
Yingdi Yu5ff62102013-10-13 17:24:50 -07001/* -*- 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
20class Profile
21{
22public:
23 typedef std::map<std::string, ndn::Blob>::iterator iterator;
24 typedef std::map<std::string, ndn::Blob>::const_iterator const_iterator;
25public:
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 Yu53b8a9c2013-10-14 09:36:31 -070044 getProfileEntry(const std::string& profileType) const;
Yingdi Yu5ff62102013-10-13 17:24:50 -070045
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 Yu79c25a22013-10-21 13:38:38 -070068 inline const std::map<std::string, ndn::Blob>&
69 getEntries() const
70 { return m_entries; }
71
Yingdi Yu5ff62102013-10-13 17:24:50 -070072protected:
73 ndn::Name m_identityName;
74 std::map<std::string, ndn::Blob> m_entries;
75};
76
77
78
79#endif