Dripline-Cpp  v2.4.2
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  {}
27 
29  {
30  std::unique_lock< std::mutex > t_lock( f_mutex );
31  throw_reply::operator=( a_orig );
32  return *this;
33  }
34 
35  void reply_cache::set_cache( const return_code& a_code, const std::string& a_message, scarab::param_ptr_t a_payload_ptr )
36  {
37  std::unique_lock< std::mutex > t_lock( f_mutex );
38  reply_cache::get_instance()->set_return_code( a_code );
39  reply_cache::get_instance()->return_message() = a_message;
40  reply_cache::get_instance()->set_payload( std::move(a_payload_ptr) );
41  return;
42  }
43 
44 
45 } /* namespace dripline */
Base class for return codes.
Definition: return_codes.hh:39
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
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:35
A singleton throw_reply object used to transfer throw_reply information to C++ from other implementat...
Definition: reply_cache.hh:37
virtual ~reply_cache() noexcept
Definition: reply_cache.cc:25
#define DRIPLINE_API
Definition: dripline_api.hh:34
throw_reply & operator=(const throw_reply &a_orig)
Definition: throw_reply.cc:39
Object that can be thrown while processing a request to send a reply.
Definition: throw_reply.hh:41
reply_cache & operator=(const throw_reply &a_orig)
Definition: reply_cache.cc:28