28 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Selectors>));
33 "Selectors::Error must inherit from tlv::Error");
36 : m_minSuffixComponents(-1)
37 , m_maxSuffixComponents(-1)
39 , m_mustBeFresh(false)
51 return m_minSuffixComponents < 0 &&
52 m_maxSuffixComponents < 0 &&
53 m_publisherPublicKeyLocator.
empty() &&
59 template<encoding::Tag TAG>
63 size_t totalLength = 0;
107 totalLength += encoder.prependVarNumber(totalLength);
126 m_wire = buffer.block();
134 BOOST_THROW_EXCEPTION(
tlv::Error(
"Unexpected TLV type when decoding Selectors"));
144 m_minSuffixComponents = readNonNegativeIntegerAs<int>(*val);
150 m_maxSuffixComponents = readNonNegativeIntegerAs<int>(*val);
168 m_childSelector = readNonNegativeIntegerAs<bool>(*val);
177 m_mustBeFresh =
true;
184 m_minSuffixComponents = minSuffixComponents;
192 m_maxSuffixComponents = maxSuffixComponents;
200 m_publisherPublicKeyLocator = keyLocator;
216 if (childSelector != 0 && childSelector != 1) {
217 BOOST_THROW_EXCEPTION(std::invalid_argument(
"ChildSelector must be 0 or 1"));
219 m_childSelector = childSelector;
227 m_mustBeFresh = mustBeFresh;
void wireDecode(const Block &wire)
Decode the input from wire format.
size_t wireEncode(EncodingImpl< TAG > &encoder) const
prepend wire encoding
Copyright (c) 2011-2015 Regents of the University of California.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
Selectors & setMustBeFresh(bool mustBeFresh)
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
element_const_iterator find(uint32_t type) const
Find the first sub element of specified TLV-TYPE.
element_container::const_iterator element_const_iterator
void wireDecode(const Block &wire)
decode from wire encoding
const int DEFAULT_CHILD_SELECTOR
Represents a TLV element of NDN packet format.
Selectors & setMaxSuffixComponents(int maxSuffixComponents)
Selectors & setExclude(const Exclude &exclude)
const KeyLocator & getPublisherPublicKeyLocator() const
Selectors & setChildSelector(int childSelector)
set ChildSelector
Selectors & setMinSuffixComponents(int minSuffixComponents)
a concept check for TLV abstraction with .wireEncode method
void wireDecode(const Block &wire)
Decode from the wire format.
const Exclude & getExclude() const
int getChildSelector() const
size_t prependEmptyBlock(EncodingImpl< TAG > &encoder, uint32_t type)
Prepend an empty TLV element.
const Block & wireEncode() const
Encode to a wire format.
int getMustBeFresh() const
Abstraction implementing Interest selectors.
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(Exclude)
void reset()
Reset wire buffer of the element.
void parse() const
Parse TLV-VALUE into sub elements.
uint32_t type() const
Get TLV-TYPE.
bool operator==(const Selectors &other) const
size_t wireEncode(EncodingImpl< TAG > &encoder) const
Fast encoding or block size estimation.
int getMinSuffixComponents() const
bool hasWire() const
Check if the Block has fully encoded wire.
element_const_iterator elements_end() const
Equivalent to elements().end()
a concept check for TLV abstraction with .wireEncode method
int getMaxSuffixComponents() const
a concept check for TLV abstraction with .wireDecode method and constructible from Block ...
EncodingImpl< EncoderTag > EncodingBuffer
represents an error in TLV encoding or decoding
EncodingImpl< EstimatorTag > EncodingEstimator
Represents Exclude selector in NDN Interest.
Selectors & setPublisherPublicKeyLocator(const KeyLocator &keyLocator)