00001 // -*- Mode: C++; -*- 00002 // Package : omniEvents 00003 // oep_types.cc Created : 1/10/99 00004 // Author : Paul Nader (pwn) 00005 // 00006 // Copyright (C) 1998 Paul Nader. 00007 // 00008 // This file is part of the omniEvents application. 00009 // 00010 // omniEvents is free software; you can redistribute it and/or 00011 // modify it under the terms of the GNU Lesser General Public 00012 // License as published by the Free Software Foundation; either 00013 // version 2.1 of the License, or (at your option) any later version. 00014 // 00015 // omniEvents is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00023 // 00024 // Description: 00025 // 00026 00027 /* 00028 $Log: oep_types.cc,v $ 00029 Revision 1.2 2003/11/03 22:25:14 alextingle 00030 Updated License to GNU Lesser General Public v2.1 00031 00032 Revision 1.1.1.1 2002/09/25 19:00:29 shamus13 00033 Import of OmniEvents source tree from release 2.1.1 00034 00035 Revision 1.7 2000/10/03 08:38:21 naderp 00036 *** empty log message *** 00037 00038 Revision 1.6 2000/09/26 08:47:15 naderp 00039 Configurable STL default parameters. 00040 00041 Revision 1.5 2000/09/05 01:02:08 naderp 00042 Added MaxQueueLength QOS. 00043 00044 Revision 1.4 2000/08/20 01:24:13 naderp 00045 R'ved incorrect cadm & sadm initialisation in OEP_ecps constructor. 00046 00047 Revision 1.3 2000/03/06 13:14:34 naderp 00048 Removed name and added port. 00049 00050 Revision 1.2 2000/03/02 01:28:01 naderp 00051 Moved proxy containment from event channel to admin objects. 00052 00053 Revision 1.1 1999/11/02 08:00:57 naderp 00054 Using defaults.h 00055 00056 Revision 1.0 99/11/01 16:29:28 16:29:28 naderp (Paul Nader) 00057 Initial revision 00058 00059 */ 00060 00061 #include "defaults.h" 00062 #include "oep_types.h" 00063 00064 //------------------------------------------------------------------------ 00065 // Proxy Persistent Data Representation 00066 //------------------------------------------------------------------------ 00067 00068 OEP_prxy::OEP_prxy() : 00069 key(NULL), 00070 ior(NULL) 00071 { 00072 // Empty 00073 } 00074 00075 OEP_prxy::~OEP_prxy() 00076 { 00077 if (key != NULL) 00078 { 00079 delete key; 00080 } 00081 00082 if (ior != NULL) 00083 { 00084 delete ior; 00085 } 00086 } 00087 00088 void 00089 OEP_prxy::setKey(char *k) 00090 { 00091 if (key != NULL) 00092 { 00093 delete key; 00094 } 00095 00096 key = k; 00097 } 00098 00099 const char * 00100 OEP_prxy::getKey(void) const 00101 { 00102 return key; 00103 } 00104 00105 void 00106 OEP_prxy::setIor(char *i) 00107 { 00108 if (ior != NULL) 00109 { 00110 delete ior; 00111 } 00112 00113 ior = i; 00114 } 00115 00116 const char * 00117 OEP_prxy::getIor(void) const 00118 { 00119 return ior; 00120 } 00121 00122 //------------------------------------------------------------------------ 00123 // Consumer Admin Persistent Data Representation 00124 //------------------------------------------------------------------------ 00125 00126 OEP_caps::OEP_caps() : 00127 key(NULL) 00128 { 00129 // Empty 00130 } 00131 00132 OEP_caps::~OEP_caps() 00133 { 00134 if (key != NULL) 00135 { 00136 delete key; 00137 } 00138 00139 OepPrxyList::iterator iter; 00140 00141 for (iter=ppss.begin(); iter != ppss.end(); iter++) 00142 { 00143 if (*iter != NULL) 00144 { 00145 delete *iter; 00146 } 00147 } 00148 00149 for (iter=ppls.begin(); iter != ppls.end(); iter++) 00150 { 00151 if (*iter != NULL) 00152 { 00153 delete *iter; 00154 } 00155 } 00156 00157 } 00158 00159 void 00160 OEP_caps::setKey(char *k) 00161 { 00162 if (key != NULL) 00163 { 00164 delete key; 00165 } 00166 00167 key = k; 00168 } 00169 00170 const char * 00171 OEP_caps::getKey(void) const 00172 { 00173 return key; 00174 } 00175 00176 void 00177 OEP_caps::addProxyPushSupplier(OEP_prxy *p) 00178 { 00179 ppss.push_front(p); 00180 } 00181 00182 const OepPrxyList & 00183 OEP_caps::getProxyPushSuppliers(void) const 00184 { 00185 return ppss; 00186 } 00187 00188 void 00189 OEP_caps::addProxyPullSupplier(OEP_prxy *p) 00190 { 00191 ppls.push_front(p); 00192 } 00193 00194 const OepPrxyList & 00195 OEP_caps::getProxyPullSuppliers(void) const 00196 { 00197 return ppls; 00198 } 00199 00200 //------------------------------------------------------------------------ 00201 // Supplier Admin Persistent Data Representation 00202 //------------------------------------------------------------------------ 00203 00204 OEP_saps::OEP_saps() : 00205 key(NULL) 00206 { 00207 // Empty 00208 } 00209 00210 OEP_saps::~OEP_saps() 00211 { 00212 if (key != NULL) 00213 { 00214 delete key; 00215 } 00216 00217 OepPrxyList::iterator iter; 00218 00219 for (iter=ppsc.begin(); iter != ppsc.end(); iter++) 00220 { 00221 if (*iter != NULL) 00222 { 00223 delete *iter; 00224 } 00225 } 00226 00227 for (iter=pplc.begin(); iter != pplc.end(); iter++) 00228 { 00229 if (*iter != NULL) 00230 { 00231 delete *iter; 00232 } 00233 } 00234 } 00235 00236 void 00237 OEP_saps::setKey(char *k) 00238 { 00239 if (key != NULL) 00240 { 00241 delete key; 00242 } 00243 00244 key = k; 00245 } 00246 00247 const char * 00248 OEP_saps::getKey(void) const 00249 { 00250 return key; 00251 } 00252 00253 void 00254 OEP_saps::addProxyPushConsumer(OEP_prxy *p) 00255 { 00256 ppsc.push_front(p); 00257 } 00258 00259 const OepPrxyList & 00260 OEP_saps::getProxyPushConsumers(void) const 00261 { 00262 return ppsc; 00263 } 00264 00265 void 00266 OEP_saps::addProxyPullConsumer(OEP_prxy *p) 00267 { 00268 pplc.push_front(p); 00269 } 00270 00271 const OepPrxyList & 00272 OEP_saps::getProxyPullConsumers(void) const 00273 { 00274 return pplc; 00275 } 00276 00277 //------------------------------------------------------------------------ 00278 // Event Channel Persistent Data Representation 00279 //------------------------------------------------------------------------ 00280 00281 00282 OEP_ecps::OEP_ecps() : 00283 key(NULL), 00284 pullRetryPeriod(PULL_RETRY_PERIOD), 00285 maxQueueLength(MAX_QUEUE_LENGTH), 00286 maxEventsPerConsumer(MAX_EVENTS_PER_CONSUMER) 00287 { 00288 // Empty 00289 } 00290 00291 OEP_ecps::~OEP_ecps() 00292 { 00293 if (key != NULL) 00294 { 00295 delete key; 00296 } 00297 00298 OepCapsList::iterator ci; 00299 00300 for (ci=cadm.begin(); ci != cadm.end(); ci++) 00301 { 00302 if (*ci != NULL) 00303 { 00304 delete *ci; 00305 } 00306 } 00307 00308 OepSapsList::iterator si; 00309 00310 for (si=sadm.begin(); si != sadm.end(); si++) 00311 { 00312 if (*si != NULL) 00313 { 00314 delete *si; 00315 } 00316 } 00317 } 00318 00319 void 00320 OEP_ecps::setKey(char *k) 00321 { 00322 if (key != NULL) 00323 { 00324 delete key; 00325 } 00326 00327 key = k; 00328 } 00329 00330 const char * 00331 OEP_ecps::getKey(void) const 00332 { 00333 return key; 00334 } 00335 00336 void 00337 OEP_ecps::addConsumerAdmin(OEP_caps *c) 00338 { 00339 cadm.push_front(c); 00340 } 00341 00342 const OepCapsList & 00343 OEP_ecps::getConsumerAdmins(void) const 00344 { 00345 return cadm; 00346 } 00347 00348 void 00349 OEP_ecps::addSupplierAdmin(OEP_saps *s) 00350 { 00351 sadm.push_front(s); 00352 } 00353 00354 const OepSapsList & 00355 OEP_ecps::getSupplierAdmins(void) const 00356 { 00357 return sadm; 00358 } 00359 00360 void 00361 OEP_ecps::setPullRetryPeriod(long p) 00362 { 00363 pullRetryPeriod = p; 00364 } 00365 00366 long 00367 OEP_ecps::getPullRetryPeriod(void) const 00368 { 00369 return pullRetryPeriod; 00370 } 00371 00372 void 00373 OEP_ecps::setMaxQueueLength(long m) 00374 { 00375 maxQueueLength = m; 00376 } 00377 00378 long 00379 OEP_ecps::getMaxQueueLength(void) const 00380 { 00381 return maxQueueLength; 00382 } 00383 00384 void 00385 OEP_ecps::setMaxEventsPerConsumer(long m) 00386 { 00387 maxEventsPerConsumer = m; 00388 } 00389 00390 long 00391 OEP_ecps::getMaxEventsPerConsumer(void) const 00392 { 00393 return maxEventsPerConsumer; 00394 } 00395 00396 00397 00398 //------------------------------------------------------------------------ 00399 // Channel Factory Persistent Data Representation 00400 //------------------------------------------------------------------------ 00401 00402 OEP_cfps::OEP_cfps() : 00403 port(0), 00404 key(NULL) 00405 { 00406 // Empty 00407 } 00408 00409 OEP_cfps::~OEP_cfps() 00410 { 00411 if (key != NULL) 00412 { 00413 delete key; 00414 } 00415 00416 OepEcpsList::iterator iter; 00417 00418 for (iter=channels.begin(); iter != channels.end(); iter++) 00419 { 00420 if (*iter != NULL) 00421 { 00422 delete *iter; 00423 } 00424 } 00425 } 00426 00427 void 00428 OEP_cfps::setPort(unsigned int p) 00429 { 00430 port = p; 00431 } 00432 00433 const unsigned int 00434 OEP_cfps::getPort(void) const 00435 { 00436 return port; 00437 } 00438 00439 void 00440 OEP_cfps::setKey(char *k) 00441 { 00442 if (key != NULL) 00443 { 00444 delete key; 00445 } 00446 00447 key = k; 00448 } 00449 00450 const char * 00451 OEP_cfps::getKey(void) const 00452 { 00453 return key; 00454 } 00455 00456 void 00457 OEP_cfps::addChannel(OEP_ecps *channel) 00458 { 00459 channels.push_front(channel); 00460 } 00461 00462 OepEcpsList & 00463 OEP_cfps::getChannels(void) 00464 { 00465 return channels; 00466 }