JANA2
C++ framework for multi-threaded data processing
|
JTransport is a lightweight wrapper for integrating different messaging systems with JANA. More...
#include <JTransport.h>
Public Types | |
enum | Result { SUCCESS , FAILURE , TRY_AGAIN , FINISHED } |
Public Member Functions | |
virtual void | initialize ()=0 |
Called exactly once before any calls to send or receive. More... | |
virtual Result | send (const JMessage &src_msg)=0 |
send should block until the underlying transport has successfully enqueued the message somewhere else. More... | |
virtual Result | receive (JMessage &dest_msg)=0 |
receive should return as soon as the dest_msg has been written. More... | |
virtual | ~JTransport ()=default |
It is reasonable to close sockets in the destructor, since: a. More... | |
JTransport is a lightweight wrapper for integrating different messaging systems with JANA.
enum JTransport::Result |
|
virtualdefault |
It is reasonable to close sockets in the destructor, since: a.
The JTransport doesn't have an end-of-stream concept to hook a close() method to b. The JStreamingEventSource owns the JTransport, so it can destroy it as soon as it is done with it
|
pure virtual |
Called exactly once before any calls to send or receive.
Use for opening sockets, etc. We don't open sockets in the constructor because JANA expects multiple event sources, which might be constructed immediately but not used until much later, unnecessarily tying up resources.
receive should return as soon as the dest_msg has been written.
If there are no messages waiting, receive should return TRY_AGAIN immediately instead of blocking.
send should block until the underlying transport has successfully enqueued the message somewhere else.
This allows the caller to reuse the same JMessage buffer immediately.