Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -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: Jeff Thompson <jefft0@remap.ucla.edu> |
| 5 | * See COPYING for copyright and distribution information. |
| 6 | */ |
| 7 | |
| 8 | #include "../c/util/blob.h" |
| 9 | #include <ndn-cpp/util/blob.hpp> |
| 10 | |
| 11 | using namespace std; |
| 12 | |
| 13 | namespace ndn { |
| 14 | |
| 15 | Blob::Blob(const struct ndn_Blob& blobStruct) |
Jeff Thompson | 4affbf5 | 2013-10-18 14:36:46 -0700 | [diff] [blame] | 16 | : ptr_lib::shared_ptr<const vector<uint8_t> >(new vector<uint8_t>(blobStruct.value, blobStruct.value + blobStruct.length)) |
Jeff Thompson | 25b4e61 | 2013-10-10 16:03:24 -0700 | [diff] [blame] | 17 | { |
| 18 | } |
| 19 | |
| 20 | void |
| 21 | Blob::get(struct ndn_Blob& blobStruct) const |
| 22 | { |
| 23 | blobStruct.length = size(); |
| 24 | if (size() > 0) |
| 25 | blobStruct.value = (uint8_t*)buf(); |
| 26 | else |
| 27 | blobStruct.value = 0; |
| 28 | } |
| 29 | |
| 30 | } |