22#ifndef NLSR_NAME_PREFIX_LIST_HPP
23#define NLSR_NAME_PREFIX_LIST_HPP
27#include <ndn-cxx/name.hpp>
29#include <boost/operators.hpp>
31#include <initializer_list>
39class PrefixInfo :
private boost::equality_comparable<PrefixInfo>
42 class Error :
public ndn::tlv::Error
45 using ndn::tlv::Error::Error;
71 template<ndn::encoding::Tag TAG>
73 wireEncode(ndn::EncodingImpl<TAG>& block)
const;
91 os <<
"Prefix Info: (" << info.
getName() <<
", " << info.
getCost() <<
")\n";
96 ndn::Name m_prefixName;
99 mutable ndn::Block m_wire;
115 insert(
const ndn::Name& name,
const std::string& source =
"",
double cost = 0);
125 erase(
const ndn::Name& name,
const std::string& source =
"");
130 return m_namesSources.size();
139 std::list<PrefixInfo>
146 std::set<std::string>
147 getSources(
const ndn::Name& name)
const;
153 m_namesSources.clear();
167 struct PrefixInfoSource
169 std::set<std::string> sources;
176 std::map<ndn::Name, PrefixInfoSource> m_namesSources;
friend std::ostream & operator<<(std::ostream &os, const NamePrefixList &list)
std::list< PrefixInfo > getPrefixInfo() const
bool erase(const ndn::Name &name, const std::string &source="")
Deletes name and source combination.
const PrefixInfo & getPrefixInfoForName(const ndn::Name &name) const
friend bool operator==(const NamePrefixList &lhs, const NamePrefixList &rhs)
std::list< ndn::Name > getNames() const
bool insert(const ndn::Name &name, const std::string &source="", double cost=0)
Inserts name and source combination.
const ndn::Block & wireEncode() const
const ndn::Name & getName() const
void wireDecode(const ndn::Block &wire)
PrefixInfo(const ndn::Block &block)
friend bool operator==(const PrefixInfo &lhs, const PrefixInfo &rhs)
friend std::ostream & operator<<(std::ostream &os, const PrefixInfo &info)
PrefixInfo(const ndn::Name &name, double cost)
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Adjacent)