coordinate-lsa.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NLSR_TLV_COORDINATE_LSA_HPP
23 #define NLSR_TLV_COORDINATE_LSA_HPP
24 
25 #include "lsa-info.hpp"
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 
33 namespace nlsr {
34 namespace tlv {
35 
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  CoordinateLsa();
60 
61  explicit
62  CoordinateLsa(const ndn::Block& block);
63 
64  const LsaInfo&
65  getLsaInfo() const
66  {
67  return m_lsaInfo;
68  }
69 
71  setLsaInfo(const LsaInfo& lsaInfo)
72  {
73  m_lsaInfo = lsaInfo;
74  m_wire.reset();
75  return *this;
76  }
77 
78  double
80  {
81  return m_hyperbolicRadius;
82  }
83 
85  setHyperbolicRadius(double hyperbolicRadius)
86  {
87  m_hyperbolicRadius = hyperbolicRadius;
88  m_wire.reset();
89  return *this;
90  }
91 
92  const std::vector<double>
94  {
95  return m_hyperbolicAngle;
96  }
97 
99  setHyperbolicAngle(const std::vector<double>& hyperbolicAngle)
100  {
101  m_hyperbolicAngle = hyperbolicAngle;
102  m_wire.reset();
103  return *this;
104  }
105 
115  template<ndn::encoding::Tag TAG>
116  size_t
117  wireEncode(ndn::EncodingImpl<TAG>& block) const;
118 
127  const ndn::Block&
128  wireEncode() const;
129 
133  void
134  wireDecode(const ndn::Block& wire);
135 
136 private:
137  LsaInfo m_lsaInfo;
138  double m_hyperbolicRadius;
139  std::vector<double> m_hyperbolicAngle;
140 
141  mutable ndn::Block m_wire;
142 };
143 
144 std::ostream&
145 operator<<(std::ostream& os, const CoordinateLsa& coordinateLsa);
146 
147 } // namespace tlv
148 } // namespace nlsr
149 
150 #endif // NLSR_TLV_COORDINATE_LSA_HPP
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
Definition: tlv-nlsr.hpp:27
CoordinateLsa & setHyperbolicAngle(const std::vector< double > &hyperbolicAngle)
const LsaInfo & getLsaInfo() const
Data abstraction for CoordinateLsa.
CoordinateLsa & setHyperbolicRadius(double hyperbolicRadius)
const ndn::Block & wireEncode() const
Create a TLV encoding of this object.
Error(const std::string &what)
const std::vector< double > getHyperbolicAngle() const
Data abstraction for LsaInfo.
Definition: lsa-info.hpp:47
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
double getHyperbolicRadius() const
std::ostream & operator<<(std::ostream &os, const AdjacencyLsa &adjacencyLsa)
void wireDecode(const ndn::Block &wire)
Populate this object by decoding the one contained in the given block.
CoordinateLsa & setLsaInfo(const LsaInfo &lsaInfo)