blob: f89339cd26349341cb6c29f5b834f1e8592ff59e [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
25 OID(const std::string& oid);
26
27 OID(const std::vector<int>& oid)
28 : oid_(oid)
29 {
30 }
31
32 const std::vector<int> &
33 getIntegerList() const
34 {
35 return oid_;
36 }
37
38 void
39 setIntegerList(const std::vector<int>& value){
40 oid_ = value;
41 }
42
43 std::string
Jeff Thompson6c729a22013-12-20 10:37:59 -080044 toString() const;
Jeff Thompsonc0573432013-09-19 17:41:36 -070045
Jeff Thompson6c729a22013-12-20 10:37:59 -080046 bool operator == (const OID& oid) const
Jeff Thompsonc0573432013-09-19 17:41:36 -070047 {
48 return equal(oid);
49 }
50
Jeff Thompson6c729a22013-12-20 10:37:59 -080051 bool operator != (const OID& oid) const
Jeff Thompsonc0573432013-09-19 17:41:36 -070052 {
53 return !equal(oid);
54 }
Alexander Afanasyev0ea6e082013-12-26 15:16:37 -080055
56 void
57 encode(CryptoPP::BufferedTransformation &out) const;
58
59 void
60 decode(CryptoPP::BufferedTransformation &in);
Jeff Thompsonc0573432013-09-19 17:41:36 -070061
62private:
Jeff Thompson6c729a22013-12-20 10:37:59 -080063 bool equal(const OID& oid) const;
Jeff Thompsonc0573432013-09-19 17:41:36 -070064
65 std::vector<int> oid_;
66};
67
68}
69
70#endif