Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

RCS_OI Class Reference

#include <rcs_oi.hh>

Collaboration diagram for RCS_OI:

Collaboration graph
[legend]

Public Methods

 RCS_OI (NML_FORMAT_PTR, char *name, char *process, char *file, NODE *n)
 RCS_OI ()
virtual ~RCS_OI ()
virtual int get_request ()
virtual void set_mode (OI_MODE_TYPE)
virtual void acknowledge_request ()
virtual void request_done ()
virtual void cycle ()
virtual int send_reply ()

Data Fields

RCS_CMD_MSGcmd_for_node
int cmd_for_node_new
int request_flag

Protected Methods

virtual void interpret_request ()
virtual void choose_command_for_node ()
virtual void choose_reply ()

Protected Attributes

RCS_OI_REQUEST_CHANNELrequest_channel
RCS_OI_REPLY_CHANNELreply_channel
RCS_OI_REQUEST_MSGrequest_msg
RCS_OI_REPLY_MSGreply_msg
int new_request_msg
int new_reply_msg
NMLTYPE request_type
NMLTYPE reply_type
OI_MODE_TYPE mode
NODEnode
int oi_list_id

Constructor & Destructor Documentation

RCS_OI::RCS_OI NML_FORMAT_PTR    fptr,
char *    _name,
char *    _process,
char *    file,
NODE   _node
 

Definition at line 16 of file rcs_oi.cc.

00018 {
00019   char *request_buffer_name;
00020   char *reply_buffer_name;
00021 
00022   node = _node;
00023   request_channel = NULL;
00024   reply_channel = NULL;
00025   request_msg = NULL;
00026   reply_msg = NULL;
00027   new_request_msg = 0;
00028   new_reply_msg = 0;
00029   mode = OI_ACCEPTING_REQUESTS;
00030 
00031   /* Construct request_buffer_name */
00032   request_buffer_name = (char *) malloc (strlen (_name)
00033                                          + strlen (node->suffix.req) + 1);
00034   strcpy (request_buffer_name, _name);
00035   strcat (request_buffer_name, node->suffix.req);
00036 
00037   /* Open request channel. */
00038   request_channel = new RCS_OI_REQUEST_CHANNEL (fptr,
00039                                                 request_buffer_name, _process,
00040                                                 file);
00041   delete request_buffer_name;
00042 
00043   /* Construct reply_buffer_name */
00044   reply_buffer_name = (char *) malloc (strlen (_name)
00045                                        + strlen (node->suffix.reply) + 1);
00046   strcpy (reply_buffer_name, _name);
00047   strcat (reply_buffer_name, node->suffix.reply);
00048 
00049   /* Open reply channel. */
00050   reply_channel = new RCS_OI_REPLY_CHANNEL (fptr,
00051                                             reply_buffer_name, _process,
00052                                             file);
00053   delete reply_buffer_name;
00054 
00055   /* Add this RCS_OI to the list in the parent node. */
00056   if (NULL != node)
00057     {
00058       if (NULL != node->operator_interface_list)
00059         {
00060           oi_list_id =
00061             node->operator_interface_list->store_at_tail (this,
00062                                                           sizeof (RCS_OI), 0);
00063         }
00064     }
00065 }

RCS_OI::RCS_OI  
 

Definition at line 67 of file rcs_oi.cc.

00068 {
00069   node = NULL;
00070   request_channel = NULL;
00071   reply_channel = NULL;
00072   request_msg = NULL;
00073   reply_msg = NULL;
00074   request_flag = 0;
00075   cmd_for_node = NULL;
00076   cmd_for_node_new = 0;
00077   new_request_msg = 0;
00078   new_reply_msg = 0;
00079 }

RCS_OI::~RCS_OI   [virtual]
 

Definition at line 82 of file rcs_oi.cc.

00083 {
00084   if (NULL != request_channel)
00085     {
00086       delete request_channel;
00087       request_channel = NULL;
00088     }
00089   if (NULL != reply_channel)
00090     {
00091       delete reply_channel;
00092       reply_channel = NULL;
00093     }
00094   if (NULL != node)
00095     {
00096       if (NULL != node->operator_interface_list)
00097         {
00098           node->operator_interface_list->delete_node (oi_list_id);
00099         }
00100     }
00101 }


