GCGlib  0.04.228
GCG Graphics Engine
gcgLISTSTRUCTURE Class Referenceabstract

Base abstract class for defining a sequential data structure in GCGlib for lists. It indicates the minimum methods that all list structures with elements that can be in any position must provide. Note that some data structures might provide other interfaces to handle their elements. This interface is different than gcgORDEREDSTRUCTURE where the elements are ordered and countable in the data structure. More...

#include <gcg.h>

Inheritance diagram for gcgLISTSTRUCTURE:
gcgDATASTRUCTURE gcgCLASS gcgDOUBLELINKEDLIST gcgLINKEDLIST

Public Member Functions

virtual bool insertFirst (gcgLINK *newnode)=0
 Inserts a new entry newnode in the first position of the data structure. More...
 
virtual bool insertLast (gcgLINK *newnode)=0
 Inserts a new entry newnode in the last position of the data structure. More...
 
virtual bool insertAfter (gcgLINK *newnode, gcgLINK *node)=0
 Inserts a new entry newnode in the data structure, after an existent entry pointed by node. More...
 
virtual bool insertBefore (gcgLINK *newnode, gcgLINK *node)=0
 Inserts a new entry newnode in the data structure, before an existent entry pointed by node. More...
 
virtual bool moveToFirst (gcgLINK *node)=0
 Move an entry node that is already in the data structure to its first position. The node will have a NULL previous link. More...
 
virtual bool moveToLast (gcgLINK *node)=0
 Move an entry node that is already in the data structure to its last position. The node will have a NULL next link. More...
 
virtual bool switchNodes (gcgLINK *node1, gcgLINK *node2)=0
 Switches the position of two existent elements of the data structure. The two nodes must be part of the data structure. More...
 
virtual bool remove (gcgLINK *node)=0
 Removes the entry from the data structure. The node must be part of the data structure. More...
 
- Public Member Functions inherited from gcgCLASS
void * operator new (size_t size)
 Defines a new operator to be used by instatiations of GCGlib classes instead the global one. More...
 
void * operator new (size_t size, const std::nothrow_t &) throw ()
 Defines a new operator to be used by instantiations of GCGlib classes instead the global one. Returns a NULL pointer instead of throwing an exception if an error occurs. More...
 
void * operator new[] (size_t size)
 Defines a new operator to be used by GCGlib array allocations instead the global one. More...
 
void * operator new[] (size_t size, const std::nothrow_t &) throw ()
 Defines a new operator to be used by vector allocations instead the global one. More...
 
void operator delete (void *p)
 Defines a delete operator to free instances of GCGlib classes instead the global one. It is designed to match the new operator. More...
 
void operator delete (void *p, const std::nothrow_t &) throw ()
 Defines a delete operator to free instances of GCGlib classes instead the global one. It is designed to match the new operator. More...
 
void operator delete[] (void *p)
 Defines a delete operator to free instances of arrays for GCGlib classes instead the global one. It is designed to match the new[] operator. More...
 
void operator delete[] (void *p, const std::nothrow_t &) throw ()
 Defines a delete operator to free instances of arrays for GCGlib classes instead the global one. It is designed to match the new[] operator. More...
 

Detailed Description

Base abstract class for defining a sequential data structure in GCGlib for lists. It indicates the minimum methods that all list structures with elements that can be in any position must provide. Note that some data structures might provide other interfaces to handle their elements. This interface is different than gcgORDEREDSTRUCTURE where the elements are ordered and countable in the data structure.

Since
0.02.113

Member Function Documentation

◆ insertAfter()

virtual bool gcgLISTSTRUCTURE::insertAfter ( gcgLINK newnode,
gcgLINK node 
)
pure virtual

Inserts a new entry newnode in the data structure, after an existent entry pointed by node.

