Dripline-Cpp  v2.10.11
Dripline Implementation in C++
reply_cache.cc
Go to the documentation of this file.
1 /*
2  * reply_cache.cc
3  *
4  * Created on: Dec 31, 2019
5  * Author: N.S. Oblath
6  */
7 
8 #define DRIPLINE_API_EXPORTS
9 
10 #include "reply_cache.hh"
11 
12 namespace dripline
13 {
14 
15  void DRIPLINE_API set_reply_cache( const return_code& a_code, const std::string& a_message, scarab::param_ptr_t a_payload_ptr )
16  {
17  reply_cache::get_instance()->set_cache( a_code, a_message, std::move(a_payload_ptr) );
18  return;
19  }
20 
22  throw_reply()
23  {}
24 
26  throw_reply()
27  {
28  std::unique_lock< std::mutex > t_lock( f_mutex );
29  throw_reply::operator=( std::move(a_orig) );
30  }
31 
33  {
34  std::unique_lock< std::mutex > t_lock( f_mutex );
35  throw_reply::operator=( std::move(a_orig) );
36  return *this;
37  }
38 
40  {
41  std::unique_lock< std::mutex > t_lock( f_mutex );
42  throw_reply::operator=( a_orig );
43  return *this;
44  }
45 
46  void reply_cache::set_cache( const return_code& a_code, const std::string& a_message, scarab::param_ptr_t a_payload_ptr )
47  {
48  std::unique_lock< std::mutex > t_lock( f_mutex );
49  reply_cache::get_instance()->set_return_code( a_code );
50  reply_cache::get_instance()->return_message() = a_message;
51  reply_cache::get_instance()->set_payload( std::move(a_payload_ptr) );
52  return;
53  }
54 
55 
56 } /* namespace dripline */
A singleton throw_reply object used to transfer throw_reply information to C++ from other implementat...
Definition: reply_cache.hh:38
void set_cache(const return_code &a_code, const std::string &a_message, scarab::param_ptr_t a_payload_ptr)
Set the contents of the reply cache (thread-safe)
Definition: reply_cache.cc:46
reply_cache & operator=(const throw_reply &a_orig)
Definition: reply_cache.cc:39
Object that can be thrown while processing a request to send a reply.
Definition: throw_reply.hh:42
throw_reply & operator=(const throw_reply &a_orig)
Definition: throw_reply.cc:36
#define DRIPLINE_API
Definition: dripline_api.hh:34
void set_reply_cache(const return_code &a_code, const std::string &a_message, scarab::param_ptr_t a_payload_ptr)
Set the contents of the reply cache (functional access to the singleton reply_cache)
Definition: reply_cache.cc:15
Base class for return codes.
Definition: return_codes.hh:40