Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

NODE_LINK_LIST Class Reference

#include <nodelist.hh>

Collaboration diagram for NODE_LINK_LIST:

Collaboration graph
[legend]

Public Methods

 NODE_LINK_LIST ()
 ~NODE_LINK_LIST ()
int add_entry (NODE_LINK *node_link_ptr)
int delete_entry (NODE_LINK *node_link_ptr)
NODE_LINKfirst_node ()
NODE_LINKnext_node ()

Private Attributes

NODE_LINK_LIST_ENTRYfirst
NODE_LINK_LIST_ENTRYcurrent
int deleting_list

Constructor & Destructor Documentation

NODE_LINK_LIST::NODE_LINK_LIST  
 

Definition at line 5 of file nodelist.cc.

00006 {
00007   first = NULL;
00008   current = NULL;
00009   deleting_list = 0;
00010 }

NODE_LINK_LIST::~NODE_LINK_LIST  
 

Definition at line 12 of file nodelist.cc.

00013 {
00014   NODE_LINK_LIST_ENTRY *next_entry;
00015   if (NULL != first)
00016     {
00017       current = first;
00018       while (NULL != current)
00019         {
00020           next_entry = current->next;
00021           if (NULL != current->node_link)
00022             {
00023               delete current->node_link;
00024               current->node_link = NULL;
00025             }
00026           delete current;
00027           current = next_entry;
00028         }
00029     }
00030 }


Member Function Documentation

int NODE_LINK_LIST::add_entry NODE_LINK   node_link_ptr
 

Definition at line 33 of file nodelist.cc.

00034 {
00035   current = new NODE_LINK_LIST_ENTRY;
00036   if (NULL == current)
00037     {
00038       return (-1);
00039     }
00040   current->next = first;
00041   current->node_link = node_link_ptr;
00042   first = current;
00043   return (0);
00044 }

int NODE_LINK_LIST::delete_entry NODE_LINK   node_link_ptr
 

Definition at line 47 of file nodelist.cc.

00048 {
00049   NODE_LINK_LIST_ENTRY *temp;
00050   NODE_LINK_LIST_ENTRY *last;
00051 
00052   if (NULL != first)
00053     {
00054       if (first->node_link == node_link_ptr)
00055         {
00056           temp = first->next;
00057           if (current == first)
00058             {
00059               current = temp;
00060             }
00061           delete first;
00062           first = temp;
00063           return (0);
00064         }
00065       temp = first->next;
00066       last = first;
00067       while (NULL != temp)
00068         {
00069           if (temp->node_link == node_link_ptr)
00070             {
00071               last->next = temp->next;
00072               if (current == temp)
00073                 {
00074                   current = temp->next;
00075                 }
00076               delete temp;
00077               return (0);
00078             }
00079           else
00080             {
00081               last = temp;
00082               temp = temp->next;
00083             }
00084         }
00085       return (-1);
00086     }
00087   return (-1);
00088 }

NODE_LINK * NODE_LINK_LIST::first_node  
 

Definition at line 91 of file nodelist.cc.

00092 {
00093   if (NULL == first)
00094     {
00095       return (NULL);
00096     }
00097   current = first;
00098   return (first->node_link);
00099 }

NODE_LINK * NODE_LINK_LIST::next_node  
 

Definition at line 102 of file nodelist.cc.

00103 {
00104   if (NULL == current)
00105     {
00106       return NULL;
00107     }
00108 
00109   current = current->next;
00110   if (NULL == current)
00111     {
00112       return NULL;
00113     }
00114 
00115   return (current->node_link);
00116 }


Field Documentation

NODE_LINK_LIST_ENTRY* NODE_LINK_LIST::first [private]
 

Definition at line 17 of file nodelist.hh.

NODE_LINK_LIST_ENTRY* NODE_LINK_LIST::current [private]
 

Definition at line 18 of file nodelist.hh.

int NODE_LINK_LIST::deleting_list [private]
 

Definition at line 19 of file nodelist.hh.


The documentation for this class was generated from the following files:
Generated on Sun Dec 2 15:59:00 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001