Parameters
[in]newnodea pointer to a linkable instance (gcgLINK) to be inserted after node. This pointer is deleted by the destructor or a deleteAll() call. A NULL value generates an error.
[in]nodea pointer to an entry that is already in the data structure. A NULL value has the same effect as insertFirst(newnode). After the insertion, the newnode will succeed the node in the data structure: node->next = newnode and newnode->previous = node.
Returns
returns true if the data is successfully inserted after node. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
insertLast()
insertBefore()
remove()

Implemented in gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ insertBefore()

virtual bool gcgLISTSTRUCTURE::insertBefore ( gcgLINK newnode,
gcgLINK node 
)
pure virtual

Inserts a new entry newnode in the data structure, before an existent entry pointed by node.

Parameters
[in]newnodea pointer to a linkable instance (gcgLINK) to be inserted after node. This pointer is deleted by the destructor or a deleteAll() call. A NULL value generates an error.
[in]nodea pointer to an entry that is already in the data structure. A NULL value has the same effect as insertLast(newnode). After the insertion, the node will succeed the newnode in the data structure: newnode->next = node and node->previous = newnode.
Returns
returns true if the data is successfully inserted after node. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
insertFirst()
insertAfter()
remove()

Implemented in gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ insertFirst()

virtual bool gcgLISTSTRUCTURE::insertFirst ( gcgLINK newnode)
pure virtual

Inserts a new entry newnode in the first position of the data structure.

Parameters
[in]newnodea pointer to a linkable node (gcgLINK) to be inserted in the data structure. It is generally an object of a specialization of gcgLINK that carries the node information.
Returns
true if newnode is correctly inserted. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
remove()

Implemented in gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ insertLast()

virtual bool gcgLISTSTRUCTURE::insertLast ( gcgLINK newnode)
pure virtual

Inserts a new entry newnode in the last position of the data structure.

Parameters
[in]newnodea pointer to a linkable node (gcgLINK) to be inserted in the data structure. It is generally an object of a specialization of gcgLINK that carries the node information.
Returns
true if newnode is correctly inserted. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
remove()

Implemented in gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ moveToFirst()

virtual bool gcgLISTSTRUCTURE::moveToFirst ( gcgLINK node)
pure virtual

Move an entry node that is already in the data structure to its first position. The node will have a NULL previous link.

Parameters
[in]nodea pointer to a linkable instance (gcgLINK) that is already in the data structure. A NULL value generates an error.
Returns
returns true if the data is successfully moved to the beginning of the data structure. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
insertFirst()
insertAfter()
insertBefore()
moveToLast()
remove()

Implemented in gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ moveToLast()

virtual bool gcgLISTSTRUCTURE::moveToLast ( gcgLINK node)
pure virtual

Move an entry node that is already in the data structure to its last position. The node will have a NULL next link.

Parameters
[in]nodea pointer to a linkable instance (gcgLINK) that is already in the data structure. A NULL value generates an error.
Returns
returns true if the data is successfully moved to the end of the data structure. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
insertFirst()
insertAfter()
insertBefore()
moveToFirst()
remove()

Implemented in gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ remove()

virtual bool gcgLISTSTRUCTURE::remove ( gcgLINK node)
pure virtual

Removes the entry from the data structure. The node must be part of the data structure.

Parameters
[in]nodea pointer to a linkable node (gcgLINK) that carries the information to be removed from the data structure. It is generally an object of a specialization of gcgLINK that carries the information to be removed. The removed node is NOT deleted.
Returns
true if node is correctly removed. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
insert()

Implemented in gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ switchNodes()

virtual bool gcgLISTSTRUCTURE::switchNodes ( gcgLINK node1,
gcgLINK node2 
)
pure virtual

Switches the position of two existent elements of the data structure. The two nodes must be part of the data structure.

Parameters
[in]node1a pointer to a linkable node (gcgLINK) that carries the information to be switched with the position of node2. If NULL, an error occurs.
[in]node2a pointer to a linkable node (gcgLINK) that carries the information to be switched with the position of node1. If NULL, an error occurs.
Returns
true if the nodes are correctly switched. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
insert()

Implemented in gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.


The documentation for this class was generated from the following file: