plumbing::endpoint_daytime Class Reference

#include <daytime.h>

Inheritance diagram for plumbing::endpoint_daytime:
plumbing::endpoint

Public Member Functions

virtual ~endpoint_daytime ()

Static Public Member Functions

static pointer create (int fd)

Protected Member Functions

int get_write_file_descriptor ()
void process_read ()
void process_write ()

Private Member Functions

 endpoint_daytime (int fd)
 endpoint_daytime ()
 endpoint_daytime (const endpoint_daytime &rhs)
endpoint_daytimeoperator= (const endpoint_daytime &rhs)

Private Attributes

char data [100]
size_t data_position
size_t data_size

Detailed Description

The plumbing::endpoint_daytime class is used to represent a server that reports the time-of-day in text.

Definition at line 29 of file daytime.h.


Constructor & Destructor Documentation

plumbing::endpoint_daytime::~endpoint_daytime (  )  [virtual]

The destructor.

Definition at line 25 of file daytime.cc.

plumbing::endpoint_daytime::endpoint_daytime ( int  fd  )  [private]

The constructor. It is private on purpose, use the create class method instead.

Parameters:
fd The file descriptor connected to the client for both reading and writing.

Definition at line 30 of file daytime.cc.

plumbing::endpoint_daytime::endpoint_daytime (  )  [private]

The default constructor. Do not use.

plumbing::endpoint_daytime::endpoint_daytime ( const endpoint_daytime rhs  )  [private]

The copy constructor. Do not use.

Parameters:
rhs The right hand side of the initialisation.

Member Function Documentation

plumbing::endpoint::pointer plumbing::endpoint_daytime::create ( int  fd  )  [static]

The create class methods is used to create new dynamically allocated instances of this class. Typically it is used by the plumbing::endpoint_listener_daytime::endpoint_factory method to create new servers when a connection has been accepted.

Parameters:
fd The file descriptor connected to the client for both reading and writing.

Definition at line 44 of file daytime.cc.

int plumbing::endpoint_daytime::get_write_file_descriptor (  )  [protected, virtual]

The get_write_file_descriptor method is used to obtain the file descriptor that select is to wait upon for write events. The default implementation returns -1.

Returns:
int; >=0 for a valid file descriptior, or -1 if write events should not be waited for.
Note:
This method need not returns the same file descriptor as returned by the get_read_file_descriptor method. You could, for example, use dup(2) to separate the two.
DO NOT close the file descriptor and set it to -1 in this method. Do that in the process_write method instead, otherwise you confuse the select() processing.

Reimplemented from plumbing::endpoint.

Definition at line 62 of file daytime.cc.

endpoint_daytime& plumbing::endpoint_daytime::operator= ( const endpoint_daytime rhs  )  [private]

The assignment operator. Do not use.

Parameters:
rhs The rights hand side of the assignment.
void plumbing::endpoint_daytime::process_read (  )  [protected, virtual]

The process_read method is called by the select loop when a readable event is detected on the read file descriptor.

Implements plumbing::endpoint.

Definition at line 51 of file daytime.cc.

void plumbing::endpoint_daytime::process_write (  )  [protected, virtual]

The process_write method is called by the select loop when a writable event is detected on the read file descriptor.

Implements plumbing::endpoint.

Definition at line 69 of file daytime.cc.


Field Documentation

char plumbing::endpoint_daytime::data[100] [private]

The data instance variable is used to remember the data we wish to send to the client.

Definition at line 77 of file daytime.h.

The data_position instance variable is used to remember how much of the data has been sent, so far.

Definition at line 83 of file daytime.h.

The data_size instance variable is used to remember how much of the data has been used. This is the limit of the data_position instance variable.

Definition at line 90 of file daytime.h.


The documentation for this class was generated from the following files:
Generated on Thu Sep 16 14:51:27 2010 for Plumbing by  doxygen 1.6.3