destination.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_TLV_DESTINATION_HPP
23 #define NLSR_TLV_DESTINATION_HPP
24 
26 
27 #include <ndn-cxx/util/time.hpp>
28 #include <ndn-cxx/encoding/block.hpp>
29 #include <ndn-cxx/encoding/encoding-buffer.hpp>
30 #include <ndn-cxx/encoding/tlv.hpp>
31 #include <ndn-cxx/name.hpp>
32 #include <boost/throw_exception.hpp>
33 
34 #include <list>
35 
36 namespace nlsr {
37 namespace tlv {
38 
47 {
48 public:
49  class Error : public ndn::tlv::Error
50  {
51  public:
52  explicit
53  Error(const std::string& what)
54  : ndn::tlv::Error(what)
55  {
56  }
57  };
58 
59  Destination();
60 
61  explicit
62  Destination(const ndn::Block& block);
63 
64  const ndn::Name&
65  getName() const
66  {
67  return m_name;
68  }
69 
71  setName(const ndn::Name& name)
72  {
73  m_name = name;
74  m_wire.reset();
75  return *this;
76  }
77 
78  template<ndn::encoding::Tag TAG>
79  size_t
80  wireEncode(ndn::EncodingImpl<TAG>& block) const;
81 
82  const ndn::Block&
83  wireEncode() const;
84 
85  void
86  wireDecode(const ndn::Block& wire);
87 
88 private:
89  ndn::Name m_name;
90 
91  mutable ndn::Block m_wire;
92 };
93 
95 
96 std::ostream&
97 operator<<(std::ostream& os, const Destination& destination);
98 
99 std::shared_ptr<Destination>
100 makeDes(const RoutingTableEntry& rte);
101 
102 } // namespace tlv
103 } // namespace nlsr
104 
105 #endif // NLSR_TLV_DESTINATION_HPP
Definition: tlv-nlsr.hpp:27
Data abstraction for Destination.
Definition: destination.hpp:46
const ndn::Block & wireEncode() const
Definition: destination.cpp:60
std::shared_ptr< Destination > makeDes(const RoutingTableEntry &rte)
Error(const std::string &what)
Definition: destination.hpp:53
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
const ndn::Name & getName() const
Definition: destination.hpp:65
void wireDecode(const ndn::Block &wire)
Definition: destination.cpp:78
std::ostream & operator<<(std::ostream &os, const AdjacencyLsa &adjacencyLsa)
Destination & setName(const ndn::Name &name)
Definition: destination.hpp:71
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(AdjacencyLsa)