Commit 9ff453f8 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Added destructor.

parent 36489010
......@@ -33,18 +33,20 @@ class vlCollectionElement
class vlCollection : public vlObject
{
public:
int NumberOfItems;
public:
vlCollection();
virtual ~vlCollection();
void PrintSelf(ostream& os, vlIndent indent);
char *GetClassName() {return "vlCollection";};
void AddItem(vlObject *);
void RemoveItem(vlObject *);
int IsItemPresent(vlObject *);
int GetNumberOfItems();
vlObject *GetItem(int num);
void PrintSelf(ostream& os, vlIndent indent);
char *GetClassName() {return "vlCollection";};
private:
protected:
int NumberOfItems;
vlCollectionElement *Top;
vlCollectionElement *Bottom;
......
......@@ -27,6 +27,16 @@ vlCollection::vlCollection()
this->Bottom = NULL;
}
vlCollection::~vlCollection()
{
vlCollectionElement *p;
for ( p=this->Top; p != NULL; p = p->Next )
{
delete p;
}
}
// Description:
// Add an object to the list. Does not prevent duplicate entries.
void vlCollection::AddItem(vlObject *a)
......@@ -157,11 +167,3 @@ void vlCollection::PrintSelf(ostream& os, vlIndent indent)
os << indent << "Number Of Items: " << this->NumberOfItems << "\n";
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment