33 static_assert(std::is_base_of<tlv::Error, FaceQueryFilter::Error>::value,
34 "FaceQueryFilter::Error must inherit from tlv::Error");
38 , m_hasUriScheme(false)
39 , m_hasRemoteUri(false)
40 , m_hasLocalUri(false)
41 , m_hasFaceScope(false)
42 , m_hasFacePersistency(false)
43 , m_hasLinkType(false)
52 template<encoding::Tag TAG>
56 size_t totalLength = 0;
63 if (m_hasFacePersistency) {
75 reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
80 reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
85 reinterpret_cast<const uint8_t*>(m_uriScheme.c_str()), m_uriScheme.size());
93 totalLength += encoder.prependVarNumber(totalLength);
116 m_wire = buffer.block();
125 BOOST_THROW_EXCEPTION(
Error(
"expecting FaceQueryFilter block"));
142 m_uriScheme.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
143 m_hasUriScheme =
true;
147 m_hasUriScheme =
false;
151 m_remoteUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
152 m_hasRemoteUri =
true;
156 m_hasRemoteUri =
false;
160 m_localUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
161 m_hasLocalUri =
true;
165 m_hasLocalUri =
false;
170 m_hasFaceScope =
true;
174 m_hasFaceScope =
false;
179 m_hasFacePersistency =
true;
183 m_hasFacePersistency =
false;
188 m_hasLinkType =
true;
192 m_hasLinkType =
false;
218 m_uriScheme = uriScheme;
219 m_hasUriScheme =
true;
227 m_hasUriScheme =
false;
235 m_remoteUri = remoteUri;
236 m_hasRemoteUri =
true;
244 m_hasRemoteUri =
false;
252 m_localUri = localUri;
253 m_hasLocalUri =
true;
261 m_hasLocalUri =
false;
269 m_faceScope = faceScope;
270 m_hasFaceScope =
true;
278 m_hasFaceScope =
false;
286 m_facePersistency = facePersistency;
287 m_hasFacePersistency =
true;
295 m_hasFacePersistency =
false;
303 m_linkType = linkType;
304 m_hasLinkType =
true;
312 m_hasLinkType =
false;
319 os <<
"FaceQueryFilter(";
321 os <<
"FaceID: " << filter.
getFaceId() <<
",\n";
333 os <<
"LocalUri: " << filter.
getLocalUri() <<
",\n";
345 os <<
"LinkType: " << filter.
getLinkType() <<
",\n";
LinkType getLinkType() const
bool hasFaceScope() const
element_const_iterator elements_begin() const
bool hasWire() const
Check if the Block has fully encoded wire.
Copyright (c) 2011-2015 Regents of the University of California.
FaceQueryFilter & unsetLocalUri()
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Helper to prepend TLV block type type containing non-negative integer value.
const std::string & getLocalUri() const
EncodingImpl< EstimatorTag > EncodingEstimator
FaceScope getFaceScope() const
element_const_iterator elements_end() const
void parse() const
Parse wire buffer into subblocks.
Class representing a wire element of NDN-TLV packet format.
const std::string & getRemoteUri() const
bool hasRemoteUri() const
uint64_t readNonNegativeInteger(const Block &block)
Helper to read a non-negative integer from a block.
FaceQueryFilter & unsetFaceScope()
FaceQueryFilter & setLocalUri(const std::string &localUri)
bool hasUriScheme() const
EncodingImpl< EncoderTag > EncodingBuffer
Copyright (c) 2011-2015 Regents of the University of California.
uint64_t getFaceId() const
const Block & wireEncode() const
encode FaceQueryFilter
FaceQueryFilter & setFaceScope(FaceScope faceScope)
FaceQueryFilter & unsetFaceId()
element_container::const_iterator element_const_iterator
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
void reset()
Reset wire buffer of the element.
FaceQueryFilter & setUriScheme(const std::string &uriScheme)
FaceQueryFilter & unsetFacePersistency()
represents Face Query Filter
FaceQueryFilter & unsetUriScheme()
FaceQueryFilter & unsetRemoteUri()
FaceQueryFilter & setRemoteUri(const std::string &remoteUri)
FaceQueryFilter & setFaceId(uint64_t faceId)
const std::string & getUriScheme() const
FaceQueryFilter & setLinkType(LinkType linkType)
FaceQueryFilter & setFacePersistency(FacePersistency facePersistency)
FacePersistency getFacePersistency() const
a concept check for TLV abstraction with .wireEncode method
bool hasFacePersistency() const
void wireDecode(const Block &wire)
decode FaceQueryFilter
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
FaceQueryFilter & unsetLinkType()