Member Function Documentation

void RCS_OI::interpret_request   [protected, virtual]
 

Definition at line 105 of file rcs_oi.cc.

Referenced by cycle().

00106 {
00107 }

void RCS_OI::choose_command_for_node   [protected, virtual]
 

Definition at line 111 of file rcs_oi.cc.

Referenced by cycle().

00112 {
00113 }

void RCS_OI::choose_reply   [protected, virtual]
 

Definition at line 117 of file rcs_oi.cc.

Referenced by cycle().

00118 {
00119 }

int RCS_OI::get_request   [virtual]
 

Definition at line 132 of file rcs_oi.cc.

00133 {
00134   NMLTYPE temp;
00135   if (NULL != request_channel)
00136     {
00137       switch (temp = request_channel->read ())
00138         {
00139         case -1:                /* error */
00140           return -1;
00141         case 0:         /* old */
00142           new_request_msg = 0;
00143           return 0;
00144         default:                /* new */
00145           request_flag = 1;
00146           new_request_msg = 1;
00147           request_type = temp;
00148           request_msg = request_channel->get_address ();
00149           return 1;
00150         }
00151     }
00152   else
00153     {
00154       return -1;
00155     }
00156 }

void RCS_OI::set_mode OI_MODE_TYPE    new_mode [virtual]
 

Definition at line 164 of file rcs_oi.cc.

00165 {
00166   mode = new_mode;
00167 }

void RCS_OI::acknowledge_request   [virtual]
 

Definition at line 175 of file rcs_oi.cc.

00176 {
00177   request_flag = 0;
00178 }

void RCS_OI::request_done   [virtual]
 

Definition at line 186 of file rcs_oi.cc.

00187 {
00188 }

void RCS_OI::cycle   [virtual]
 

Definition at line 200 of file rcs_oi.cc.

00201 {
00202   interpret_request ();
00203   choose_command_for_node ();
00204   choose_reply ();
00205 }

int RCS_OI::send_reply   [virtual]
 

Definition at line 216 of file rcs_oi.cc.

00217 {
00218   if (NULL != reply_channel)
00219     {
00220       if (new_reply_msg)
00221         {
00222           return (reply_channel->write (reply_msg));
00223         }
00224       return 0;
00225     }
00226   else
00227     {
00228       return -1;
00229     }
00230 }


Field Documentation

RCS_OI_REQUEST_CHANNEL* RCS_OI::request_channel [protected]
 

Definition at line 26 of file rcs_oi.hh.

RCS_OI_REPLY_CHANNEL* RCS_OI::reply_channel [protected]
 

Definition at line 28 of file rcs_oi.hh.

RCS_OI_REQUEST_MSG* RCS_OI::request_msg [protected]
 

Definition at line 30 of file rcs_oi.hh.

RCS_OI_REPLY_MSG* RCS_OI::reply_msg [protected]
 

Definition at line 31 of file rcs_oi.hh.

int RCS_OI::new_request_msg [protected]
 

Definition at line 32 of file rcs_oi.hh.

int RCS_OI::new_reply_msg [protected]
 

Definition at line 33 of file rcs_oi.hh.

NMLTYPE RCS_OI::request_type [protected]
 

Definition at line 34 of file rcs_oi.hh.

NMLTYPE RCS_OI::reply_type [protected]
 

Definition at line 35 of file rcs_oi.hh.

OI_MODE_TYPE RCS_OI::mode [protected]
 

Definition at line 36 of file rcs_oi.hh.

NODE* RCS_OI::node [protected]
 

Definition at line 37 of file rcs_oi.hh.

int RCS_OI::oi_list_id [protected]
 

Definition at line 38 of file rcs_oi.hh.

RCS_CMD_MSG* RCS_OI::cmd_for_node
 

Definition at line 49 of file rcs_oi.hh.

int RCS_OI::cmd_for_node_new
 

Definition at line 51 of file rcs_oi.hh.

int RCS_OI::request_flag
 

Definition at line 52 of file rcs_oi.hh.


The documentation for this class was generated from the following files:
Generated on Sun Dec 2 15:59:08 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001