libkazv
local-echo.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of libkazv.
3  * SPDX-FileCopyrightText: 2023 tusooa <tusooa@kazv.moe>
4  * SPDX-License-Identifier: AGPL-3.0-or-later
5  */
6 
7 #pragma once
8 #include <libkazv-config.hpp>
9 
10 #include <boost/serialization/split_free.hpp>
11 #include "event.hpp"
12 
13 namespace Kazv
14 {
19  {
20  enum Status
21  {
24  };
25 
26  std::string txnId;
29  };
30 
31  inline bool operator==(const LocalEchoDesc &a, const LocalEchoDesc &b)
32  {
33  return a.txnId == b.txnId
34  && a.event == b.event
35  && a.status == b.status;
36  }
37 
38  inline bool operator!=(const LocalEchoDesc &a, const LocalEchoDesc &b)
39  {
40  return !(a == b);
41  }
42 }
43 
44 namespace boost::serialization
45 {
46  template<class Archive>
47  void save(Archive &ar, const Kazv::LocalEchoDesc &d, std::uint32_t const version)
48  {
49  using namespace Kazv;
50  LocalEchoDesc::Status dummyStatus{LocalEchoDesc::Failed};
51  ar
52  & d.txnId
53  & d.event
54  & dummyStatus
55  ;
56  }
57 
58  template<class Archive>
59  void load(Archive &ar, Kazv::LocalEchoDesc &d, std::uint32_t const version)
60  {
61  using namespace Kazv;
62  LocalEchoDesc::Status dummyStatus{LocalEchoDesc::Failed};
63  ar
64  & d.txnId
65  & d.event
66  & dummyStatus
67  ;
68  d.status = LocalEchoDesc::Failed;
69  }
70 
71  template<class Archive>
72  void serialize(Archive &ar, Kazv::LocalEchoDesc &d, std::uint32_t const version)
73  {
74  using boost::serialization::split_free;
75  split_free(ar, d, version);
76  }
77 }
78 
79 BOOST_CLASS_VERSION(Kazv::LocalEchoDesc, 0)
boost::serialization::serialize
void serialize(Archive &ar, immer::array< T, MP > &v, const unsigned int version)
Definition: immer-array.hpp:58
Kazv::operator!=
bool operator!=(BaseJob a, BaseJob b)
Definition: basejob.cpp:292
event.hpp
Kazv::operator==
bool operator==(BaseJob a, BaseJob b)
Definition: basejob.cpp:280
Kazv
Definition: location.hpp:10
Kazv::LocalEchoDesc::Sending
@ Sending
Definition: local-echo.hpp:22
Kazv::LocalEchoDesc::status
Status status
Definition: local-echo.hpp:28
Kazv::LocalEchoDesc::txnId
std::string txnId
Definition: local-echo.hpp:26
boost::serialization
Definition: immer-array.hpp:17
boost::serialization::save
void save(Archive &ar, const immer::array< T, MP > &v, const unsigned int)
Definition: immer-array.hpp:22
Kazv::LocalEchoDesc::event
Event event
Definition: local-echo.hpp:27
Kazv::LocalEchoDesc::Failed
@ Failed
Definition: local-echo.hpp:23
Kazv::Event
Definition: event.hpp:20
Kazv::LocalEchoDesc::Status
Status
Definition: local-echo.hpp:20
boost::serialization::load
void load(Archive &ar, immer::array< T, MP > &v, const unsigned int)
Definition: immer-array.hpp:35
libkazv-config.hpp
Kazv::LocalEchoDesc
Describes a local echo.
Definition: local-echo.hpp:18