All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
content-meta-info.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
22 #ifndef NDN_CONTENT_META_INFO_HPP
23 #define NDN_CONTENT_META_INFO_HPP
24 
25 #include <ndn-cpp/util/blob.hpp>
26 
27 namespace ndntools {
28 
34 public:
39  {
40  clear();
41  }
42 
47  const std::string&
48  getContentType() const { return contentType_; }
49 
56  getTimestamp() const { return timestamp_; }
57 
62  bool
63  getHasSegments() const { return hasSegments_; }
64 
69  const ndn::Blob&
70  getOther() const { return other_; }
71 
78  setContentType(const std::string& contentType)
79  {
80  contentType_ = contentType;
81  return *this;
82  }
83 
91  {
92  timestamp_ = timestamp;
93  return *this;
94  }
95 
102  setHasSegments(bool hasSegments)
103  {
104  hasSegments_ = hasSegments;
105  return *this;
106  }
107 
114  setOther(const ndn::Blob& other)
115  {
116  other_ = other;
117  return *this;
118  }
119 
123  void
124  clear();
125 
130  ndn::Blob
131  wireEncode() const;
132 
138  void
139  wireDecode(const uint8_t *input, size_t inputLength);
140 
145  void
146  wireDecode(const std::vector<uint8_t>& input)
147  {
148  wireDecode(&input[0], input.size());
149  }
150 
155  void
156  wireDecode(const ndn::Blob& input)
157  {
158  wireDecode(input.buf(), input.size());
159  }
160 
161 private:
162  std::string contentType_;
163  ndn::MillisecondsSince1970 timestamp_;
164  bool hasSegments_;
165  ndn::Blob other_;
166 };
167 
168 }
169 
170 #endif
ContentMetaInfo()
Create a ContentMetaInfo where all the fields have default unspecified values.
Definition: content-meta-info.hpp:38
void wireDecode(const ndn::Blob &input)
Decode the input and update this Schedule.
Definition: content-meta-info.hpp:156
ContentMetaInfo & setContentType(const std::string &contentType)
Set the content type.
Definition: content-meta-info.hpp:78
void wireDecode(const std::vector< uint8_t > &input)
Decode the input and update this Schedule.
Definition: content-meta-info.hpp:146
ContentMetaInfo & setTimestamp(ndn::MillisecondsSince1970 timestamp)
Set the time stamp.
Definition: content-meta-info.hpp:90
ndn::Blob wireEncode() const
Encode this ContentMetaInfo.
ContentMetaInfo represents the information in the _meta packet of a Generalized Content.
Definition: content-meta-info.hpp:33
const ndn::Blob & getOther() const
Get the Blob containing the optional other info.
Definition: content-meta-info.hpp:70
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
Definition: blob.hpp:42
const uint8_t * buf() const
Return a const pointer to the first byte of the immutable byte array, or 0 if the pointer is null...
Definition: blob.hpp:159
size_t size() const
Return the length of the immutable byte array.
Definition: blob.hpp:147
double MillisecondsSince1970
The calendar time represented as the number of milliseconds since 1/1/1970.
Definition: common.hpp:119
ndn::MillisecondsSince1970 getTimestamp() const
Get the time stamp.
Definition: content-meta-info.hpp:56
ContentMetaInfo & setHasSegments(bool hasSegments)
Set the hasSegments flag.
Definition: content-meta-info.hpp:102
void wireDecode(const uint8_t *input, size_t inputLength)
Decode the input and update this ContentMetaInfo.
ContentMetaInfo & setOther(const ndn::Blob &other)
Set the Blob containing the optional other info.
Definition: content-meta-info.hpp:114
void clear()
Set all the fields to their default unspecified values.
bool getHasSegments() const
Get the hasSegments flag.
Definition: content-meta-info.hpp:63
const std::string & getContentType() const
Get the content type.
Definition: content-meta-info.hpp:48