state.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014-2020, The University of Memphis
4  *
5  * This file is part of PSync.
6  * See AUTHORS.md for complete list of PSync authors and contributors.
7  *
8  * PSync is free software: you can redistribute it and/or modify it under the terms
9  * of the GNU Lesser General Public License as published by the Free Software Foundation,
10  * either version 3 of the License, or (at your option) any later version.
11  *
12  * PSync is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
13  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  * PURPOSE. See the GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License along with
17  * PSync, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
18  **/
19 
20 #ifndef PSYNC_STATE_HPP
21 #define PSYNC_STATE_HPP
22 
23 #include <ndn-cxx/name.hpp>
24 
25 namespace psync {
26 
27 namespace tlv {
28 
29 enum {
31 };
32 
33 } // namespace tlv
34 
35 class State
36 {
37 public:
38  explicit State(const ndn::Block& block);
39 
40  State() = default;
41 
42  void
43  addContent(const ndn::Name& prefix);
44 
45  const std::vector<ndn::Name>&
46  getContent() const
47  {
48  return m_content;
49  }
50 
51  const ndn::Block&
52  wireEncode() const;
53 
54  template<ndn::encoding::Tag TAG>
55  size_t
56  wireEncode(ndn::EncodingImpl<TAG>& block) const;
57 
58  void
59  wireDecode(const ndn::Block& wire);
60 
61 private:
62  std::vector<ndn::Name> m_content;
63  mutable ndn::Block m_wire;
64 };
65 
66 NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(State);
67 
68 std::ostream&
69 operator<<(std::ostream& os, const State& State);
70 
71 } // namespace psync
72 
73 #endif // PSYNC_STATE_HPP
const std::vector< ndn::Name > & getContent() const
Definition: state.hpp:46
std::ostream & operator<<(std::ostream &out, const BloomFilter &bf)