GCGlib  0.04.228
GCG Graphics Engine
gcgDATASTRUCTURE Class Referenceabstract

Base abstract class for defining data structures in GCGlib. It indicates the minimum methods that all data structures must provide. Some abstract specializations of this class demand other interfaces to handle their elements under more specific or restricted conditions. More...

#include <gcg.h>

Inheritance diagram for gcgDATASTRUCTURE:
gcgCLASS gcgAVLTREE gcgDATAMAP gcgLISTSTRUCTURE gcgORDEREDSTRUCTURE gcgPATRICIAMAP gcgDOUBLELINKEDLIST gcgLINKEDLIST gcgHASHTABLE

Private Member Functions

virtual uintptr_t getCounter ()=0
 Gets the number of elements stored in the data structure. More...
 
virtual bool deleteAll ()=0
 Deletes and removes all entries from the data structure. All resources used by the data structure are also released. More...
 
virtual gcgITERATORgetIterator (int traversemode=0)=0
 Returns an iterator for traversing the elements of the data structure. The traversal order is defined by the parameter traversemode. The possible traverse modes are dependent on the data structure and its implementation. Always check the specific documentation of the specialized data structure to find the available traversing modes. The data structure must not be changed by insertions, removals or moves while the iterator is being used. You must delete the returned iterator after use. The iterator copies a minimal information from the data structure. Note that deleting an iterator does not affect the nodes. More...
 
virtual gcgITERATORdetach (int traversemode=0)=0
 Force the data structure to be empty. It has the same effect as removing all entries from the data structure but keeping their chaining (which will used by the returned iterator). The entries are NOT deleted. In order to retrieve the detached entries, a gcgITERATOR with default traversal mode is returned (traversemode = 0). This is useful to process the nodes freely and without the possible restrictions of the underlying data structure. Thus, the gcgITERATOR returned by gcDATASTRUCTURE::detach() MUST be used to delete all the entries or reinsert them in another data structure. The traversal order of the iterator is defined by the parameter traversemode. The possible traverse modes are dependent on the data structure and its implementation. Always check the specific documentation of the specialized data structure to find the available traversing modes. All resources currently used by the data structure are released (becomes empty) but it can be reused normally. You must delete the gcgITERATOR after its use. More...
 

Additional Inherited Members

- 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 data structures in GCGlib. It indicates the minimum methods that all data structures must provide. Some abstract specializations of this class demand other interfaces to handle their elements under more specific or restricted conditions.

Since
0.02.113

Member Function Documentation

◆ deleteAll()

virtual bool gcgDATASTRUCTURE::deleteAll ( )
privatepure virtual

Deletes and removes all entries from the data structure. All resources used by the data structure are also released.

Returns
Returns true if all entries were deleted and removed from the data structure. If it returns false, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
detach()

Implemented in gcgPATRICIAMAP, gcgHASHTABLE, gcgAVLTREE, gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ detach()

virtual gcgITERATOR* gcgDATASTRUCTURE::detach ( int  traversemode = 0)
privatepure virtual

Force the data structure to be empty. It has the same effect as removing all entries from the data structure but keeping their chaining (which will used by the returned iterator). The entries are NOT deleted. In order to retrieve the detached entries, a gcgITERATOR with default traversal mode is returned (traversemode = 0). This is useful to process the nodes freely and without the possible restrictions of the underlying data structure. Thus, the gcgITERATOR returned by gcDATASTRUCTURE::detach() MUST be used to delete all the entries or reinsert them in another data structure. The traversal order of the iterator is defined by the parameter traversemode. The possible traverse modes are dependent on the data structure and its implementation. Always check the specific documentation of the specialized data structure to find the available traversing modes. All resources currently used by the data structure are released (becomes empty) but it can be reused normally. You must delete the gcgITERATOR after its use.

Parameters
traversemodeSpecifies the order that the available elements in a data structure must be traversed by the returned iterator. The possible traverse modes are dependent on the specialized data structure and its implementation. Always check the specific documentation of the data structure to find the available traversing modes.
Returns
Returns an iterator for traversing the elements (in traversemode order) that were detached from the data structure. The data structure becomes empty and can be reused. You MUST delete the returned gcgITERATOR object after use. If it returns NULL, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
deleteAll()
getIterator()

Implemented in gcgPATRICIAMAP, gcgHASHTABLE, gcgAVLTREE, gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ getCounter()

virtual uintptr_t gcgDATASTRUCTURE::getCounter ( )
privatepure virtual

Gets the number of elements stored in the data structure.

Returns
Returns the number of elements stored in the data structure.

Implemented in gcgPATRICIAMAP, gcgHASHTABLE, gcgAVLTREE, gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.

◆ getIterator()

virtual gcgITERATOR* gcgDATASTRUCTURE::getIterator ( int  traversemode = 0)
privatepure virtual

Returns an iterator for traversing the elements of the data structure. The traversal order is defined by the parameter traversemode. The possible traverse modes are dependent on the data structure and its implementation. Always check the specific documentation of the specialized data structure to find the available traversing modes. The data structure must not be changed by insertions, removals or moves while the iterator is being used. You must delete the returned iterator after use. The iterator copies a minimal information from the data structure. Note that deleting an iterator does not affect the nodes.

Parameters
traversemodeSpecifies the order that the available elements in a data structure must be traversed. The possible traverse modes are dependent on the specialized data structure and its implementation. Always check the specific documentation of the data structure to find the available traversing modes.
Returns
Returns an iterator for traversing the elements of the data structure in the order defined by traversemode. The data structure must not be changed by insertions, removals or moves while the iterator is being used. You MUST delete the returned gcgITERATOR object after use. If it returns NULL, check GCG_REPORT_MESSAGE(gcgGetReport()) for knowing the problem.
See also
detach()

Implemented in gcgPATRICIAMAP, gcgHASHTABLE, gcgAVLTREE, gcgDOUBLELINKEDLIST, and gcgLINKEDLIST.


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