27 BOOST_CONCEPT_ASSERT((boost::EqualityComparable<DelegationList>));
50 DelegationList::isValidTlvType(uint32_t type)
61 template<encoding::Tag TAG>
65 if (!isValidTlvType(type)) {
67 " while encoding DelegationList"));
70 if (this->
size() == 0) {
85 for (
auto i = m_dels.rbegin(); i != m_dels.rend(); ++i) {
87 delLen += i->name.wireEncode(encoder);
89 delLen += encoder.prependVarNumber(delLen);
93 totalLen += encoder.prependVarNumber(totalLen);
94 totalLen += encoder.prependVarNumber(type);
99 DelegationList::wireEncode<encoding::EncoderTag>(
EncodingBuffer&, uint32_t)
const;
102 DelegationList::wireEncode<encoding::EstimatorTag>(
EncodingEstimator&, uint32_t)
const;
107 if (!isValidTlvType(block.
type())) {
111 m_isSorted = wantSort;
115 for (
const auto& del : block.
elements()) {
121 auto val = del.elements_begin();
125 uint64_t preference = 0;
134 if (val == del.elements_end() || val->type() !=
tlv::Name) {
139 name.wireDecode(*val);
145 this->insertImpl(preference,
name);
148 if (this->
size() == 0) {
160 std::vector<Delegation> dels;
165 this->insertImpl(del.preference, del.name);
173 switch (onConflict) {
176 this->insertImpl(preference,
name);
179 this->insertImpl(preference,
name);
182 if (!std::any_of(m_dels.begin(), m_dels.end(),
184 this->insertImpl(preference,
name);
190 NDN_THROW(std::invalid_argument(
"Unknown InsertConflictResolution"));
194 DelegationList::insertImpl(uint64_t preference,
const Name&
name)
197 m_dels.push_back({preference,
name});
201 Delegation del{preference,
name};
202 auto pos = std::upper_bound(m_dels.begin(), m_dels.end(), del);
203 m_dels.insert(pos, del);
207 DelegationList::eraseImpl(optional<uint64_t> preference,
const Name&
name)
210 for (
auto i = m_dels.begin(); i != m_dels.end();) {
211 if ((!preference || i->preference == *preference) &&