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 (const void* pdata);
00049 OSRTDListNodeBaseClass (void* pdata, OSBOOL ownMemory=FALSE);
00050 virtual ~OSRTDListNodeBaseClass() {}
00051
00059 inline void setOwnMemory (OSBOOL bvalue=TRUE) { mbOwnMemory = bvalue; }
00060 } ;
00061
00066 class EXTERNRTX OSRTDListNodeClass : public OSRTDListNodeBaseClass {
00067 public:
00068 OSRTDListNodeClass (const void* pdata) :
00069 OSRTDListNodeBaseClass (pdata) {}
00070 OSRTDListNodeClass (void* pdata, OSBOOL ownMemory=FALSE) :
00071 OSRTDListNodeBaseClass (pdata, ownMemory) {}
00072 virtual ~OSRTDListNodeClass();
00073
00079 inline const void* getData () { return data; }
00080
00086 inline OSRTDListNodeClass* getNext () {
00087 return (OSRTDListNodeClass*)next;
00088 }
00089
00095 inline OSRTDListNodeClass* getPrev () {
00096 return (OSRTDListNodeClass*)prev;
00097 }
00098 } ;
00099
00104 class EXTERNRTX OSRTObjListNodeClass : public OSRTDListNodeBaseClass {
00105 public:
00106 OSRTObjListNodeClass (const OSBaseType* pdata);
00107 OSRTObjListNodeClass (OSBaseType* pdata, OSBOOL ownMemory=FALSE);
00108 virtual ~OSRTObjListNodeClass();
00109
00115 inline OSBaseType* getData () { return (OSBaseType*)data; }
00116
00122 inline OSRTObjListNodeClass* getNext () {
00123 return (OSRTObjListNodeClass*)next;
00124 }
00125
00131 inline OSRTObjListNodeClass* getPrev () {
00132 return (OSRTObjListNodeClass*)prev;
00133 }
00134 } ;
00135
00140 class EXTERNRTX OSRTDListBaseClass : protected OSRTDList, public OSBaseType {
00141 protected:
00142 inline operator OSRTDList* () { return this; }
00143 inline operator const OSRTDList* () const { return this; }
00144 public:
00148 OSRTDListBaseClass() { count = 0; head = 0; tail = 0; }
00149
00154 virtual ~OSRTDListBaseClass();
00155
00161 OSUINT32 getCount () { return count; }
00162
00169 void remove (int index);
00170
00171 } ;
00172
00177 class EXTERNRTX OSRTDListClass : public OSRTDListBaseClass {
00178 public:
00179
00186 void append (const void* pdata);
00187
00195 void append (void* pdata, OSBOOL ownMemory=FALSE);
00196
00202 inline OSRTDListNodeClass* getHead () {
00203 return (OSRTDListNodeClass*)head;
00204 }
00205
00213 inline const void* getItem (int idx) {
00214 OSRTDListNodeClass* pnode =
00215 (OSRTDListNodeClass*) rtxDListFindByIndex (*this, idx);
00216 return (0 != pnode) ? pnode->data : 0;
00217 }
00218
00224 inline OSRTDListNodeClass* getTail () {
00225 return (OSRTDListNodeClass*)tail;
00226 }
00227
00236 void insert (int index, const void* pdata);
00237
00247 void insert (int index, void* pdata, OSBOOL ownMemory=FALSE);
00248
00249 } ;
00250
00255 class EXTERNRTX OSRTObjListClass : public OSRTDListBaseClass {
00256 public:
00257
00264 void append (const OSBaseType* pdata);
00265
00273 void append (OSBaseType* pdata, OSBOOL ownMemory=FALSE);
00274
00280 inline OSRTObjListNodeClass* getHead () {
00281 return (OSRTObjListNodeClass*)head;
00282 }
00283
00291 inline const OSBaseType* getItem (int idx) {
00292 OSRTDListNodeClass* pnode =
00293 (OSRTDListNodeClass*) rtxDListFindByIndex (*this, idx);
00294 return (0 != pnode) ? (OSBaseType*)pnode->data : 0;
00295 }
00296
00302 inline OSRTDListNodeClass* getTail () {
00303 return (OSRTDListNodeClass*)tail;
00304 }
00305
00314 void insert (int index, const OSBaseType* pdata);
00315
00325 void insert (int index, OSBaseType* pdata, OSBOOL ownMemory=FALSE);
00326
00327 } ;
00328 #endif