#ifndef _apl_containers_nodeapi_h_ #define _apl_containers_nodeapi_h_ /*---------------------------------------------------------------------------- ** SUMMARY: Intrusive Linkable node (ILNODE) ** ** DESCRIPTION: ** This file provides the definitions for creating a data structures that ** can be contained in a linked lists, containers, trees, etc. The item ** be contained is RESPONSIBLE for providing the memory for the link ** pointer(s). CAUTION: Since the is only one set of link(s) per structure, ** the structure can only be in at most ONE list at any given time. ** ** USAGE: ** ------ ** To make a data structure 'listable', the applicaiton/developers needs ** to modify the data structure as follows: ** Original structure: ** typedef struct MyStructure_tag ** { ** int _mydata; ** void* _myPtr; ** .... ** } MyStructure; ** ** Linkable structure: ** typedef struct MyStructure_tag ** { ** APL_DLINKABLE_NODE; // Link(s) for container implementation ** int _mydata; ** void* _myPtr; ** .... ** } MyStructure; ** ** NOTES: ** o Order is VERY important for where the 'link' field is placed. The ** link field MUST be the first member(s) of the data structure. ** o Include only ONE 'link' field symbol. ** o A structure that uses the symbol APL_DLINKABLE_NODE can be ** contained in a single-linked list or double-linked list. ** ** ** ** CONFIGURATION ** ------------- ** COMPILE: none. ** ** APPLICATION: none. ** ** PLATFORM: none. ** ----------------------------------------------------------------------------*/ #ifdef __cplusplus extern "C" { #endif /*-------------- TYPES -----------------------------------------------------*/ /** Single-Link field */ #define APL_SLINKABLE_NODE void* __aplNextPtr_ /** Double-Link fields */ #define APL_DLINKABLE_NODE APL_SLINKABLE_NODE;void* __aplPrevPtr_ /*-------------- PRIVATE ---------------------------------------------------*/ /** Internal type for access a single-linked item */ typedef struct AplSListImpl_tag { void* _next; } AplSListImpl_t; /** Internal type for access a double-linked item */ typedef struct AplDListImpl_tag { void* _next; void* _prev; } AplDListImpl_t; #ifdef __cplusplus } #endif /*--------------------------------------------------------------------------*/ #endif /* end _apl_containers_nodeapi_h_ */