NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
bool-sink.cpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #include "bool-sink.hpp"
23 
24 namespace ndn {
25 namespace security {
26 namespace transform {
27 
28 BoolSink::BoolSink(bool& value)
29  : m_hasValue(false)
30  , m_value(value)
31 {
32 }
33 
34 size_t
35 BoolSink::doWrite(const uint8_t* buf, size_t size)
36 {
37  if (!m_hasValue && size > 0) {
38  m_value = (buf[0] != 0);
39  m_hasValue = true;
40  }
41  return size;
42 }
43 
44 void
45 BoolSink::doEnd()
46 {
47  // nothing to do.
48 }
49 
50 unique_ptr<Sink>
51 boolSink(bool& value)
52 {
53  return make_unique<BoolSink>(value);
54 }
55 
56 } // namespace transform
57 } // namespace security
58 } // namespace ndn
Copyright (c) 2011-2015 Regents of the University of California.
BoolSink(bool &value)
Create a bool sink whose output will be stored in value.
Definition: bool-sink.cpp:28
unique_ptr< Sink > boolSink(bool &value)
Definition: bool-sink.cpp:51