Jeff Thompson | c057343 | 2013-09-19 17:41:36 -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 | * @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 Thompson | e589c3f | 2013-10-12 17:30:50 -0700 | [diff] [blame] | 10 | #define NDN_OID_HPP |
Jeff Thompson | c057343 | 2013-09-19 17:41:36 -0700 | [diff] [blame] | 11 | |
| 12 | #include <vector> |
| 13 | #include <string> |
| 14 | |
Alexander Afanasyev | 0ea6e08 | 2013-12-26 15:16:37 -0800 | [diff] [blame^] | 15 | namespace CryptoPP { class BufferedTransformation; } |
| 16 | |
Jeff Thompson | c057343 | 2013-09-19 17:41:36 -0700 | [diff] [blame] | 17 | namespace ndn { |
| 18 | |
| 19 | class OID { |
| 20 | public: |
| 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 Thompson | 6c729a2 | 2013-12-20 10:37:59 -0800 | [diff] [blame] | 44 | toString() const; |
Jeff Thompson | c057343 | 2013-09-19 17:41:36 -0700 | [diff] [blame] | 45 | |
Jeff Thompson | 6c729a2 | 2013-12-20 10:37:59 -0800 | [diff] [blame] | 46 | bool operator == (const OID& oid) const |
Jeff Thompson | c057343 | 2013-09-19 17:41:36 -0700 | [diff] [blame] | 47 | { |
| 48 | return equal(oid); |
| 49 | } |
| 50 | |
Jeff Thompson | 6c729a2 | 2013-12-20 10:37:59 -0800 | [diff] [blame] | 51 | bool operator != (const OID& oid) const |
Jeff Thompson | c057343 | 2013-09-19 17:41:36 -0700 | [diff] [blame] | 52 | { |
| 53 | return !equal(oid); |
| 54 | } |
Alexander Afanasyev | 0ea6e08 | 2013-12-26 15:16:37 -0800 | [diff] [blame^] | 55 | |
| 56 | void |
| 57 | encode(CryptoPP::BufferedTransformation &out) const; |
| 58 | |
| 59 | void |
| 60 | decode(CryptoPP::BufferedTransformation &in); |
Jeff Thompson | c057343 | 2013-09-19 17:41:36 -0700 | [diff] [blame] | 61 | |
| 62 | private: |
Jeff Thompson | 6c729a2 | 2013-12-20 10:37:59 -0800 | [diff] [blame] | 63 | bool equal(const OID& oid) const; |
Jeff Thompson | c057343 | 2013-09-19 17:41:36 -0700 | [diff] [blame] | 64 | |
| 65 | std::vector<int> oid_; |
| 66 | }; |
| 67 | |
| 68 | } |
| 69 | |
| 70 | #endif |