00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00027 #ifndef _RTXCPPDLIST_H_
00028 #define _RTXCPPDLIST_H_
00029
00030 #include "rtxsrc/rtxCommon.h"
00031 #include "rtxsrc/rtxCppBaseType.h"
00032 #include "rtxsrc/rtxDList.h"
00033
00038 class EXTERNRTX OSRTDListNodeBaseClass : protected OSRTDListNode {
00039 friend class OSRTDListBaseClass;
00040 friend class OSRTDListClass;
00041 friend class OSRTObjListClass;
00042 protected:
00043 OSBOOL mbOwnMemory;
00044 protected:
00045 inline operator OSRTDListNode* () { return this; }
00046 inline operator const OSRTDListNode* () const { return this; }
00047 public:
00048 OSRTDListNodeBaseClass (void* pdata, OSBOOL ownMemory=FALSE);
00049 virtual ~OSRTDListNodeBaseClass() {}
00050
00058 inline void setOwnMemory (OSBOOL bvalue=TRUE) { mbOwnMemory = bvalue; }
00059 } ;
00060
00065 class EXTERNRTX OSRTDListNodeClass : public OSRTDListNodeBaseClass {
00066 public:
00067 inline OSRTDListNodeClass (void* pdata) :
00068 OSRTDListNodeBaseClass (pdata) {}
00069 inline OSRTDListNodeClass (void* pdata, OSBOOL ownMemory) :
00070 OSRTDListNodeBaseClass (pdata, ownMemory) {}
00071 virtual ~OSRTDListNodeClass();
00072
00078 inline void* getData () { return data; }
00079
00085 inline const void* getData () const { return data; }
00086
00092 inline OSRTDListNodeClass* getNext () {
00093 return (OSRTDListNodeClass*)next;
00094 }
00095
00101 inline const OSRTDListNodeClass* getNext () const {
00102 return (OSRTDListNodeClass*)next;
00103 }
00104
00110 inline OSRTDListNodeClass* getPrev () {
00111 return (OSRTDListNodeClass*)prev;
00112 }
00113
00119 inline const OSRTDListNodeClass* getPrev () const {
00120 return (OSRTDListNodeClass*)prev;
00121 }
00122 } ;
00123
00128 class EXTERNRTX OSRTObjListNodeClass : public OSRTDListNodeBaseClass {
00129 public:
00130 OSRTObjListNodeClass (OSBaseType* pdata);
00131 OSRTObjListNodeClass (OSBaseType* pdata, OSBOOL ownMemory);
00132 virtual ~OSRTObjListNodeClass();
00133
00139 inline OSBaseType* getData () { return (OSBaseType*)data; }
00140
00146 inline const OSBaseType* getData () const { return (OSBaseType*)data; }
00147
00153 inline OSRTObjListNodeClass* getNext () {
00154 return (OSRTObjListNodeClass*)next;
00155 }
00156
00162 inline const OSRTObjListNodeClass* getNext () const {
00163 return (OSRTObjListNodeClass*)next;
00164 }
00165
00171 inline OSRTObjListNodeClass* getPrev () {
00172 return (OSRTObjListNodeClass*)prev;
00173 }
00174
00180 inline const OSRTObjListNodeClass* getPrev () const {
00181 return (OSRTObjListNodeClass*)prev;
00182 }
00183 } ;
00184
00191 class EXTERNRTX OSRTDListBaseClass : protected OSRTDList, public OSBaseType {
00192 protected:
00193 inline operator OSRTDList* () { return this; }
00194 inline operator const OSRTDList* () const { return this; }
00195
00196 inline OSRTDListBaseClass(const OSRTDListBaseClass& o):OSBaseType (o) {}
00197 public:
00201 inline OSRTDListBaseClass() { count = 0; head = 0; tail = 0; }
00202
00207 virtual ~OSRTDListBaseClass();
00208
00214 inline OSUINT32 getCount () const { return count; }
00215
00223 inline OSRTDList* getList () { return this; }
00224
00232 inline const OSRTDList* getList () const { return this; }
00233
00240 void remove (int index);
00241
00242 } ;
00243
00251 class EXTERNRTX OSRTDListClass : public OSRTDListBaseClass {
00252 protected:
00253 inline OSRTDListClass(const OSRTDListClass& o):OSRTDListBaseClass(o) {}
00254 public:
00255
00259 inline OSRTDListClass() { }
00260
00268 void append (void* pdata, OSBOOL ownMemory=FALSE);
00269
00275 inline OSRTDListNodeClass* getHead () {
00276 return (OSRTDListNodeClass*)head;
00277 }
00278
00284 inline const OSRTDListNodeClass* getHead () const {
00285 return (OSRTDListNodeClass*)head;
00286 }
00287
00295 inline const void* getItem (int idx) const {
00296 OSRTDListNodeClass* pnode =
00297 (OSRTDListNodeClass*) rtxDListFindByIndex (*this, idx);
00298 return (0 != pnode) ? pnode->getData () : 0;
00299 }
00300
00306 inline OSRTDListNodeClass* getTail () {
00307 return (OSRTDListNodeClass*)tail;
00308 }
00309
00315 inline const OSRTDListNodeClass* getTail () const {
00316 return (OSRTDListNodeClass*)tail;
00317 }
00318
00328 void insert (int index, void* pdata, OSBOOL ownMemory=FALSE);
00329
00330 } ;
00331
00340 class EXTERNRTX OSRTObjListClass : public OSRTDListBaseClass {
00341 protected:
00342 inline OSRTObjListClass(const OSRTObjListClass& o):
00343 OSRTDListBaseClass(o) {}
00344 public:
00345
00349 inline OSRTObjListClass() { }
00350
00358 void append (OSBaseType* pdata, OSBOOL ownMemory=FALSE);
00359
00365 inline OSRTObjListNodeClass* getHead () {
00366 return (OSRTObjListNodeClass*)head;
00367 }
00368
00374 inline const OSRTObjListNodeClass* getHead () const {
00375 return (OSRTObjListNodeClass*)head;
00376 }
00377
00385 inline const OSBaseType* getItem (int idx) const {
00386 OSRTObjListNodeClass* pnode =
00387 (OSRTObjListNodeClass*) rtxDListFindByIndex (*this, idx);
00388 return (0 != pnode) ? (OSBaseType*)pnode->getData () : 0;
00389 }
00390
00396 inline OSRTObjListNodeClass* getTail () {
00397 return (OSRTObjListNodeClass*)tail;
00398 }
00399
00405 inline const OSRTObjListNodeClass* getTail () const {
00406 return (OSRTObjListNodeClass*)tail;
00407 }
00408
00418 void insert (int index, OSBaseType* pdata, OSBOOL ownMemory=FALSE);
00419
00420 } ;
00421 #endif