OGLplus  (0.59.0) a C++ wrapper for rendering APIs

build_info.hpp
Go to the documentation of this file.
1 
9 #ifndef EAGINE_MESSAGE_BUS_SERVICE_BUILD_INFO_HPP
10 #define EAGINE_MESSAGE_BUS_SERVICE_BUILD_INFO_HPP
11 
12 #include "../../bool_aggregate.hpp"
13 #include "../../main_ctx.hpp"
14 #include "../../maybe_unused.hpp"
15 #include "../../serialize/type/build_info.hpp"
16 #include "../service.hpp"
17 #include <array>
18 #include <chrono>
19 
20 namespace eagine::msgbus {
21 //------------------------------------------------------------------------------
22 template <typename Base = subscriber>
23 class build_info_provider : public Base {
24  using This = build_info_provider;
25 
26 protected:
27  using Base::Base;
28 
29  void add_methods() {
30  Base::add_methods();
31 
32  Base::add_method(_respond(
33  EAGINE_MSG_ID(eagiBldInf, response),
34  &main_ctx::get(),
36  main_ctx, build))[EAGINE_MSG_ID(eagiBldInf, request)]);
37  }
38 
39 private:
40  default_function_skeleton<const build_info&() noexcept, 256> _respond;
41 };
42 //------------------------------------------------------------------------------
43 template <typename Base = subscriber>
44 class build_info_consumer : public Base {
45 
46  using This = build_info_consumer;
47 
48 protected:
49  using Base::Base;
50 
51  void add_methods() {
52  Base::add_methods();
53 
54  Base::add_method(_build(
55  this,
57  on_build_info_received))[EAGINE_MSG_ID(eagiBldInf, response)]);
58  }
59 
60 public:
61  void query_build_info(identifier_t endpoint_id) {
62  _build.invoke_on(
63  this->bus(), endpoint_id, EAGINE_MSG_ID(eagiBldInf, request));
64  }
65 
66  virtual void on_build_info_received(const result_context&, build_info&&) = 0;
67 
68 private:
69  default_callback_invoker<build_info(), 32> _build;
70 };
71 //------------------------------------------------------------------------------
72 } // namespace eagine::msgbus
73 
74 #endif // EAGINE_MESSAGE_BUS_SERVICE_BUILD_INFO_HPP
#define EAGINE_MSG_ID(API, NAME)
Macro for instantiating objects of static_message_id.
Definition: message_id.hpp:148
Message bus code is placed in this namespace.
Definition: eagine.hpp:58
#define EAGINE_THIS_MEM_FUNC_C(FUNC)
Macro for creating object of member_function_constant in member functions.
Definition: mem_func_const.hpp:206
std::uint64_t identifier_t
The underlying integer type for eagine::identifier.
Definition: identifier_t.hpp:19
auto bus() noexcept -> auto &
Returns a reference to the associated endpoint.
Definition: subscriber.hpp:38
static auto get() noexcept -> main_ctx &
Returns the single instance.
Definition: main_ctx.hpp:64
#define EAGINE_MEM_FUNC_C(CLASS, FUNC)
Macro for creating object of member_function_constant.
Definition: mem_func_const.hpp:186
@ build_info
The build information has appeared or changed.

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).