ModuleList Class Reference

Used by the kernel to hold information on all the modules it currently knows about. It has an overloaded Add function which will only add modules if their ID has not already been used by another module. More...

#include <modlist.h>

Inheritance diagram for ModuleList:

List CCObject SimpleCCObject List of all members.

Public Member Functions

 ~ModuleList ()
 Destroys a module list, destroying all modules in the list too.
ModuleListItemAdd (Module *, OILModule *)
 Safe addition of modules to the kernel's list of known modules. A module will only be added if its ID has not already been used.

Private Member Functions

 CC_DECLARE_MEMDUMP (ModuleList)

Detailed Description

Used by the kernel to hold information on all the modules it currently knows about. It has an overloaded Add function which will only add modules if their ID has not already been used by another module.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
See also:
ModuleListItem

Definition at line 158 of file modlist.h.


Constructor & Destructor Documentation

ModuleList::~ModuleList  ) 
 

Destroys a module list, destroying all modules in the list too.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/7/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 184 of file modlist.cpp.

00185 {
00186     // Call destructors on all objects in the list
00187     
00188     ModuleListItem *Item = (ModuleListItem *) RemoveHead();
00189     
00190     while (Item != NULL)
00191     {
00192         // Delete the list item
00193         delete Item;
00194         
00195         // Try the next item
00196         Item = (ModuleListItem *) RemoveHead();
00197     }
00198 
00199 }


Member Function Documentation

ModuleListItem * ModuleList::Add Module pNewModule,
OILModule pNewOILModule
 

Safe addition of modules to the kernel's list of known modules. A module will only be added if its ID has not already been used.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/6/93
Parameters:
pNewModule - pointer to the module to add into the list. [INPUTS] pNewOILModule - pointer to the OILModule object to associate with this module.
- [OUTPUTS]
Returns:
Pointer to the new item in the list if the module was successfully added, NULL otherwise.

Errors: -

See also:
ModuleListItem

Definition at line 220 of file modlist.cpp.

00221 {
00222     // Construct a tentative list item.
00223     ModuleListItem *NewItem = new ModuleListItem(pNewModule, pNewOILModule);
00224     if (NewItem == NULL)
00225         return NULL;
00226         
00227     // Fill in the OILModule pointer with the pointer provided by the caller.
00228     NewItem->m_pOILModule = pNewOILModule;
00229     
00230     // Interrogate module about itself.
00231     if( NewItem->m_ModInfo.ID == MODULEID_INVALID )
00232     {
00233         // Invalid ID - discard new list item and abort.
00234         NewItem->m_pModule = NULL;                          // dont delete the module
00235         delete NewItem;
00236         return NULL;
00237     }
00238     
00239     
00240     // Search list to make sure this ID is not already in use.
00241     ModuleListItem *Item = (ModuleListItem *) GetHead();
00242     
00243     while (Item != NULL)
00244     {
00245         if( Item->m_ModInfo.ID == NewItem->m_ModInfo.ID )
00246         {
00247             // Found ID already in use - discard new list item and abort.
00248             NewItem->m_pModule = NULL;                      // dont delete the module
00249             delete NewItem;
00250             return NULL;
00251         }
00252         
00253         // Try the next node in the list.
00254         Item = (ModuleListItem *) GetNext(Item);
00255     }
00256     
00257     // The ID is not already in use so add the module to the list.
00258     AddTail(NewItem);
00259     return NewItem;
00260 }

ModuleList::CC_DECLARE_MEMDUMP ModuleList   )  [private]
 


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:56:16 2007 for Camelot by  doxygen 1.4.4