lsdb-status.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_TLV_LSDB_STATUS_HPP
23 #define NLSR_TLV_LSDB_STATUS_HPP
24 
25 #include "adjacency-lsa.hpp"
26 #include "coordinate-lsa.hpp"
27 #include "name-lsa.hpp"
28 
29 #include <ndn-cxx/util/time.hpp>
30 #include <ndn-cxx/encoding/block.hpp>
31 #include <ndn-cxx/encoding/encoding-buffer.hpp>
32 #include <ndn-cxx/encoding/tlv.hpp>
33 #include <ndn-cxx/name.hpp>
34 
35 #include <list>
36 
37 namespace nlsr {
38 namespace tlv {
39 
50 {
51 public:
52  class Error : public ndn::tlv::Error
53  {
54  public:
55  explicit
56  Error(const std::string& what)
57  : ndn::tlv::Error(what)
58  {
59  }
60  };
61 
62  typedef std::list<AdjacencyLsa> AdjacencyLsaList;
63  typedef std::list<CoordinateLsa> CoordinateLsaList;
64  typedef std::list<NameLsa> NameLsaList;
65 
66  LsdbStatus();
67 
68  explicit
69  LsdbStatus(const ndn::Block& block);
70 
71  const std::list<AdjacencyLsa>&
73  {
74  return m_adjacencyLsas;
75  }
76 
77  LsdbStatus&
78  addAdjacencyLsa(const AdjacencyLsa& adjacencyLsa);
79 
80  LsdbStatus&
82 
83  bool
85  {
86  return m_hasAdjacencyLsas;
87  }
88 
89  const std::list<CoordinateLsa>&
91  {
92  return m_coordinateLsas;
93  }
94 
95  LsdbStatus&
96  addCoordinateLsa(const CoordinateLsa& coordinateLsa);
97 
98  LsdbStatus&
100 
101  bool
103  {
104  return m_hasCoordinateLsas;
105  }
106 
107  const std::list<NameLsa>&
108  getNameLsas() const
109  {
110  return m_nameLsas;
111  }
112 
113  LsdbStatus&
114  addNameLsa(const NameLsa& nameLsa);
115 
116  LsdbStatus&
117  clearNameLsas();
118 
119  bool
121  {
122  return m_hasNameLsas;
123  }
124 
135  template<ndn::encoding::Tag TAG>
136  size_t
137  wireEncode(ndn::EncodingImpl<TAG>& block) const;
138 
147  const ndn::Block&
148  wireEncode() const;
149 
153  void
154  wireDecode(const ndn::Block& wire);
155 
156 private:
157  AdjacencyLsaList m_adjacencyLsas;
158  CoordinateLsaList m_coordinateLsas;
159  NameLsaList m_nameLsas;
160 
161  bool m_hasAdjacencyLsas;
162  bool m_hasCoordinateLsas;
163  bool m_hasNameLsas;
164 
165  mutable ndn::Block m_wire;
166 };
167 
168 std::ostream&
169 operator<<(std::ostream& os, const LsdbStatus& lsdbStatus);
170 
171 } // namespace tlv
172 } // namespace nlsr
173 
174 #endif // NLSR_TLV_LSDB_STATUS_HPP
std::list< AdjacencyLsa > AdjacencyLsaList
Definition: lsdb-status.hpp:62
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
Definition: tlv-nlsr.hpp:27
LsdbStatus & clearAdjacencyLsas()
Definition: lsdb-status.cpp:58
void wireDecode(const ndn::Block &wire)
Populate this object by decoding the one contained in the given block.
const std::list< CoordinateLsa > & getCoordinateLsas() const
Definition: lsdb-status.hpp:90
Data abstraction for CoordinateLsa.
const ndn::Block & wireEncode() const
Create a TLV encoding of this object.
LsdbStatus & clearNameLsas()
Definition: lsdb-status.cpp:92
std::list< NameLsa > NameLsaList
Definition: lsdb-status.hpp:64
LsdbStatus & addCoordinateLsa(const CoordinateLsa &coordinateLsa)
Definition: lsdb-status.cpp:66
LsdbStatus & clearCoordinateLsas()
Definition: lsdb-status.cpp:75
LsdbStatus & addAdjacencyLsa(const AdjacencyLsa &adjacencyLsa)
Definition: lsdb-status.cpp:49
Data abstraction for NameLsa.
Definition: name-lsa.hpp:47
std::list< CoordinateLsa > CoordinateLsaList
Definition: lsdb-status.hpp:63
const std::list< AdjacencyLsa > & getAdjacencyLsas() const
Definition: lsdb-status.hpp:72
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
Data abstraction for AdjacencyLsa.
Data abstraction for LsdbStatus.
Definition: lsdb-status.hpp:49
LsdbStatus & addNameLsa(const NameLsa &nameLsa)
Definition: lsdb-status.cpp:83
std::ostream & operator<<(std::ostream &os, const AdjacencyLsa &adjacencyLsa)
const std::list< NameLsa > & getNameLsas() const
Error(const std::string &what)
Definition: lsdb-status.hpp:56