SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
handler_data.h
Go to the documentation of this file.
1 /*
2  * SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3  * License details at <https://github.com/kashirin-alex/swc-db/#license>
4  */
5 
6 
7 #ifndef swcdb_db_protocol_common_req_handler_data_h
8 #define swcdb_db_protocol_common_req_handler_data_h
9 
10 
12 
13 
14 namespace SWC { namespace Comm { namespace Protocol {
15 namespace Common { namespace Req {
16 
17 
18 template<typename CbT>
19 struct function {
20  typedef function* Ptr;
21 
22  static Ptr cast(void* _datap) noexcept {
23  return reinterpret_cast<Ptr>(_datap);
24  }
25 
27  CbT cb;
28 
30  function(SWC::client::Clients::Ptr& a_clients, const CbT& a_cb)
31  : clients(a_clients), cb(a_cb) {
32  }
33 
35  function(SWC::client::Clients::Ptr& a_clients, CbT&& a_cb) noexcept
36  : clients(a_clients), cb(std::move(a_cb)) {
37  }
38 
39  ~function() noexcept { }
40 
43  return clients;
44  }
45 
47  bool valid() noexcept {
48  return true;
49  }
50 
51  template<typename... ArgsT>
53  void callback(ArgsT&&... args) {
54  cb(this, args...);
55  }
56 
57 };
58 
59 
60 }}}}}
61 
62 
63 #endif // swcdb_db_protocol_common_req_handler_data_h
SWC::Comm::Protocol::Common::Req::function::callback
SWC_CAN_INLINE void callback(ArgsT &&... args)
Definition: handler_data.h:53
Clients.h
SWC::Comm::Protocol::Common::Req::function::cb
CbT cb
Definition: handler_data.h:27
SWC::client::Clients::Ptr
ClientsPtr Ptr
Definition: Clients.h:58
SWC::Comm::Protocol::Common::Req::function::~function
~function() noexcept
Definition: handler_data.h:39
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Comm::Protocol::Common::Req::function::valid
SWC_CAN_INLINE bool valid() noexcept
Definition: handler_data.h:47
SWC::Comm::Protocol::Common::Req::function::clients
SWC::client::Clients::Ptr clients
Definition: handler_data.h:26
SWC::Comm::Protocol::Common::Req::function::cast
static Ptr cast(void *_datap) noexcept
Definition: handler_data.h:22
SWC::Comm::Protocol::Common::Req::function
Definition: handler_data.h:19
SWC::Comm::Protocol::Common::Req::function::get_clients
SWC_CAN_INLINE SWC::client::Clients::Ptr & get_clients() noexcept
Definition: handler_data.h:42
SWC::Comm::Protocol::Common::Req::function::Ptr
function * Ptr
Definition: handler_data.h:20