NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
buffer.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
24 #include "buffer.hpp"
25 
26 namespace ndn {
27 
28 #if NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE
29 static_assert(std::is_nothrow_move_constructible<Buffer>::value,
30  "Buffer must be MoveConstructible with noexcept");
31 #endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE
32 
33 #if NDN_CXX_HAVE_IS_NOTHROW_MOVE_ASSIGNABLE
34 static_assert(std::is_nothrow_move_assignable<Buffer>::value,
35  "Buffer must be MoveAssignable with noexcept");
36 #endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_ASSIGNABLE
37 
39 {
40 }
41 
42 Buffer::Buffer(size_t size)
43  : std::vector<uint8_t>(size, 0)
44 {
45 }
46 
47 Buffer::Buffer(const void* buf, size_t length)
48  : std::vector<uint8_t>(reinterpret_cast<const uint8_t*>(buf),
49  reinterpret_cast<const uint8_t*>(buf) + length)
50 {
51 }
52 
53 } // namespace ndn
Copyright (c) 2011-2015 Regents of the University of California.
Buffer()
Creates an empty buffer.
Definition: buffer.cpp:38
STL namespace.
uint8_t * buf()
Definition: buffer.hpp:87