ToolList Class Reference

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

#include <toollist.h>

Inheritance diagram for ToolList:

List CCObject SimpleCCObject List of all members.

Public Member Functions

 ~ToolList ()
 Destroys a ToolList object. Deletes the Tool and OILTool objects contained in the list items, and deletes the list items themselves.
ToolListItemAdd (Tool *, UINT32 ParentID)
 Safe addition of tools to the kernel's list of known tools. A tool will only be added if its ID has not already been used.

Private Member Functions

 CC_DECLARE_MEMDUMP (ToolList)

Detailed Description

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

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

Definition at line 153 of file toollist.h.


Constructor & Destructor Documentation

ToolList::~ToolList  ) 
 

Destroys a ToolList object. Deletes the Tool and OILTool objects contained in the list items, and deletes the list items themselves.

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

Errors: -

See also:
~ToolListItem

Definition at line 184 of file toollist.cpp.

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


Member Function Documentation

ToolListItem * ToolList::Add Tool NewTool,
UINT32  ParentID
 

Safe addition of tools to the kernel's list of known tools. A tool 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:
NewTool - pointer to the tool to add into the list. [INPUTS] ParentID - Module ID of the module that provides this tool.
- [OUTPUTS]
Returns:
Pointer to the new item in the list if the tool was successfully added, NULL otherwise.

Errors: -

See also:
-

Definition at line 219 of file toollist.cpp.

00220 {
00221     // Construct a tentative list item
00222     ToolListItem *NewItem = new ToolListItem(NewTool, ParentID);
00223     if (NewItem == NULL)
00224         goto AbnormalExit;
00225     
00226     // Create a new OIL tool for this node
00227 //  NewItem->m_pOILTool = new OILTool(ParentID);
00228 //  if (NewItem->m_pOILTool == NULL)
00229 //      goto AbnormalExit;
00230     
00231     // Interrogate tool about itself.
00232 /*  if (NewItem->ToolInfo.ID == TOOLID_INVALID)
00233         goto AbnormalExit;
00234     
00235     
00236     // Search list to make sure this ID is not already in use.
00237     // (If I use one line initialisation the compiler complains that the gotos avoid it.)
00238     ToolListItem *Item;
00239     Item = (ToolListItem *) GetHead();
00240     
00241     while (Item != NULL)
00242     {
00243         if (Item->ToolInfo.ID == NewItem->ToolInfo.ID)
00244             // Found ID already in use - discard new list item and abort.
00245             goto AbnormalExit;
00246         
00247         // Try the next node in the list.
00248         Item = (ToolListItem *) GetNext(Item);
00249     }
00250 */  
00251     // The ID is not already in use so add the tool to the list.
00252     AddTail(NewItem);
00253     return NewItem;
00254     
00255     // Abnormal exit - clean up and return a NULL pointer to indicate it didn't work.
00256 AbnormalExit:
00257     // Set Tool pointer to NULL to avoid it being deleted by the ToolListItem's destructor, because
00258     // the caller is not expecting this tool to be deleted from under its feet.
00259     NewItem->m_pTool = NULL;
00260 
00261     // Delete the ToolListItem
00262     delete NewItem;
00263 
00264     return NULL;
00265 }

ToolList::CC_DECLARE_MEMDUMP ToolList   )  [private]
 


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:01:59 2007 for Camelot by  doxygen 1.4.4