binary-xml-encoder.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_BINARYXMLENCODER_HPP
23 #define NDN_BINARYXMLENCODER_HPP
24 
25 #include <vector>
26 #include <ndn-cpp/common.hpp>
27 #include "../util/dynamic-uint8-vector.hpp"
28 #include "../c/encoding/binary-xml-encoder.h"
29 
30 namespace ndn {
31 
36 public:
41  BinaryXmlEncoder(size_t initialLength = 16)
42  : output_(16)
43  {
44  ndn_BinaryXmlEncoder_initialize(this, &output_);
45  }
46 
51  const ptr_lib::shared_ptr<std::vector<uint8_t> >&
53  {
54  output_.get()->resize(offset);
55  return output_.get();
56  }
57 
58  DynamicUInt8Vector output_;
59 };
60 
61 }
62 
63 #endif
Copyright (C) 2013-2015 Regents of the University of California.
Definition: common.hpp:35
Copyright (C) 2013-2015 Regents of the University of California.
Definition: binary-xml-encoder.h:36
size_t offset
the offset into output.array for the next encoding
Definition: binary-xml-encoder.h:38
A BinaryXmlEncoder extends a C ndn_BinaryXmlEncoder struct and wraps related functions.
Definition: binary-xml-encoder.hpp:35
ptr_lib::shared_ptr< std::vector< uint8_t > > & get()
Get the shared_ptr to the allocated vector.
Definition: dynamic-uint8-vector.hpp:126
BinaryXmlEncoder(size_t initialLength=16)
Initialize the base ndn_BinaryXmlEncoder struct with the initialLength.
Definition: binary-xml-encoder.hpp:41
const ptr_lib::shared_ptr< std::vector< uint8_t > > & getOutput()
Resize the output vector to the correct encoding length and return.
Definition: binary-xml-encoder.hpp:52
A DynamicUInt8Vector extends ndn_DynamicUInt8Array to hold a shared_ptr > for use wit...
Definition: dynamic-uint8-vector.hpp:36