blob: e755c050eceaee3765cbad2cfbd269a8e47c39c6 [file] [log] [blame]
Jeff Thompsonc0573432013-09-19 17:41:36 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/**
3 * Copyright (C) 2013 Regents of the University of California.
4 * @author: Yingdi Yu <yingdi@cs.ucla.edu>
5 * @author: Jeff Thompson <jefft0@remap.ucla.edu>
6 * See COPYING for copyright and distribution information.
7 */
8
9#ifndef NDN_OID_HPP
Jeff Thompsone589c3f2013-10-12 17:30:50 -070010#define NDN_OID_HPP
Jeff Thompsonc0573432013-09-19 17:41:36 -070011
12#include <vector>
13#include <string>
14
Alexander Afanasyev0ea6e082013-12-26 15:16:37 -080015namespace CryptoPP { class BufferedTransformation; }
16
Jeff Thompsonc0573432013-09-19 17:41:36 -070017namespace ndn {
18
19class OID {
20public:
21 OID ()
22 {
23 }
24
Alexander Afanasyev049f8f72013-12-26 19:07:15 -080025 OID(const char *oid);
26
Jeff Thompsonc0573432013-09-19 17:41:36 -070027 OID(const std::string& oid);
28
29 OID(const std::vector<int>& oid)
30 : oid_(oid)
31 {
32 }
33
34 const std::vector<int> &
35 getIntegerList() const
36 {
37 return oid_;
38 }
39
40 void
41 setIntegerList(const std::vector<int>& value){
42 oid_ = value;
43 }
44
45 std::string
Jeff Thompson6c729a22013-12-20 10:37:59 -080046 toString() const;
Jeff Thompsonc0573432013-09-19 17:41:36 -070047
Jeff Thompson6c729a22013-12-20 10:37:59 -080048 bool operator == (const OID& oid) const
Jeff Thompsonc0573432013-09-19 17:41:36 -070049 {
50 return equal(oid);
51 }
52
Jeff Thompson6c729a22013-12-20 10:37:59 -080053 bool operator != (const OID& oid) const
Jeff Thompsonc0573432013-09-19 17:41:36 -070054 {
55 return !equal(oid);
56 }
Alexander Afanasyev0ea6e082013-12-26 15:16:37 -080057
58 void
59 encode(CryptoPP::BufferedTransformation &out) const;
60
61 void
62 decode(CryptoPP::BufferedTransformation &in);
Jeff Thompsonc0573432013-09-19 17:41:36 -070063
Alexander Afanasyev049f8f72013-12-26 19:07:15 -080064
65private:
66 void
67 construct(const std::string &value);
68
69 bool
70 equal(const OID& oid) const;
71
72private:
Jeff Thompsonc0573432013-09-19 17:41:36 -070073 std::vector<int> oid_;
74};
75
76}
77
78#endif