#include <conexus/endpoint.h>
Inheritance diagram for Conexus::Endpoint:
read/write methods are pure virtual methods in this base class and it is the responsibility of all children to provide proper implementations that may go beyond the traditional read(2) and write(2) functions standard in Linux/Unix.
Children are also responsible for maintenance of the file descriptor member m_fd and the integer state value m_state.
This class inherits from propertymm::Object and thus makes some properties available via the propertymm framework as well as providing direct accessor methods.
Public Types | |
typedef ConexusPointer< Endpoint > | pointer |
Class scope smart pointer typedef. | |
typedef ConexusPointer< Endpoint > | pointer |
Class scope smart pointer typedef. | |
typedef ConexusPointer< Endpoint > | pointer |
Class scope smart pointer typedef. | |
Public Member Functions | |
Endpoint (bool close_on_destruct=true) | |
Default constructor setting state to 0 and file descriptor to -1 (which should be an invalid fd on just about every POSIX system. | |
virtual | ~Endpoint () |
Destructor does nothing. | |
virtual void | start () |
Start the endpoint. | |
virtual void | start (bool use_dispatcher) |
Starts the endpoint, and forces it to use a specific dispatcher value possibly overriding the global default. | |
virtual void | stop () |
Stops any running threads. | |
virtual bool | is_running () |
True if the endpoint is running with threaded reads. | |
virtual bool | timestamp_received_data () |
True if received data is timestamped. | |
virtual void | set_timestamp_received_data (bool t=true) |
Set to true to timestamp received data. | |
virtual void | set_blocking_write (bool block=true) |
virtual bool | is_blocking_write () |
sigc::signal< void, const Data > | signal_data () |
Signal emitted when data is read. | |
sigc::signal< void, size_t > | signal_data_received () |
Signal emitted when data is received notifying the callback of the number of bytes read. | |
sigc::signal< void, size_t > | signal_data_transmitted () |
Signal emitted when data is transmitted, notifying the callback of the number of bytes transmitted. | |
long int | read_timeout () |
void | set_read_timeout (long int t) |
long int | write_timeout () |
void | set_write_timeout (long int t) |
bool | read_terminate_immediate () |
void | set_read_terminate_immediate (bool i=true) |
bool | write_terminate_immediate () |
void | set_write_terminate_immediate (bool i=true) |
virtual void | open ()=0 throw (open_exception) |
Will attempt to open the object without any additional information. | |
virtual void | close (bool force=false)=0 throw (close_exception) |
ssize_t | write (const void *data, size_t size) throw (write_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to ensure writing/transmission of a block of data pointed to by data and of size bytes. | |
ssize_t | write (const Data data) throw (write_exception) |
Write data according to virtual method defined by children. | |
Data | read (size_t s=0) throw (read_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to read a block of data. | |
virtual ssize_t | input_available () |
virtual void | change_state (long new_state) throw (state_exception) |
It is intended that children will provide their own implementation of this method to take into account the actions necessary for any additional states they may introduce. | |
long | state () |
Return this endpoint's current numeric state. | |
void | set_close_on_destruction (bool value) |
If set, calls this endpoint's virtual close() method on destruction. | |
bool | close_on_destruction () const |
True if this endpoint's virtual close() method will be called on destruction. | |
void | close_and_reopen (long state=ENDPOINT_UNCHANGED) |
Close the I/O point and reopen to a new (or same state). | |
sigc::signal< void > | signal_opened () |
Signal emitted when this endpoint is opened. | |
sigc::signal< void > | signal_closed () |
Signal emitted when this endpoint is closed. | |
bool | is_open () |
True if this endpoint is in an open state. | |
bool | is_closed () |
True if this endpoint is in a closed state. | |
Endpoint (bool close_on_destruct=true) | |
Default constructor setting state to 0 and file descriptor to -1 (which should be an invalid fd on just about every POSIX system. | |
virtual | ~Endpoint () |
Destructor does nothing. | |
virtual void | start () |
Start the endpoint. | |
virtual void | start (bool use_dispatcher) |
Starts the endpoint, and forces it to use a specific dispatcher value possibly overriding the global default. | |
virtual void | stop () |
Stops any running threads. | |
virtual bool | is_running () |
True if the endpoint is running with threaded reads. | |
virtual bool | timestamp_received_data () |
True if received data is timestamped. | |
virtual void | set_timestamp_received_data (bool t=true) |
Set to true to timestamp received data. | |
virtual void | set_blocking_write (bool block=true) |
virtual bool | is_blocking_write () |
sigc::signal< void, Data::const_pointer > | signal_data () |
Signal emitted when data is read. | |
sigc::signal< void, size_t > | signal_data_received () |
Signal emitted when data is received notifying the callback of the number of bytes read. | |
sigc::signal< void, size_t > | signal_data_transmitted () |
Signal emitted when data is transmitted, notifying the callback of the number of bytes transmitted. | |
long int | read_timeout () |
Sets the responsiveness to add_*, remove_* and stop commands in microseconds; lower is more responsive; larger is less responsive; default is 500000 microseconds (or 500 ms). | |
void | set_read_timeout (long int t) |
long int | write_timeout () |
void | set_write_timeout (long int t) |
bool | read_terminate_immediate () |
void | set_read_terminate_immediate (bool i=true) |
bool | write_terminate_immediate () |
void | set_write_terminate_immediate (bool i=true) |
virtual void | open ()=0 throw (open_exception) |
Will attempt to open the object without any additional information. | |
virtual void | close (bool force=false)=0 throw (close_exception) |
ssize_t | write (const void *data, size_t size) throw (write_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to ensure writing/transmission of a block of data pointed to by data and of size bytes. | |
ssize_t | write (Data::const_pointer data) throw (write_exception) |
Write data according to virtual method defined by children. | |
Data::pointer | read (size_t s=0) throw (read_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to read a block of data. | |
virtual ssize_t | input_available () |
virtual void | change_state (long new_state) throw (state_exception) |
It is intended that children will provide their own implementation of this method to take into account the actions necessary for any additional states they may introduce. | |
long | state () |
Return this endpoint's current numeric state. | |
void | set_close_on_destruction (bool value) |
If set, calls this endpoint's virtual close() method on destruction. | |
bool | close_on_destruction () const |
True if this endpoint's virtual close() method will be called on destruction. | |
void | close_and_reopen (long state=ENDPOINT_UNCHANGED) |
Close the I/O point and reopen to a new (or same state). | |
sigc::signal< void > | signal_opened () |
Signal emitted when this endpoint is opened. | |
sigc::signal< void > | signal_closed () |
Signal emitted when this endpoint is closed. | |
bool | is_open () |
True if this endpoint is in an open state. | |
bool | is_closed () |
True if this endpoint is in a closed state. | |
virtual const std::string & | object_type () |
String identifier of this class. | |
Endpoint (bool close_on_destruct=true) | |
Default constructor setting state to 0 and file descriptor to -1 (which should be an invalid fd on just about every POSIX system. | |
virtual | ~Endpoint () |
Destructor does nothing. | |
virtual void | start () |
Start the endpoint. | |
virtual void | start (bool use_dispatcher) |
Starts the endpoint, and forces it to use a specific dispatcher value possibly overriding the global default. | |
virtual void | stop () |
Stops any running threads. | |
virtual bool | is_running () |
True if the endpoint is running with threaded reads. | |
virtual bool | timestamp_received_data () |
True if received data is timestamped. | |
virtual void | set_timestamp_received_data (bool t=true) |
Set to true to timestamp received data. | |
virtual void | set_blocking_write (bool block=true) |
virtual bool | is_blocking_write () |
sigc::signal< void, Data::const_pointer > | signal_data () |
Signal emitted when data is read. | |
sigc::signal< void, size_t > | signal_data_received () |
Signal emitted when data is received notifying the callback of the number of bytes read. | |
sigc::signal< void, size_t > | signal_data_transmitted () |
Signal emitted when data is transmitted, notifying the callback of the number of bytes transmitted. | |
long int | read_timeout () |
Sets the responsiveness to add_*, remove_* and stop commands in microseconds; lower is more responsive; larger is less responsive; default is 500000 microseconds (or 500 ms). | |
void | set_read_timeout (long int t) |
long int | write_timeout () |
void | set_write_timeout (long int t) |
bool | read_terminate_immediate () |
void | set_read_terminate_immediate (bool i=true) |
bool | write_terminate_immediate () |
void | set_write_terminate_immediate (bool i=true) |
virtual void | open ()=0 throw (open_exception) |
Will attempt to open the object without any additional information. | |
virtual void | close (bool force=false)=0 throw (close_exception) |
ssize_t | write (const void *data, size_t size) throw (write_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to ensure writing/transmission of a block of data pointed to by data and of size bytes. | |
ssize_t | write (Data::const_pointer data) throw (write_exception) |
Write data according to virtual method defined by children. | |
Data::pointer | read (size_t s=0) throw (read_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to read a block of data. | |
virtual ssize_t | input_available () |
virtual void | change_state (long new_state) throw (state_exception) |
It is intended that children will provide their own implementation of this method to take into account the actions necessary for any additional states they may introduce. | |
long | state () |
Return this endpoint's current numeric state. | |
void | set_close_on_destruction (bool value) |
If set, calls this endpoint's virtual close() method on destruction. | |
bool | close_on_destruction () const |
True if this endpoint's virtual close() method will be called on destruction. | |
void | close_and_reopen (long state=ENDPOINT_UNCHANGED) |
Close the I/O point and reopen to a new (or same state). | |
sigc::signal< void > | signal_opened () |
Signal emitted when this endpoint is opened. | |
sigc::signal< void > | signal_closed () |
Signal emitted when this endpoint is closed. | |
bool | is_open () |
True if this endpoint is in an open state. | |
bool | is_closed () |
True if this endpoint is in a closed state. | |
virtual const std::string & | object_type () |
String identifier of this class. | |
Protected Member Functions | |
virtual void | read_thread_main () |
virtual void | read_thread_cleanup () |
virtual void | read_delivery_thread_main () |
virtual void | read_delivery_thread_cleanup () |
virtual void | write_thread_main () |
virtual void | write_thread_cleanup () |
void | queue_received_data (const Data d) |
void | queue_write_data (const Data d) |
void | emit_received_data () |
virtual void | set_state_opened () |
virtual void | set_state_closed () |
virtual ssize_t | write_data (long int timeout, const Data data)=0 throw (write_exception) |
virtual Data | read_data (long int timeout, size_t s=0)=0 throw (read_exception) |
virtual void | read_thread_main () |
virtual void | read_thread_cleanup () |
virtual void | read_delivery_thread_main () |
virtual void | read_delivery_thread_cleanup () |
virtual void | write_thread_main () |
virtual void | write_thread_cleanup () |
void | queue_received_data (Data::const_pointer d) |
void | queue_write_data (Data::const_pointer d) |
void | emit_received_data () |
virtual void | set_state_opened () |
virtual void | set_state_closed () |
virtual ssize_t | write_data (long int timeout, Data::const_pointer data)=0 throw (write_exception) |
virtual Data::pointer | read_data (long int timeout, size_t s=0)=0 throw (read_exception) |
virtual void | read_thread_main () |
virtual void | read_thread_cleanup () |
virtual void | read_delivery_thread_main () |
virtual void | read_delivery_thread_cleanup () |
virtual void | write_thread_main () |
virtual void | write_thread_cleanup () |
void | queue_received_data (Data::const_pointer d) |
void | queue_write_data (Data::const_pointer d) |
void | emit_received_data () |
virtual void | set_state_opened () |
virtual void | set_state_closed () |
virtual ssize_t | write_data (long int timeout, Data::const_pointer data)=0 throw (write_exception) |
virtual Data::pointer | read_data (long int timeout, size_t s=0)=0 throw (read_exception) |
Protected Attributes | |
Glib::Thread * | m_read_thread |
Glib::Thread * | m_write_thread |
Glib::Thread * | m_read_delivery_thread |
bool | m_read_terminate |
bool | m_read_terminate_immediate |
bool | m_write_terminate |
bool | m_write_terminate_immediate |
long int | m_read_timeout |
long int | m_write_timeout |
bool | m_timestamp |
Glib::Mutex | m_read_queue_lock |
Glib::Mutex | m_write_queue_lock |
Glib::Cond | m_read_delivery_conditional |
Glib::Cond | m_write_conditional |
Glib::Dispatcher * | m_dispatcher |
sigc::connection | m_dispatcher_connection |
bool | m_use_dispatcher |
sigc::signal< void, const Data > | m_signal_data |
sigc::signal< void, size_t > | m_signal_data_received |
sigc::signal< void, size_t > | m_signal_data_transmitted |
std::queue< Data > | m_read_queue |
std::queue< Data > | m_write_queue |
bool | m_close_on_destruction |
long | m_state |
bool | m_readable |
bool | m_writable |
sigc::signal< void > | m_signal_opened |
sigc::signal< void > | m_signal_closed |
Glib::Thread * | m_read_thread |
Glib::Thread * | m_write_thread |
Glib::Thread * | m_read_delivery_thread |
Glib::Dispatcher * | m_dispatcher |
sigc::signal< void, Data::const_pointer > | m_signal_data |
sigc::signal< void, size_t > | m_signal_data_received |
sigc::signal< void, size_t > | m_signal_data_transmitted |
std::queue< Data::const_pointer > | m_read_queue |
std::queue< Data::const_pointer > | m_write_queue |
sigc::signal< void > | m_signal_opened |
sigc::signal< void > | m_signal_closed |
Glib::Thread * | m_read_thread |
Glib::Thread * | m_write_thread |
Glib::Thread * | m_read_delivery_thread |
Glib::Dispatcher * | m_dispatcher |
sigc::signal< void, Data::const_pointer > | m_signal_data |
sigc::signal< void, size_t > | m_signal_data_received |
sigc::signal< void, size_t > | m_signal_data_transmitted |
std::queue< Data::const_pointer > | m_read_queue |
std::queue< Data::const_pointer > | m_write_queue |
sigc::signal< void > | m_signal_opened |
sigc::signal< void > | m_signal_closed |
Conexus::Endpoint::Endpoint | ( | bool | close_on_destruct = true |
) |
Default constructor setting state to 0 and file descriptor to -1 (which should be an invalid fd on just about every POSIX system.
This constructor simply sets the values according to the parameters and performs no real actions with the file descriptor.
Conexus::Endpoint::~Endpoint | ( | ) | [virtual] |
Destructor does nothing.
It will not call close() upon the file descriptor or perform any other cleanup; these are the responsibility of the children.
Conexus::Endpoint::Endpoint | ( | bool | close_on_destruct = true |
) |
Default constructor setting state to 0 and file descriptor to -1 (which should be an invalid fd on just about every POSIX system.
This constructor simply sets the values according to the parameters and performs no real actions with the file descriptor.
virtual Conexus::Endpoint::~Endpoint | ( | ) | [virtual] |
Destructor does nothing.
It will not call close() upon the file descriptor or perform any other cleanup; these are the responsibility of the children.
Conexus::Endpoint::Endpoint | ( | bool | close_on_destruct = true |
) |
Default constructor setting state to 0 and file descriptor to -1 (which should be an invalid fd on just about every POSIX system.
This constructor simply sets the values according to the parameters and performs no real actions with the file descriptor.
virtual Conexus::Endpoint::~Endpoint | ( | ) | [virtual] |
Destructor does nothing.
It will not call close() upon the file descriptor or perform any other cleanup; these are the responsibility of the children.
void Conexus::Endpoint::start | ( | ) | [virtual] |
Start the endpoint.
If the endpoint is configured for multi-threaded operation this will create and start the read thread.
Whether a dispatcher is used or not is dependent upon the global setting which defaults to false, but may be set with Conexus::init() or Conexus::set_use_dispatcher_default().
If you want to handle it manually, endpoints are capable of reading/writing without ever calling start/stop.
void Conexus::Endpoint::stop | ( | ) | [virtual] |
Stops any running threads.
Stopping is not immediate. If a read operation is being performed the current read will complete before the thread is stopped.
sigc::signal< void, const Data > Conexus::Endpoint::signal_data | ( | ) |
Signal emitted when data is read.
Connect to this signal if you want to receive all data read by the endpoint. The data object received is unique for each callback point, allowing a callback to modify the data set without effect subsequent callbacks.
sigc::signal< void, size_t > Conexus::Endpoint::signal_data_received | ( | ) |
Signal emitted when data is received notifying the callback of the number of bytes read.
Connect to this signal if you need to know when data is received, and how much, but don't want the data contents.
sigc::signal< void, size_t > Conexus::Endpoint::signal_data_transmitted | ( | ) |
Signal emitted when data is transmitted, notifying the callback of the number of bytes transmitted.
Connect to this signal if you need to know when data is transmitted, and how much, but don't want the transmitted data contents.
ssize_t Conexus::Endpoint::write | ( | const void * | data, | |
size_t | size | |||
) | throw (write_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to ensure writing/transmission of a block of data pointed to by data and of size bytes.
data | Pointer to the raw data block to be written. | |
size | Size in bytes of the raw data block to write. |
Reimplemented in Conexus::NSPR::TCP, and Conexus::NSPR::TCP.
ssize_t Conexus::Endpoint::write | ( | const Data | data | ) | throw (write_exception) |
Write data according to virtual method defined by children.
Data Conexus::Endpoint::read | ( | size_t | s = 0 |
) | throw (read_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to read a block of data.
Children may utilize the parameter s or may choose to ignore the parameter entirely.
s | The size of the data block to read. Suggested semantics for children are:
|
Reimplemented in Conexus::NSPR::TCP, and Conexus::NSPR::TCP.
void Conexus::Endpoint::change_state | ( | long | new_state | ) | throw (state_exception) [virtual] |
It is intended that children will provide their own implementation of this method to take into account the actions necessary for any additional states they may introduce.
This method as implemented recognizes the OPEN, CLOSE and UNCHANGED states and calls the virtual open, close (or no call) as is appropriate.
This method does not actually modify the m_state member. It is the responsibility of the called virtual methods open() and close() to actually perform the modification.
long Conexus::Endpoint::state | ( | ) |
Return this endpoint's current numeric state.
The meaning of this value is specific to the endpoint.
void Conexus::Endpoint::close_and_reopen | ( | long | state = ENDPOINT_UNCHANGED |
) |
Close the I/O point and reopen to a new (or same state).
If state is UNCHANGED will reopen to the previous state.
close and reopen is accomplished by calling change_state(CLOSED) and then change_state(new_state), not by calling close directly.
virtual void Conexus::Endpoint::start | ( | ) | [virtual] |
Start the endpoint.
If the endpoint is configured for multi-threaded operation this will create and start the read thread.
Whether a dispatcher is used or not is dependent upon the global setting which defaults to false, but may be set with Conexus::init() or Conexus::set_use_dispatcher_default().
If you want to handle it manually, endpoints are capable of reading/writing without ever calling start/stop.
virtual void Conexus::Endpoint::stop | ( | ) | [virtual] |
Stops any running threads.
Stopping is not immediate. If a read operation is being performed the current read will complete before the thread is stopped.
sigc::signal<void, Data::const_pointer> Conexus::Endpoint::signal_data | ( | ) |
Signal emitted when data is read.
Connect to this signal if you want to receive all data read by the endpoint. The data object received is unique for each callback point, allowing a callback to modify the data set without effect subsequent callbacks.
sigc::signal<void, size_t> Conexus::Endpoint::signal_data_received | ( | ) |
Signal emitted when data is received notifying the callback of the number of bytes read.
Connect to this signal if you need to know when data is received, and how much, but don't want the data contents.
sigc::signal<void, size_t> Conexus::Endpoint::signal_data_transmitted | ( | ) |
Signal emitted when data is transmitted, notifying the callback of the number of bytes transmitted.
Connect to this signal if you need to know when data is transmitted, and how much, but don't want the transmitted data contents.
long int Conexus::Endpoint::read_timeout | ( | ) |
Sets the responsiveness to add_*, remove_* and stop commands in microseconds; lower is more responsive; larger is less responsive; default is 500000 microseconds (or 500 ms).
In general this refers to the timeout period of the select() call used internally. Each cycle of the server I/O thread acquires several mutex locks at the beginning of the cycle and releases them at the end of the cycle.
This value shortens the cycle period, thereby making the server more responsive to commands at the cost of increasing overhead.
ssize_t Conexus::Endpoint::write | ( | const void * | data, | |
size_t | size | |||
) | throw (write_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to ensure writing/transmission of a block of data pointed to by data and of size bytes.
data | Pointer to the raw data block to be written. | |
size | Size in bytes of the raw data block to write. |
Reimplemented in Conexus::NSPR::TCP, and Conexus::NSPR::TCP.
ssize_t Conexus::Endpoint::write | ( | Data::const_pointer | data | ) | throw (write_exception) |
Write data according to virtual method defined by children.
Data::pointer Conexus::Endpoint::read | ( | size_t | s = 0 |
) | throw (read_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to read a block of data.
Children may utilize the parameter s or may choose to ignore the parameter entirely.
s | The size of the data block to read. Suggested semantics for children are:
|
Reimplemented in Conexus::NSPR::TCP, and Conexus::NSPR::TCP.
virtual void Conexus::Endpoint::change_state | ( | long | new_state | ) | throw (state_exception) [virtual] |
It is intended that children will provide their own implementation of this method to take into account the actions necessary for any additional states they may introduce.
This method as implemented recognizes the OPEN, CLOSE and UNCHANGED states and calls the virtual open, close (or no call) as is appropriate.
This method does not actually modify the m_state member. It is the responsibility of the called virtual methods open() and close() to actually perform the modification.
long Conexus::Endpoint::state | ( | ) |
Return this endpoint's current numeric state.
The meaning of this value is specific to the endpoint.
void Conexus::Endpoint::close_and_reopen | ( | long | state = ENDPOINT_UNCHANGED |
) |
Close the I/O point and reopen to a new (or same state).
If state is UNCHANGED will reopen to the previous state.
close and reopen is accomplished by calling change_state(CLOSED) and then change_state(new_state), not by calling close directly.
virtual void Conexus::Endpoint::start | ( | ) | [virtual] |
Start the endpoint.
If the endpoint is configured for multi-threaded operation this will create and start the read thread.
Whether a dispatcher is used or not is dependent upon the global setting which defaults to false, but may be set with Conexus::init() or Conexus::set_use_dispatcher_default().
If you want to handle it manually, endpoints are capable of reading/writing without ever calling start/stop.
virtual void Conexus::Endpoint::stop | ( | ) | [virtual] |
Stops any running threads.
Stopping is not immediate. If a read operation is being performed the current read will complete before the thread is stopped.
sigc::signal<void, Data::const_pointer> Conexus::Endpoint::signal_data | ( | ) |
Signal emitted when data is read.
Connect to this signal if you want to receive all data read by the endpoint. The data object received is unique for each callback point, allowing a callback to modify the data set without effect subsequent callbacks.
sigc::signal<void, size_t> Conexus::Endpoint::signal_data_received | ( | ) |
Signal emitted when data is received notifying the callback of the number of bytes read.
Connect to this signal if you need to know when data is received, and how much, but don't want the data contents.
sigc::signal<void, size_t> Conexus::Endpoint::signal_data_transmitted | ( | ) |
Signal emitted when data is transmitted, notifying the callback of the number of bytes transmitted.
Connect to this signal if you need to know when data is transmitted, and how much, but don't want the transmitted data contents.
long int Conexus::Endpoint::read_timeout | ( | ) |
Sets the responsiveness to add_*, remove_* and stop commands in microseconds; lower is more responsive; larger is less responsive; default is 500000 microseconds (or 500 ms).
In general this refers to the timeout period of the select() call used internally. Each cycle of the server I/O thread acquires several mutex locks at the beginning of the cycle and releases them at the end of the cycle.
This value shortens the cycle period, thereby making the server more responsive to commands at the cost of increasing overhead.
ssize_t Conexus::Endpoint::write | ( | const void * | data, | |
size_t | size | |||
) | throw (write_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to ensure writing/transmission of a block of data pointed to by data and of size bytes.
data | Pointer to the raw data block to be written. | |
size | Size in bytes of the raw data block to write. |
Reimplemented in Conexus::NSPR::TCP, and Conexus::NSPR::TCP.
ssize_t Conexus::Endpoint::write | ( | Data::const_pointer | data | ) | throw (write_exception) |
Write data according to virtual method defined by children.
Data::pointer Conexus::Endpoint::read | ( | size_t | s = 0 |
) | throw (read_exception) |
A pure virtual method that must be reimplemented by children to perform whatever actions necessary to read a block of data.
Children may utilize the parameter s or may choose to ignore the parameter entirely.
s | The size of the data block to read. Suggested semantics for children are:
|
Reimplemented in Conexus::NSPR::TCP, and Conexus::NSPR::TCP.
virtual void Conexus::Endpoint::change_state | ( | long | new_state | ) | throw (state_exception) [virtual] |
It is intended that children will provide their own implementation of this method to take into account the actions necessary for any additional states they may introduce.
This method as implemented recognizes the OPEN, CLOSE and UNCHANGED states and calls the virtual open, close (or no call) as is appropriate.
This method does not actually modify the m_state member. It is the responsibility of the called virtual methods open() and close() to actually perform the modification.
long Conexus::Endpoint::state | ( | ) |
Return this endpoint's current numeric state.
The meaning of this value is specific to the endpoint.
void Conexus::Endpoint::close_and_reopen | ( | long | state = ENDPOINT_UNCHANGED |
) |
Close the I/O point and reopen to a new (or same state).
If state is UNCHANGED will reopen to the previous state.
close and reopen is accomplished by calling change_state(CLOSED) and then change_state(new_state), not by calling close directly.