From Giona
/****************************************************************************
*Generic List Node for a Linked List.
* --------------------------------------------------------------------------
*Author: Rosario Marino
***************************************************************************/
#include "GenericListNode.h"
/*
* Constructor
*/
GenericListNode::GenericListNode()
{
Debug::debug("GenericListNode::GenericListNode()");
this->next = NULL;
this->elem = NULL;
this->notAnObject=false;
}
/*
* Destructor
*/
GenericListNode::~GenericListNode()
{
Debug::debug("GenericListNode::~GenericListNode()");
if(this->elem)
if(!notAnObject)
{
Debug::debug("GenericListNode::~GenericListNode() is deleting node element");
delete(this->elem);
}
}
/*
* This method must be called if the element of the node
* is not an object created by a new() statement (so that
* the delete statement will ignore it)
*/
void GenericListNode::setNotAnObject()
{
Debug::debug("void GenericListNode::setNotAnObject()");
this->notAnObject=true;
}
/*
* Sets the element of the node
*/
void GenericListNode::setElem(genericListElemT elem)
{
Debug::debug("void GenericListNode::setElem(genericListElemT elem)");
this->elem = elem;
}
/*
* Returns the element of the node
*/
genericListElemT GenericListNode::getElem()
{
Debug::debug("genericListElemT GenericListNode::getElem()");
return this->elem;
}
/*
* Sets next node in the list
*/
void GenericListNode::setNext(GenericListNode *next)
{
Debug::debug("void GenericListNode::setNext(GenericListNode *next)");
this->next = next;
}
/*
* Returns next node in the list
*/
GenericListNode* GenericListNode::getNext()
{
Debug::debug("GenericListNode* GenericListNode::getNext()");
return this->next;
}
BACK