Dripline-Cpp  v2.4.2
Dripline Implementation in C++
Public Member Functions | Protected Member Functions | Friends | List of all members
reply_cache Class Reference

A singleton throw_reply object used to transfer throw_reply information to C++ from other implementations (e.g. Python) More...

#include <reply_cache.hh>

Inheritance diagram for reply_cache:
Inheritance graph

Public Member Functions

reply_cacheoperator= (const throw_reply &a_orig)
 
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) More...
 
- Public Member Functions inherited from throw_reply
 throw_reply ()
 
 throw_reply (const return_code &a_code, scarab::param_ptr_t a_payload_ptr=scarab::param_ptr_t(new scarab::param()))
 
 throw_reply (const throw_reply &a_orig)
 
virtual ~throw_reply () noexcept
 
throw_replyoperator= (const throw_reply &a_orig)
 
template<class x_streamable >
throw_replyoperator<< (x_streamable a_fragment)
 
throw_replyoperator<< (const std::string &a_fragment)
 
throw_replyoperator<< (const char *a_fragment)
 
const std::string & return_message () const noexcept
 
std::string & return_message ()
 
const return_coderet_code () const noexcept
 
void set_return_code (const return_code &a_code)
 
const scarab::param & payload () const noexcept
 
scarab::param & payload ()
 
void set_payload (scarab::param_ptr_t a_payload)
 
const scarab::param_ptr_t & get_payload_ptr () const noexcept
 

Protected Member Functions

 reply_cache ()
 
 reply_cache (const reply_cache &)=delete
 
virtual ~reply_cache () noexcept
 

Friends

class scarab::thread_singleton< reply_cache >
 
class scarab::destroyer< reply_cache >
 

Additional Inherited Members

- Protected Attributes inherited from throw_reply
std::string f_return_message
 
std::shared_ptr< return_codef_return_code
 
scarab::param_ptr_t f_payload
 

Detailed Description

A singleton throw_reply object used to transfer throw_reply information to C++ from other implementations (e.g. Python)

Author
N.S. Oblath

Example usage: In Python, when a ThrowReply is raised, that's eventually converted automatically to an thrown exceptoin of type reply_already_set. Since we have no control over that conversion, we use the reply_cache to first store all of the information in the ThrowReply, before the C++ exception is raised. Once the exception is raised and caught, we can recognize that the origin was a Python ThrowReply, and then grab the information out of the reply_cache to send the reply.

For more details, see endpoint::on_request_message()'s technique for recognizing the type of the Python exception, and dripline-python's use of the cache in ThrowReply.py.

Definition at line 37 of file reply_cache.hh.

Constructor & Destructor Documentation

◆ reply_cache() [1/2]

reply_cache ( )
protected

Definition at line 21 of file reply_cache.cc.

◆ reply_cache() [2/2]

reply_cache ( const reply_cache )
protecteddelete

◆ ~reply_cache()

~reply_cache ( )
protectedvirtualnoexcept

Definition at line 25 of file reply_cache.cc.

Member Function Documentation

◆ operator=()

reply_cache & operator= ( const throw_reply a_orig)

Definition at line 28 of file reply_cache.cc.

◆ set_cache()

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 at line 35 of file reply_cache.cc.

Friends And Related Function Documentation

◆ scarab::destroyer< reply_cache >

friend class scarab::destroyer< reply_cache >
friend

Definition at line 46 of file reply_cache.hh.

◆ scarab::thread_singleton< reply_cache >

friend class scarab::thread_singleton< reply_cache >
friend

Definition at line 46 of file reply_cache.hh.


The documentation for this class was generated from the following files: