blob: 0f5a5ccbb7ad84850ebbccc1888592761995ecd2 [file] [log] [blame]
Yingdi Yub4be64a2013-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 Yudbeb8e22013-10-14 09:36:31 -070044 getProfileEntry(const std::string& profileType) const;
Yingdi Yub4be64a2013-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
68protected:
69 ndn::Name m_identityName;
70 std::map<std::string, ndn::Blob> m_entries;
71};
72
73
74
75#endif