home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osr1.exe / src / iciditr.cpp < prev    next >
Text File  |  1997-03-21  |  5KB  |  185 lines

  1. /* @(#)Z 1.2 os2/src/storage/iciditr.cpp, odstorage, od96os2, odos29712d 97/03/21 17:38:33 (96/08/23 01:43:09) */
  2. //====START_GENERATED_PROLOG======================================
  3. //
  4. //
  5. //   COMPONENT_NAME: odstorage
  6. //
  7. //   CLASSES: none
  8. //
  9. //   ORIGINS: 82,27
  10. //
  11. //
  12. //   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13. //   All Rights Reserved
  14. //   Licensed Materials - Property of IBM
  15. //   US Government Users Restricted Rights - Use, duplication or
  16. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17. //       
  18. //   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19. //   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20. //   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21. //   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22. //   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23. //   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24. //   OR PERFORMANCE OF THIS SOFTWARE.
  25. //
  26. //====END_GENERATED_PROLOG========================================
  27. //
  28.  
  29. #ifdef _PLATFORM_OS2_
  30.  
  31. #ifndef SOM_Module_iciditr_Source
  32. #define SOM_Module_iciditr_Source
  33. #endif
  34. #define IODConnIDIterator_Class_Source
  35.  
  36. #define VARIABLE_MACROS
  37.  
  38. #include <Except.h>
  39. #include <ODTypes.h>
  40.  
  41. #include <IODDefs.xh>
  42.  
  43. typedef struct CIDNode
  44. {
  45.     ODLinkConnectionID cid;
  46.     CIDNode*        next;
  47. } CIDNode;
  48.  
  49. #include "ICIDItr.xih"
  50.  
  51. /*
  52.  *=============================================================================
  53.  *=============================================================================
  54.  */
  55.  
  56. SOM_Scope void
  57. SOMLINK Add(IODConnIDIterator *somSelf,
  58.             Environment *ev,
  59.             ODLinkConnectionID cid)
  60. {
  61.     IODConnIDIteratorData *somThis = IODConnIDIteratorGetData(somSelf);
  62.     IODConnIDIteratorMethodDebug("IODConnIDIterator","Add");
  63.  
  64.     CIDNode* entry = new CIDNode;
  65.     THROW_IF_NULL(entry);
  66.  
  67.     entry->cid = cid;
  68.     if (_fCIDList != (CIDNode*)kODNULL)
  69.     {
  70.       entry->next = _fCIDList;
  71.     }
  72.     else
  73.     {
  74.       entry->next = (CIDNode*)kODNULL;
  75.     }
  76.     _fCIDList = entry;
  77. }
  78.  
  79. /*
  80.  *=============================================================================
  81.  *=============================================================================
  82.  */
  83.  
  84. SOM_Scope ODBoolean
  85. SOMLINK IsNotComplete(IODConnIDIterator *somSelf,
  86.                       Environment *ev)
  87. {
  88.     IODConnIDIteratorData *somThis = IODConnIDIteratorGetData(somSelf);
  89.     IODConnIDIteratorMethodDebug("IODConnIDIterator","IsNotComplete");
  90.  
  91.     if (_fCurrent != (CIDNode*)kODNULL)
  92.     {
  93.        return kODTrue;
  94.     }
  95.     else
  96.     {
  97.        return kODFalse;
  98.     }
  99. }
  100.  
  101. /*
  102.  *=============================================================================
  103.  *=============================================================================
  104.  */
  105.  
  106. SOM_Scope ODLinkConnectionID
  107. SOMLINK First(IODConnIDIterator *somSelf,
  108.               Environment *ev)
  109. {
  110.     IODConnIDIteratorData *somThis = IODConnIDIteratorGetData(somSelf);
  111.     IODConnIDIteratorMethodDebug("IODConnIDIterator","First");
  112.  
  113.     if ((_fCurrent = _fCIDList) != (CIDNode*)kODNULL)
  114.     {
  115.       return _fCurrent->cid;
  116.     }
  117.     else
  118.     {
  119.       return kODNULL;
  120.     }
  121. }
  122.  
  123. /*
  124.  *=============================================================================
  125.  *=============================================================================
  126.  */
  127.  
  128. SOM_Scope ODLinkConnectionID
  129. SOMLINK Next(IODConnIDIterator *somSelf,
  130.              Environment *ev)
  131. {
  132.     IODConnIDIteratorData *somThis = IODConnIDIteratorGetData(somSelf);
  133.     IODConnIDIteratorMethodDebug("IODConnIDIterator","Next");
  134.  
  135.     if (_fCurrent != (CIDNode*)kODNULL)
  136.     {
  137.       _fCurrent = _fCurrent->next;
  138.       if (_fCurrent != (CIDNode*)kODNULL)
  139.       {
  140.         return _fCurrent->cid;
  141.       }
  142.     }
  143.     return kODNULL;
  144. }
  145.  
  146. /*
  147.  *=============================================================================
  148.  *=============================================================================
  149.  */
  150.  
  151. SOM_Scope void
  152. SOMLINK somInit(IODConnIDIterator *somSelf)
  153. {
  154.     IODConnIDIteratorData *somThis = IODConnIDIteratorGetData(somSelf);
  155.     IODConnIDIteratorMethodDebug("IODConnIDIterator","somInit");
  156.  
  157.     IODConnIDIterator_parent_SOMObject_somInit(somSelf);
  158.  
  159.     _fCIDList = (CIDNode*)kODNULL;
  160.     _fCurrent = (CIDNode*)kODNULL;
  161. }
  162.  
  163. /*
  164.  *=============================================================================
  165.  *=============================================================================
  166.  */
  167.  
  168. SOM_Scope void
  169. SOMLINK somUninit(IODConnIDIterator *somSelf)
  170. {
  171.     IODConnIDIteratorData *somThis = IODConnIDIteratorGetData(somSelf);
  172.     IODConnIDIteratorMethodDebug("IODConnIDIterator","somUninit");
  173.  
  174.     while(_fCurrent = _fCIDList)
  175.     {
  176.       _fCIDList = _fCurrent->next;
  177.       _fCurrent->next = (CIDNode*)kODNULL;
  178.       delete _fCurrent;
  179.     }
  180.  
  181.     IODConnIDIterator_parent_SOMObject_somUninit(somSelf);
  182. }
  183. #endif
  184.  
  185.