hamcast  Version 0.7
Public Types | Protected Member Functions | List of all members
hamcast::ipc::channel Class Referenceabstract

#include <channel.hpp>

Inheritance diagram for hamcast::ipc::channel:
hamcast::ref_counted hamcast::ipc::client_channel

Public Types

typedef intrusive_ptr< channelptr
 

Protected Member Functions

 channel (const util::source::ptr &in, const util::sink::ptr &out, int ms_poll_timeout=-1)
 
 channel (const std::pair< util::source::ptr, util::sink::ptr > &io_pair)
 
virtual void on_exit (const std::string &err_str)
 
virtual void ipc_read ()=0
 
virtual void poll_messages (size_t num)=0
 
void notify_message (size_t num=1)
 
- Protected Member Functions inherited from hamcast::ref_counted
 ref_counted ()
 
void ref ()
 
bool deref ()
 

Additional Inherited Members

- Public Member Functions inherited from hamcast::ref_counted
long ref_count ()
 
- Static Public Member Functions inherited from hamcast::ref_counted
static void add_ref (ref_counted *rc)
 
static void release (ref_counted *rc)
 

Detailed Description

An IPC channel.

This class describes an abstract IPC channel that manages an IPC connection.

Note
An IPC channel runs two threads (for sending and receiving IPC messages from its socket).

Member Typedef Documentation

A smart pointer to an instance of channel.

Constructor & Destructor Documentation

hamcast::ipc::channel::channel ( const util::source::ptr in,
const util::sink::ptr out,
int  ms_poll_timeout = -1 
)
protected

Creates a channel that reads from in and writes to out.

Parameters
inThe input source for this.
outThe output sink for this.
hamcast::ipc::channel::channel ( const std::pair< util::source::ptr, util::sink::ptr > &  io_pair)
protected

Creates a channel that reads from io_pair.first and writes to io_pair.second.

Parameters
io_pairio_pair.first is the input source for this and io_pair.second is the output sink for this.

Member Function Documentation

virtual void hamcast::ipc::channel::ipc_read ( )
protectedpure virtual

Reads data form the IPC channel via m_source.

Implemented in hamcast::ipc::client_channel.

void hamcast::ipc::channel::notify_message ( size_t  num = 1)
protected

Notifies the channel about a new message.

Postcondition
num < 32
void hamcast::ipc::channel::on_exit ( const std::string &  err_str)
protectedvirtual

Override this function if you want to run any cleanup code after the receive and send loop have exited.

Parameters
err_strOccurred error.

Reimplemented in hamcast::ipc::client_channel.

virtual void hamcast::ipc::channel::poll_messages ( size_t  num)
protectedpure virtual

Reads num messages from the channel's queue.

Implemented in hamcast::ipc::client_channel.


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