00001 extern "C"
00002 {
00003 #include <string.h>
00004 #include <stdlib.h>
00005 }
00006
00007 #include "oi_msg.hh"
00008
00009
00010 RCS_OI_REQUEST_MSG::RCS_OI_REQUEST_MSG (NMLTYPE t, size_t sz):NMLmsg (t, sz)
00011 {
00012
00013 }
00014
00015 int
00016 RCS_OI_REQUEST_format (NMLTYPE t, void *buf, CMS * cms)
00017 {
00018 switch (t)
00019 {
00020 case RCS_GENERIC_OI_REQUEST_TYPE:
00021 ((RCS_GENERIC_OI_REQUEST *) buf)->update (cms);
00022 return (1);
00023
00024 default:
00025 return (0);
00026 }
00027 return (0);
00028 }
00029
00030 RCS_GENERIC_OI_REQUEST::RCS_GENERIC_OI_REQUEST ():
00031 RCS_OI_REQUEST_MSG (RCS_GENERIC_OI_REQUEST_TYPE,
00032 sizeof (RCS_GENERIC_OI_REQUEST))
00033 {
00034
00035 }
00036
00037 void
00038 RCS_GENERIC_OI_REQUEST::update (CMS * cms)
00039 {
00040
00041 }
00042
00043
00044 #ifdef __BORLANDC__
00045 RCS_OI_REQUEST_CHANNEL::RCS_OI_REQUEST_CHANNEL (NML_FORMAT_PTR f_ptr,
00046 char *name, char *process,
00047 char *file, int set_to_server)
00048 #else
00049 RCS_OI_REQUEST_CHANNEL::RCS_OI_REQUEST_CHANNEL (NML_FORMAT_PTR f_ptr,
00050 char *name, char *process,
00051 char *file,
00052 int set_to_server = 0)
00053 #endif
00054 :
00055 NML (name, process, file, set_to_server)
00056 {
00057 format_chain = new RCS_LINKED_LIST;
00058 prefix_format_chain (f_ptr);
00059 prefix_format_chain (RCS_OI_REQUEST_format);
00060 register_with_server ();
00061 }
00062
00063
00064 RCS_OI_REPLY_MSG::RCS_OI_REPLY_MSG (NMLTYPE t, size_t sz):NMLmsg (t, sz)
00065 {
00066
00067 }
00068
00069 int
00070 RCS_OI_REPLY_format (NMLTYPE t, void *buf, CMS * cms)
00071 {
00072 switch (t)
00073 {
00074 case RCS_GENERIC_OI_REPLY_TYPE:
00075 ((RCS_GENERIC_OI_REPLY *) buf)->update (cms);
00076 return (1);
00077
00078 default:
00079 return (0);
00080 }
00081 return (0);
00082 }
00083
00084 RCS_GENERIC_OI_REPLY::RCS_GENERIC_OI_REPLY ():
00085 RCS_OI_REPLY_MSG (RCS_GENERIC_OI_REPLY_TYPE, sizeof (RCS_GENERIC_OI_REPLY))
00086 {
00087
00088 }
00089
00090 void
00091 RCS_GENERIC_OI_REPLY::update (CMS * cms)
00092 {
00093
00094 }
00095
00096 #ifdef __BORLANDC__
00097 RCS_OI_REPLY_CHANNEL::RCS_OI_REPLY_CHANNEL (NML_FORMAT_PTR f_ptr, char *name,
00098 char *process, char *file,
00099 int set_to_server)
00100 #else
00101 RCS_OI_REPLY_CHANNEL::RCS_OI_REPLY_CHANNEL (NML_FORMAT_PTR f_ptr, char *name,
00102 char *process, char *file,
00103 int set_to_server = 0)
00104 #endif
00105 :
00106 NML (name, process, file, set_to_server)
00107 {
00108 format_chain = new RCS_LINKED_LIST;
00109 prefix_format_chain (f_ptr);
00110 prefix_format_chain (RCS_OI_REPLY_format);
00111 register_with_server ();
00112 }
00113
00114
00115 OI_REPLY_QUEUE_NODE::OI_REPLY_QUEUE_NODE (RCS_OI_REPLY_MSG * _msg)
00116 {
00117 next = NULL;
00118 if (NULL != _msg)
00119 {
00120 msg = (RCS_OI_REPLY_MSG *) malloc (_msg->size);
00121 memcpy (msg, _msg, _msg->size);
00122 }
00123 else
00124 {
00125 msg = NULL;
00126 }
00127 }
00128
00129 OI_REPLY_QUEUE_NODE::~OI_REPLY_QUEUE_NODE ()
00130 {
00131
00132 }
00133
00134 OI_REPLY_QUEUE::OI_REPLY_QUEUE ()
00135 {
00136 head = NULL;
00137 tail = NULL;
00138 }
00139
00140 OI_REPLY_QUEUE::~OI_REPLY_QUEUE ()
00141 {
00142 flush ();
00143 }
00144
00145
00146 void
00147 OI_REPLY_QUEUE::add_message (RCS_OI_REPLY_MSG * _msg)
00148 {
00149 OI_REPLY_QUEUE_NODE *new_reply_node;
00150
00151 new_reply_node = new OI_REPLY_QUEUE_NODE (_msg);
00152
00153 if (NULL == head)
00154 {
00155 head = new_reply_node;
00156 }
00157 if (NULL != tail)
00158 {
00159 tail->next = new_reply_node;
00160 tail = new_reply_node;
00161 }
00162 else
00163 {
00164 tail = new_reply_node;
00165 }
00166 }
00167
00168
00169
00170 RCS_OI_REPLY_MSG *
00171 OI_REPLY_QUEUE::get_message ()
00172 {
00173 RCS_OI_REPLY_MSG *return_msg;
00174 OI_REPLY_QUEUE_NODE *first_reply_node;
00175
00176 if (NULL != head)
00177 {
00178 return_msg = head->msg;
00179 first_reply_node = head;
00180 head = head->next;
00181 delete first_reply_node;
00182 return return_msg;
00183 }
00184 return NULL;
00185 }
00186
00187
00188 void
00189 OI_REPLY_QUEUE::flush ()
00190 {
00191 OI_REPLY_QUEUE_NODE *temp;
00192 while (NULL != head)
00193 {
00194 delete head->msg;
00195 head->msg = NULL;
00196 temp = head;
00197 head = head->next;
00198 delete temp;
00199 }
00200 tail = NULL;
00201 }