blob: 4ce959834bf1629ac2eee97bd4c6197526a78515 [file] [log] [blame]
Jeff Thompson25b4e612013-10-10 16:03:24 -07001/* -*- 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
11using namespace std;
12
13namespace ndn {
14
15Blob::Blob(const struct ndn_Blob& blobStruct)
16 : ptr_lib::shared_ptr<const std::vector<uint8_t> >(new std::vector<uint8_t>(blobStruct.value, blobStruct.value + blobStruct.length))
17{
18}
19
20void
21Blob::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}