Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

InterfaceRepository.cpp

Go to the documentation of this file.
00001 // /******************************************************************************\
00002 // *
00003 // * File:          InterfaceRepository.cpp
00004 // * Creation date: May 25, 2001 11:34
00005 // * Author:        ClassBuilder
00006 // *                XXXX
00007 // * Purpose:       Method implementations of class 'SCInterfaceRepository'
00008 // *
00009 // * Modifications: @INSERT_MODIFICATIONS(* )
00010 // * June 06, 2001 12:52 WERS
00011 // *     Added method 'FindInterfaceMethod'
00012 // * May 25, 2001 11:34 WERS
00013 // *     Added method 'DestructorInclude'
00014 // *     Added method 'ConstructorInclude'
00015 // *     Added method '~SCInterfaceRepository'
00016 // *     Added method 'SCInterfaceRepository'
00017 // *     Added relation 'InterfaceRepository(SCInterfaceRepository) <>-->> InterfaceMethod(SCInterfaceMethod)'
00018 // *
00019 // *
00020 // \******************************************************************************/
00021 //@START_USER1
00026 /* --------------------------------------------------------------
00027 Copyright (C) 2001 LifeLine Networks BV <soap2corba@lifeline.nl>
00028 
00029 This program is free software; you can redistribute it and/or
00030 modify it under the terms of the GNU General Public License
00031 as published by the Free Software Foundation; either
00032 version 2 of the License, or (at your option) any later
00033 version.
00034 
00035 This program is distributed in the hope that it will be useful,
00036 but WITHOUT ANY WARRANTY; without even the implied warranty of
00037 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00038 GNU General Public License for more details.
00039 
00040 You should have received a copy of the GNU General Public License
00041 along with this program; if not, write to the Free Software
00042 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00043 -------------------------------------------------------------- */
00044 //@END_USER1
00045 
00046 
00047 // Master include file
00048 #include "SoapCorba.h"
00049 
00050 
00051 //@START_USER2
00052 //@END_USER2
00053 
00054 
00055 // Static members
00056 
00057 
00061 SCInterfaceRepository::SCInterfaceRepository() //@INIT_1885
00062 {//@CODE_1885
00063     ConstructorInclude();
00064 
00065     // Put in your own code
00066 }//@CODE_1885
00067 
00068 
00072 SCInterfaceRepository::~SCInterfaceRepository()
00073 {//@CODE_1597
00074     DestructorInclude();
00075 
00076     // Put in your own code
00077 }//@CODE_1597
00078 
00079 
00086 SCInterfaceMethod* SCInterfaceRepository::FindInterfaceMethod(const char* methPath)
00087 {//@CODE_2113
00088     SCInterfaceMethod* value = NULL;
00089     InterfaceMethodIterator iInterfaceMethod(this);
00090     while (++iInterfaceMethod)
00091     {
00092         if (iInterfaceMethod->m_mthPath.CompareNoCase (methPath) == 0) {
00093             value = iInterfaceMethod;
00094             break;
00095         }
00096     }
00097     return value;
00098 }//@CODE_2113
00099 
00100 
00101 //{{AFX DO NOT EDIT CODE BELOW THIS LINE !!!
00102 
00106 void SCInterfaceRepository::ConstructorInclude()
00107 {
00108     // INIT_MULTI_OWNED_ACTIVE(SCInterfaceRepository, InterfaceRepository, SCInterfaceMethod, InterfaceMethod)
00109    
00110     _firstInterfaceMethod = (SCInterfaceMethod*)0;
00111     _lastInterfaceMethod = (SCInterfaceMethod*)0;
00112     _countInterfaceMethod = 0;
00113 }
00114 
00115 
00119 void SCInterfaceRepository::DestructorInclude()
00120 {
00121     // EXIT_MULTI_OWNED_ACTIVE(SCInterfaceRepository, InterfaceRepository, SCInterfaceMethod, InterfaceMethod)
00122     { for (SCInterfaceMethod* item = GetFirstInterfaceMethod(); item; item = GetFirstInterfaceMethod())
00123           delete item; }
00124 }
00125 
00126 
00127 // Methods for the relation(s) of the class
00128 // METHODS_MULTI_OWNED_ACTIVE(SCInterfaceRepository, InterfaceRepository, SCInterfaceMethod, InterfaceMethod)
00129 void SCInterfaceRepository::AddInterfaceMethodFirst(SCInterfaceMethod* item)
00130 {
00131     
00132     assert(this);
00133 
00134     assert(item);
00135     assert(item->_refInterfaceRepository == (SCInterfaceRepository*)0);
00136 
00137     _countInterfaceMethod++;
00138 
00139     item->_refInterfaceRepository = this;
00140 
00141     if (_firstInterfaceMethod)
00142     {
00143         _firstInterfaceMethod->_prevInterfaceRepository = item;
00144         item->_nextInterfaceRepository = _firstInterfaceMethod;
00145         _firstInterfaceMethod = item;
00146     }
00147     else
00148         _firstInterfaceMethod = _lastInterfaceMethod = item; 
00149 }
00150 
00151 void SCInterfaceRepository::AddInterfaceMethodLast(SCInterfaceMethod* item)
00152 {
00153     
00154     assert(this);
00155 
00156     assert(item);
00157     assert(item->_refInterfaceRepository == (SCInterfaceRepository*)0);
00158 
00159     _countInterfaceMethod++;
00160 
00161     item->_refInterfaceRepository = this;
00162 
00163     if (_lastInterfaceMethod)
00164     {
00165         _lastInterfaceMethod->_nextInterfaceRepository = item;
00166         item->_prevInterfaceRepository = _lastInterfaceMethod;
00167         _lastInterfaceMethod = item;
00168     }
00169     else
00170         _firstInterfaceMethod = _lastInterfaceMethod = item; 
00171 }
00172 
00173 void SCInterfaceRepository::AddInterfaceMethodAfter(SCInterfaceMethod* item, SCInterfaceMethod* pos)
00174 {
00175     
00176     assert(this);
00177 
00178     assert(item);
00179     assert(item->_refInterfaceRepository == (SCInterfaceRepository*)0);
00180 
00181     assert(pos);
00182     assert(pos->_refInterfaceRepository == this);
00183 
00184     _countInterfaceMethod++;
00185 
00186     item->_refInterfaceRepository = this;
00187     item->_prevInterfaceRepository = pos;
00188     item->_nextInterfaceRepository = pos->_nextInterfaceRepository;
00189     pos->_nextInterfaceRepository  = item;
00190 
00191     if (item->_nextInterfaceRepository)
00192         item->_nextInterfaceRepository->_prevInterfaceRepository = item;
00193     else
00194         _lastInterfaceMethod = item; 
00195 }
00196 
00197 void SCInterfaceRepository::AddInterfaceMethodBefore(SCInterfaceMethod* item, SCInterfaceMethod* pos)
00198 {
00199     
00200     assert(this);
00201 
00202     assert(item);
00203     assert(item->_refInterfaceRepository == (SCInterfaceRepository*)0);
00204 
00205     assert(pos);
00206     assert(pos->_refInterfaceRepository == this);
00207 
00208     _countInterfaceMethod++;
00209 
00210     item->_refInterfaceRepository = this;
00211     item->_nextInterfaceRepository = pos;
00212     item->_prevInterfaceRepository = pos->_prevInterfaceRepository;
00213     pos->_prevInterfaceRepository  = item;
00214 
00215     if (item->_prevInterfaceRepository)
00216         item->_prevInterfaceRepository->_nextInterfaceRepository = item;
00217     else
00218         _firstInterfaceMethod = item; 
00219 }
00220 
00221 void SCInterfaceRepository::RemoveInterfaceMethod(SCInterfaceMethod* item)
00222 {
00223     
00224     assert(this);
00225 
00226     assert(item);
00227     assert(item->_refInterfaceRepository == this);
00228 
00229     SCInterfaceRepository::InterfaceMethodIterator::Check(item);
00230 
00231     _countInterfaceMethod--;
00232 
00233     if (item->_nextInterfaceRepository)
00234         item->_nextInterfaceRepository->_prevInterfaceRepository = item->_prevInterfaceRepository;
00235     else
00236         _lastInterfaceMethod = item->_prevInterfaceRepository;
00237 
00238     if (item->_prevInterfaceRepository)
00239         item->_prevInterfaceRepository->_nextInterfaceRepository = item->_nextInterfaceRepository;
00240     else
00241         _firstInterfaceMethod = item->_nextInterfaceRepository;
00242 
00243     item->_prevInterfaceRepository = (SCInterfaceMethod*)0;
00244     item->_nextInterfaceRepository = (SCInterfaceMethod*)0;
00245     item->_refInterfaceRepository = (SCInterfaceRepository*)0; 
00246 }
00247 
00248 void SCInterfaceRepository::DeleteAllInterfaceMethod()
00249 {
00250     
00251     assert(this);
00252 
00253     for (SCInterfaceMethod* item = GetFirstInterfaceMethod(); item; item = GetFirstInterfaceMethod())
00254           delete item; 
00255 }
00256 
00257 void SCInterfaceRepository::ReplaceInterfaceMethod(SCInterfaceMethod* item, SCInterfaceMethod* newItem)
00258 {
00259     
00260     assert(this);
00261 
00262     assert(item);
00263     assert(item->_refInterfaceRepository == this);
00264 
00265     assert(newItem);
00266     assert(newItem->_refInterfaceRepository == (SCInterfaceRepository*)0);
00267 
00268     SCInterfaceRepository::InterfaceMethodIterator::Check(item, newItem);
00269 
00270     if (item->_nextInterfaceRepository)
00271         item->_nextInterfaceRepository->_prevInterfaceRepository = newItem;
00272     else
00273         _lastInterfaceMethod = newItem;
00274 
00275     if (item->_prevInterfaceRepository)
00276         item->_prevInterfaceRepository->_nextInterfaceRepository = newItem;
00277     else
00278         _firstInterfaceMethod = newItem;
00279 
00280     newItem->_nextInterfaceRepository = item->_nextInterfaceRepository;
00281     newItem->_prevInterfaceRepository = item->_prevInterfaceRepository;
00282     item->_nextInterfaceRepository = (SCInterfaceMethod*)0;
00283     item->_prevInterfaceRepository = (SCInterfaceMethod*)0;
00284 
00285     item->_refInterfaceRepository = (SCInterfaceRepository*)0;
00286     newItem->_refInterfaceRepository = this; 
00287 }
00288 
00289 SCInterfaceMethod* SCInterfaceRepository::GetFirstInterfaceMethod() const
00290 {
00291     
00292     assert(this);
00293     return _firstInterfaceMethod; 
00294 }
00295 
00296 SCInterfaceMethod* SCInterfaceRepository::GetLastInterfaceMethod() const
00297 {
00298     
00299     assert(this);
00300     return _lastInterfaceMethod; 
00301 }
00302 
00303 SCInterfaceMethod* SCInterfaceRepository::GetNextInterfaceMethod(SCInterfaceMethod* pos) const
00304 {
00305     
00306     assert(this);
00307 
00308     if (pos == (SCInterfaceMethod*)0)
00309         return _firstInterfaceMethod;
00310 
00311     assert(pos);
00312     assert(pos->_refInterfaceRepository == this);
00313 
00314     return pos->_nextInterfaceRepository; 
00315 }
00316 
00317 SCInterfaceMethod* SCInterfaceRepository::GetPrevInterfaceMethod(SCInterfaceMethod* pos) const
00318 {
00319     
00320     assert(this);
00321 
00322     if (pos == (SCInterfaceMethod*)0)
00323         return _lastInterfaceMethod;
00324 
00325     assert(pos);
00326     assert(pos->_refInterfaceRepository == this);
00327 
00328     return pos->_prevInterfaceRepository; 
00329 }
00330 
00331 int SCInterfaceRepository::GetInterfaceMethodCount() const
00332 {
00333     
00334     assert(this);
00335     return _countInterfaceMethod; 
00336 }
00337 
00338 void SCInterfaceRepository::MoveInterfaceMethodFirst(SCInterfaceMethod* item)
00339 {
00340     
00341     assert(item);
00342     assert(item->_refInterfaceRepository);
00343     item->_refInterfaceRepository->RemoveInterfaceMethod(item);
00344     AddInterfaceMethodFirst(item); 
00345 }
00346 
00347 void SCInterfaceRepository::MoveInterfaceMethodLast(SCInterfaceMethod* item)
00348 {
00349     
00350     assert(item);
00351     assert(item->_refInterfaceRepository);
00352     item->_refInterfaceRepository->RemoveInterfaceMethod(item);
00353     AddInterfaceMethodLast(item); 
00354 }
00355 
00356 void SCInterfaceRepository::MoveInterfaceMethodAfter(SCInterfaceMethod* item, SCInterfaceMethod* pos)
00357 {
00358     
00359     assert(item);
00360     assert(item->_refInterfaceRepository);
00361     item->_refInterfaceRepository->RemoveInterfaceMethod(item);
00362     AddInterfaceMethodAfter(item, pos); 
00363 }
00364 
00365 void SCInterfaceRepository::MoveInterfaceMethodBefore(SCInterfaceMethod* item, SCInterfaceMethod* pos)
00366 {
00367     
00368     assert(item);
00369     assert(item->_refInterfaceRepository);
00370     item->_refInterfaceRepository->RemoveInterfaceMethod(item);
00371     AddInterfaceMethodBefore(item, pos); 
00372 }
00373 
00374 void SCInterfaceRepository::SortInterfaceMethod(int (*comp)(SCInterfaceMethod*, SCInterfaceMethod*))
00375 {
00376     
00377     for (SCInterfaceMethod* a = GetFirstInterfaceMethod(); a; a = GetNextInterfaceMethod(a))
00378     {
00379         SCInterfaceMethod* b = GetNextInterfaceMethod(a);
00380 
00381         while (b && (comp(a, b) > 0))
00382         {
00383             SCInterfaceMethod* c = GetPrevInterfaceMethod(a);
00384             while (c && (comp(c, b) > 0))
00385                 c = GetPrevInterfaceMethod(c);
00386 
00387             if (c)
00388                 MoveInterfaceMethodAfter(b, c);
00389             else
00390                 MoveInterfaceMethodFirst(b);
00391 
00392             b = GetNextInterfaceMethod(a);
00393         }
00394     } 
00395 }
00396 // METHODS_ITERATOR_MULTI_ACTIVE(SCInterfaceRepository, InterfaceRepository, SCInterfaceMethod, InterfaceMethod)
00397 SCInterfaceRepository::InterfaceMethodIterator* SCInterfaceRepository::InterfaceMethodIterator::_first = 0;
00398 SCInterfaceRepository::InterfaceMethodIterator* SCInterfaceRepository::InterfaceMethodIterator::_last = 0;
00399 
00400 SCInterfaceRepository::InterfaceMethodIterator::InterfaceMethodIterator(
00401     const SCInterfaceRepository* iterInterfaceRepository,
00402     int (SCInterfaceMethod::*method)() const,
00403     SCInterfaceMethod* refInterfaceMethod)
00404 {
00405     assert(iterInterfaceRepository);
00406 
00407     _iterInterfaceRepository = iterInterfaceRepository;
00408     _refInterfaceMethod = _prevInterfaceMethod = _nextInterfaceMethod = refInterfaceMethod;
00409     _prev = (InterfaceMethodIterator*)0;
00410     _next = (InterfaceMethodIterator*)0;
00411     _method = method;
00412     if (_last)
00413     {
00414         _last->_next = this;
00415         _prev = _last;
00416         _last = this;
00417     }
00418     else
00419         _first = _last = this;
00420 }
00421 
00422 SCInterfaceRepository::InterfaceMethodIterator::InterfaceMethodIterator(
00423     const SCInterfaceRepository& iterInterfaceRepository,
00424     int (SCInterfaceMethod::*method)() const,
00425     SCInterfaceMethod* refInterfaceMethod)
00426 {
00427     assert(&iterInterfaceRepository);
00428 
00429     _iterInterfaceRepository = &iterInterfaceRepository;
00430     _refInterfaceMethod = _prevInterfaceMethod = _nextInterfaceMethod = refInterfaceMethod;
00431     _prev = (InterfaceMethodIterator*)0;
00432     _next = (InterfaceMethodIterator*)0;
00433     _method = method;
00434     if (_last)
00435     {
00436         _last->_next = this;
00437         _prev = _last;
00438         _last = this;
00439     }
00440     else
00441         _first = _last = this;
00442 }
00443 
00444 SCInterfaceRepository::InterfaceMethodIterator::InterfaceMethodIterator(
00445     const InterfaceMethodIterator& iterator,
00446     int (SCInterfaceMethod::*method)() const)
00447 {
00448     _iterInterfaceRepository = iterator._iterInterfaceRepository;
00449     _refInterfaceMethod = iterator._refInterfaceMethod;
00450     _prevInterfaceMethod = iterator._prevInterfaceMethod;
00451     _nextInterfaceMethod = iterator._nextInterfaceMethod;
00452     _prev = (InterfaceMethodIterator*)0;
00453     _next = (InterfaceMethodIterator*)0;
00454     _method = method;
00455     if (_last)
00456     {
00457         _last->_next = this;
00458         _prev = _last;
00459         _last = this;
00460     }
00461     else
00462         _first = _last = this;
00463 }
00464 
00465 SCInterfaceRepository::InterfaceMethodIterator::~InterfaceMethodIterator()
00466 {
00467     if (_next)
00468         _next->_prev = _prev;
00469     else
00470         _last = _prev;
00471 
00472     if (_prev)
00473         _prev->_next = _next;
00474     else
00475         _first = _next;
00476 }
00477 
00478 void SCInterfaceRepository::InterfaceMethodIterator::Check(SCInterfaceMethod* itemInterfaceMethod)
00479 {
00480     for (InterfaceMethodIterator* item = _first; item; item = item->_next)
00481     {
00482         if (item->_prevInterfaceMethod == itemInterfaceMethod)
00483         {
00484             item->_prevInterfaceMethod = item->_iterInterfaceRepository->GetNextInterfaceMethod(item->_prevInterfaceMethod);
00485             item->_refInterfaceMethod = 0;
00486         }
00487         if (item->_nextInterfaceMethod == itemInterfaceMethod)
00488         {
00489             item->_nextInterfaceMethod = item->_iterInterfaceRepository->GetPrevInterfaceMethod(item->_nextInterfaceMethod);
00490             item->_refInterfaceMethod = 0;
00491         }
00492     }
00493 }
00494 
00495 void SCInterfaceRepository::InterfaceMethodIterator::Check(SCInterfaceMethod* itemInterfaceMethod, SCInterfaceMethod* newItemInterfaceMethod)
00496 {
00497     for (InterfaceMethodIterator* item = _first; item; item = item->_next)
00498     {
00499         if (item->_refInterfaceMethod == itemInterfaceMethod)
00500         {
00501             item->_refInterfaceMethod = item->_prevInterfaceMethod = item->_nextInterfaceMethod = newItemInterfaceMethod;
00502         }
00503         if (item->_prevInterfaceMethod == itemInterfaceMethod)
00504         {
00505             item->_prevInterfaceMethod = newItemInterfaceMethod;
00506             item->_refInterfaceMethod = 0;
00507         }
00508         if (item->_nextInterfaceMethod == itemInterfaceMethod)
00509         {
00510             item->_nextInterfaceMethod = newItemInterfaceMethod;
00511             item->_refInterfaceMethod = 0;
00512         }
00513     }
00514 }
00515 
00516 //}}AFX DO NOT EDIT CODE ABOVE THIS LINE !!!
00517 
00518 //@START_USER3
00519 

This documentation is part of the "SOAP to CORBA bridge" project
Copyright © 2000 by Lifeline Networks bv.
All rights are reserved.