Refactor code so that messages go through engines

This commit is contained in:
Martin Hurton
2013-03-18 02:00:00 +01:00
parent c396144216
commit 7942db7606
30 changed files with 528 additions and 771 deletions

View File

@@ -26,8 +26,6 @@
#include "own.hpp"
#include "io_object.hpp"
#include "pipe.hpp"
#include "i_msg_source.hpp"
#include "i_msg_sink.hpp"
#include "socket_base.hpp"
namespace zmq
@@ -42,9 +40,7 @@ namespace zmq
class session_base_t :
public own_t,
public io_object_t,
public i_pipe_events,
public i_msg_source,
public i_msg_sink
public i_pipe_events
{
public:
@@ -56,12 +52,6 @@ namespace zmq
// To be used once only, when creating the session.
void attach_pipe (zmq::pipe_t *pipe_);
// i_msg_source interface implementation.
virtual int pull_msg (msg_t *msg_);
// i_msg_sink interface implementation.
virtual int push_msg (msg_t *msg_);
// Following functions are the interface exposed towards the engine.
virtual void reset ();
void flush ();
@@ -73,6 +63,15 @@ namespace zmq
void hiccuped (zmq::pipe_t *pipe_);
void terminated (zmq::pipe_t *pipe_);
// Delivers a message. Returns 0 if successful; -1 otherwise.
// The function takes ownership of the message.
int push_msg (msg_t *msg_);
// Fetches a message. Returns 0 if successful; -1 otherwise.
// The caller is responsible for freeing the message when no
// longer used.
int pull_msg (msg_t *msg_);
socket_base_t *get_socket ();
protected:
@@ -137,10 +136,6 @@ namespace zmq
// True is linger timer is running.
bool has_linger_timer;
// If true, identity has been sent/received from the network.
bool identity_sent;
bool identity_received;
// Protocol and address to use when connecting.
const address_t *addr;