blob: 7d4e2189f84131d24ec3977d6787b67047c6b3a3 [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)
Jeff Thompson4affbf52013-10-18 14:36:46 -070016 : ptr_lib::shared_ptr<const vector<uint8_t> >(new vector<uint8_t>(blobStruct.value, blobStruct.value + blobStruct.length))
Jeff Thompson25b4e612013-10-10 16:03:24 -070017{
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}