00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #include "SoapCorba.h"
00058
00059
00060
00061
00062
00063
00064
00065
00066
00070 SCParamList::SCParamList(SCInterfaceMethod* pInterfaceMethod,
00071 DynamicAny::DynAnyFactory_ptr dynFact)
00072 {
00073 ConstructorInclude();
00074
00075 SCInterfaceMethod::MethParamIterator iMP(pInterfaceMethod);
00076 while (++iMP)
00077 {
00078 (void) new SCParamValue (this, dynFact, iMP);
00079 }
00080 }
00081
00082
00086 SCParamList::~SCParamList()
00087 {
00088 DestructorInclude();
00089
00090
00091 }
00092
00093
00094
00095
00099 void SCParamList::ConstructorInclude()
00100 {
00101
00102
00103 _firstParamValue = (SCParamValue*)0;
00104 _lastParamValue = (SCParamValue*)0;
00105 _countParamValue = 0;
00106 }
00107
00108
00112 void SCParamList::DestructorInclude()
00113 {
00114
00115 { for (SCParamValue* item = GetFirstParamValue(); item; item = GetFirstParamValue())
00116 delete item; }
00117 }
00118
00119
00120
00121
00122 void SCParamList::AddParamValueFirst(SCParamValue* item)
00123 {
00124
00125 assert(this);
00126
00127 assert(item);
00128 assert(item->_refParamList == (SCParamList*)0);
00129
00130 _countParamValue++;
00131
00132 item->_refParamList = this;
00133
00134 if (_firstParamValue)
00135 {
00136 _firstParamValue->_prevParamList = item;
00137 item->_nextParamList = _firstParamValue;
00138 _firstParamValue = item;
00139 }
00140 else
00141 _firstParamValue = _lastParamValue = item;
00142 }
00143
00144 void SCParamList::AddParamValueLast(SCParamValue* item)
00145 {
00146
00147 assert(this);
00148
00149 assert(item);
00150 assert(item->_refParamList == (SCParamList*)0);
00151
00152 _countParamValue++;
00153
00154 item->_refParamList = this;
00155
00156 if (_lastParamValue)
00157 {
00158 _lastParamValue->_nextParamList = item;
00159 item->_prevParamList = _lastParamValue;
00160 _lastParamValue = item;
00161 }
00162 else
00163 _firstParamValue = _lastParamValue = item;
00164 }
00165
00166 void SCParamList::AddParamValueAfter(SCParamValue* item, SCParamValue* pos)
00167 {
00168
00169 assert(this);
00170
00171 assert(item);
00172 assert(item->_refParamList == (SCParamList*)0);
00173
00174 assert(pos);
00175 assert(pos->_refParamList == this);
00176
00177 _countParamValue++;
00178
00179 item->_refParamList = this;
00180 item->_prevParamList = pos;
00181 item->_nextParamList = pos->_nextParamList;
00182 pos->_nextParamList = item;
00183
00184 if (item->_nextParamList)
00185 item->_nextParamList->_prevParamList = item;
00186 else
00187 _lastParamValue = item;
00188 }
00189
00190 void SCParamList::AddParamValueBefore(SCParamValue* item, SCParamValue* pos)
00191 {
00192
00193 assert(this);
00194
00195 assert(item);
00196 assert(item->_refParamList == (SCParamList*)0);
00197
00198 assert(pos);
00199 assert(pos->_refParamList == this);
00200
00201 _countParamValue++;
00202
00203 item->_refParamList = this;
00204 item->_nextParamList = pos;
00205 item->_prevParamList = pos->_prevParamList;
00206 pos->_prevParamList = item;
00207
00208 if (item->_prevParamList)
00209 item->_prevParamList->_nextParamList = item;
00210 else
00211 _firstParamValue = item;
00212 }
00213
00214 void SCParamList::RemoveParamValue(SCParamValue* item)
00215 {
00216
00217 assert(this);
00218
00219 assert(item);
00220 assert(item->_refParamList == this);
00221
00222 SCParamList::ParamValueIterator::Check(item);
00223
00224 _countParamValue--;
00225
00226 if (item->_nextParamList)
00227 item->_nextParamList->_prevParamList = item->_prevParamList;
00228 else
00229 _lastParamValue = item->_prevParamList;
00230
00231 if (item->_prevParamList)
00232 item->_prevParamList->_nextParamList = item->_nextParamList;
00233 else
00234 _firstParamValue = item->_nextParamList;
00235
00236 item->_prevParamList = (SCParamValue*)0;
00237 item->_nextParamList = (SCParamValue*)0;
00238 item->_refParamList = (SCParamList*)0;
00239 }
00240
00241 void SCParamList::DeleteAllParamValue()
00242 {
00243
00244 assert(this);
00245
00246 for (SCParamValue* item = GetFirstParamValue(); item; item = GetFirstParamValue())
00247 delete item;
00248 }
00249
00250 void SCParamList::ReplaceParamValue(SCParamValue* item, SCParamValue* newItem)
00251 {
00252
00253 assert(this);
00254
00255 assert(item);
00256 assert(item->_refParamList == this);
00257
00258 assert(newItem);
00259 assert(newItem->_refParamList == (SCParamList*)0);
00260
00261 SCParamList::ParamValueIterator::Check(item, newItem);
00262
00263 if (item->_nextParamList)
00264 item->_nextParamList->_prevParamList = newItem;
00265 else
00266 _lastParamValue = newItem;
00267
00268 if (item->_prevParamList)
00269 item->_prevParamList->_nextParamList = newItem;
00270 else
00271 _firstParamValue = newItem;
00272
00273 newItem->_nextParamList = item->_nextParamList;
00274 newItem->_prevParamList = item->_prevParamList;
00275 item->_nextParamList = (SCParamValue*)0;
00276 item->_prevParamList = (SCParamValue*)0;
00277
00278 item->_refParamList = (SCParamList*)0;
00279 newItem->_refParamList = this;
00280 }
00281
00282 SCParamValue* SCParamList::GetFirstParamValue() const
00283 {
00284
00285 assert(this);
00286 return _firstParamValue;
00287 }
00288
00289 SCParamValue* SCParamList::GetLastParamValue() const
00290 {
00291
00292 assert(this);
00293 return _lastParamValue;
00294 }
00295
00296 SCParamValue* SCParamList::GetNextParamValue(SCParamValue* pos) const
00297 {
00298
00299 assert(this);
00300
00301 if (pos == (SCParamValue*)0)
00302 return _firstParamValue;
00303
00304 assert(pos);
00305 assert(pos->_refParamList == this);
00306
00307 return pos->_nextParamList;
00308 }
00309
00310 SCParamValue* SCParamList::GetPrevParamValue(SCParamValue* pos) const
00311 {
00312
00313 assert(this);
00314
00315 if (pos == (SCParamValue*)0)
00316 return _lastParamValue;
00317
00318 assert(pos);
00319 assert(pos->_refParamList == this);
00320
00321 return pos->_prevParamList;
00322 }
00323
00324 int SCParamList::GetParamValueCount() const
00325 {
00326
00327 assert(this);
00328 return _countParamValue;
00329 }
00330
00331 void SCParamList::MoveParamValueFirst(SCParamValue* item)
00332 {
00333
00334 assert(item);
00335 assert(item->_refParamList);
00336 item->_refParamList->RemoveParamValue(item);
00337 AddParamValueFirst(item);
00338 }
00339
00340 void SCParamList::MoveParamValueLast(SCParamValue* item)
00341 {
00342
00343 assert(item);
00344 assert(item->_refParamList);
00345 item->_refParamList->RemoveParamValue(item);
00346 AddParamValueLast(item);
00347 }
00348
00349 void SCParamList::MoveParamValueAfter(SCParamValue* item, SCParamValue* pos)
00350 {
00351
00352 assert(item);
00353 assert(item->_refParamList);
00354 item->_refParamList->RemoveParamValue(item);
00355 AddParamValueAfter(item, pos);
00356 }
00357
00358 void SCParamList::MoveParamValueBefore(SCParamValue* item, SCParamValue* pos)
00359 {
00360
00361 assert(item);
00362 assert(item->_refParamList);
00363 item->_refParamList->RemoveParamValue(item);
00364 AddParamValueBefore(item, pos);
00365 }
00366
00367 void SCParamList::SortParamValue(int (*comp)(SCParamValue*, SCParamValue*))
00368 {
00369
00370 for (SCParamValue* a = GetFirstParamValue(); a; a = GetNextParamValue(a))
00371 {
00372 SCParamValue* b = GetNextParamValue(a);
00373
00374 while (b && (comp(a, b) > 0))
00375 {
00376 SCParamValue* c = GetPrevParamValue(a);
00377 while (c && (comp(c, b) > 0))
00378 c = GetPrevParamValue(c);
00379
00380 if (c)
00381 MoveParamValueAfter(b, c);
00382 else
00383 MoveParamValueFirst(b);
00384
00385 b = GetNextParamValue(a);
00386 }
00387 }
00388 }
00389
00390 SCParamList::ParamValueIterator* SCParamList::ParamValueIterator::_first = 0;
00391 SCParamList::ParamValueIterator* SCParamList::ParamValueIterator::_last = 0;
00392
00393 SCParamList::ParamValueIterator::ParamValueIterator(
00394 const SCParamList* iterParamList,
00395 int (SCParamValue::*method)() const,
00396 SCParamValue* refParamValue)
00397 {
00398 assert(iterParamList);
00399
00400 _iterParamList = iterParamList;
00401 _refParamValue = _prevParamValue = _nextParamValue = refParamValue;
00402 _prev = (ParamValueIterator*)0;
00403 _next = (ParamValueIterator*)0;
00404 _method = method;
00405 if (_last)
00406 {
00407 _last->_next = this;
00408 _prev = _last;
00409 _last = this;
00410 }
00411 else
00412 _first = _last = this;
00413 }
00414
00415 SCParamList::ParamValueIterator::ParamValueIterator(
00416 const SCParamList& iterParamList,
00417 int (SCParamValue::*method)() const,
00418 SCParamValue* refParamValue)
00419 {
00420 assert(&iterParamList);
00421
00422 _iterParamList = &iterParamList;
00423 _refParamValue = _prevParamValue = _nextParamValue = refParamValue;
00424 _prev = (ParamValueIterator*)0;
00425 _next = (ParamValueIterator*)0;
00426 _method = method;
00427 if (_last)
00428 {
00429 _last->_next = this;
00430 _prev = _last;
00431 _last = this;
00432 }
00433 else
00434 _first = _last = this;
00435 }
00436
00437 SCParamList::ParamValueIterator::ParamValueIterator(
00438 const ParamValueIterator& iterator,
00439 int (SCParamValue::*method)() const)
00440 {
00441 _iterParamList = iterator._iterParamList;
00442 _refParamValue = iterator._refParamValue;
00443 _prevParamValue = iterator._prevParamValue;
00444 _nextParamValue = iterator._nextParamValue;
00445 _prev = (ParamValueIterator*)0;
00446 _next = (ParamValueIterator*)0;
00447 _method = method;
00448 if (_last)
00449 {
00450 _last->_next = this;
00451 _prev = _last;
00452 _last = this;
00453 }
00454 else
00455 _first = _last = this;
00456 }
00457
00458 SCParamList::ParamValueIterator::~ParamValueIterator()
00459 {
00460 if (_next)
00461 _next->_prev = _prev;
00462 else
00463 _last = _prev;
00464
00465 if (_prev)
00466 _prev->_next = _next;
00467 else
00468 _first = _next;
00469 }
00470
00471 void SCParamList::ParamValueIterator::Check(SCParamValue* itemParamValue)
00472 {
00473 for (ParamValueIterator* item = _first; item; item = item->_next)
00474 {
00475 if (item->_prevParamValue == itemParamValue)
00476 {
00477 item->_prevParamValue = item->_iterParamList->GetNextParamValue(item->_prevParamValue);
00478 item->_refParamValue = 0;
00479 }
00480 if (item->_nextParamValue == itemParamValue)
00481 {
00482 item->_nextParamValue = item->_iterParamList->GetPrevParamValue(item->_nextParamValue);
00483 item->_refParamValue = 0;
00484 }
00485 }
00486 }
00487
00488 void SCParamList::ParamValueIterator::Check(SCParamValue* itemParamValue, SCParamValue* newItemParamValue)
00489 {
00490 for (ParamValueIterator* item = _first; item; item = item->_next)
00491 {
00492 if (item->_refParamValue == itemParamValue)
00493 {
00494 item->_refParamValue = item->_prevParamValue = item->_nextParamValue = newItemParamValue;
00495 }
00496 if (item->_prevParamValue == itemParamValue)
00497 {
00498 item->_prevParamValue = newItemParamValue;
00499 item->_refParamValue = 0;
00500 }
00501 if (item->_nextParamValue == itemParamValue)
00502 {
00503 item->_nextParamValue = newItemParamValue;
00504 item->_refParamValue = 0;
00505 }
00506 }
00507 }
00508
00509
00510
00511
00512