rtxCppDList.h
Go to the documentation of this file.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/OSRTBaseType.h"
00032 #include "rtxsrc/rtxDList.h"
00033
00038 class EXTRTCLASS OSRTDListNodeBaseClass : protected OSRTDListNode {
00039 friend class OSRTDListBaseClass;
00040 friend class OSRTDListClass;
00041 friend class OSRTObjListClass;
00042 protected:
00043 inline operator OSRTDListNode* () { return this; }
00044 inline operator const OSRTDListNode* () const { return this; }
00045
00046 OSRTDListNodeBaseClass ();
00047 public:
00048 OSRTDListNodeBaseClass (void* pdata);
00049 virtual ~OSRTDListNodeBaseClass() {}
00050 } ;
00051
00056 class EXTRTCLASS OSRTDListNodeClass : public OSRTDListNodeBaseClass {
00057 public:
00058 inline OSRTDListNodeClass (void* pdata) :
00059 OSRTDListNodeBaseClass (pdata) {}
00060 virtual ~OSRTDListNodeClass();
00061
00067 inline void* getData () { return data; }
00068
00074 inline const void* getData () const { return data; }
00075
00081 inline OSRTDListNodeClass* getNext () {
00082 return (OSRTDListNodeClass*)next;
00083 }
00084
00090 inline const OSRTDListNodeClass* getNext () const {
00091 return (OSRTDListNodeClass*)next;
00092 }
00093
00099 inline OSRTDListNodeClass* getPrev () {
00100 return (OSRTDListNodeClass*)prev;
00101 }
00102
00108 inline const OSRTDListNodeClass* getPrev () const {
00109 return (OSRTDListNodeClass*)prev;
00110 }
00111 } ;
00112
00117 class EXTRTCLASS OSRTObjListNodeClass : public OSRTDListNodeBaseClass {
00118 public:
00119 OSRTObjListNodeClass (OSRTBaseType* pdata);
00120 OSRTObjListNodeClass (const OSRTObjListNodeClass&);
00121 virtual ~OSRTObjListNodeClass();
00122
00128 inline OSRTBaseType* getData () { return (OSRTBaseType*)data; }
00129
00135 inline const OSRTBaseType* getData () const { return (OSRTBaseType*)data; }
00136
00142 inline OSRTObjListNodeClass* getNext () {
00143 return (OSRTObjListNodeClass*)next;
00144 }
00145
00151 inline const OSRTObjListNodeClass* getNext () const {
00152 return (OSRTObjListNodeClass*)next;
00153 }
00154
00160 inline OSRTObjListNodeClass* getPrev () {
00161 return (OSRTObjListNodeClass*)prev;
00162 }
00163
00169 inline const OSRTObjListNodeClass* getPrev () const {
00170 return (OSRTObjListNodeClass*)prev;
00171 }
00172 } ;
00173
00180 class EXTRTCLASS OSRTDListBaseClass : public OSRTDList, public OSRTBaseType {
00181 protected:
00182 inline OSRTDListBaseClass(const OSRTDListBaseClass& o):OSRTBaseType (o) {}
00183
00184 public:
00185 inline operator OSRTDList* () { return this; }
00186 inline operator const OSRTDList* () const { return this; }
00187
00191 inline OSRTDListBaseClass() { count = 0; head = 0; tail = 0; }
00192
00196 virtual ~OSRTDListBaseClass();
00197
00203 inline OSUINT32 getCount () const { return count; }
00204
00212 inline OSRTDList* getList () { return this; }
00213
00221 inline const OSRTDList* getList () const { return this; }
00222
00229 void remove (int index);
00230
00231 void release ();
00232 } ;
00233
00241 class EXTRTCLASS OSRTDListClass : public OSRTDListBaseClass {
00242 public:
00246 OSRTDListClass() {}
00247
00251 OSRTDListClass (const OSRTDListClass& o) : OSRTDListBaseClass(o) {}
00252
00259 void append (void* pdata);
00260
00269 void appendCopy (void* pdata, size_t nbytes);
00270
00276 inline OSRTDListNodeClass* getHead () {
00277 return (OSRTDListNodeClass*)head;
00278 }
00279
00285 inline const OSRTDListNodeClass* getHead () const {
00286 return (OSRTDListNodeClass*)head;
00287 }
00288
00296 inline const void* getItem (int idx) const {
00297 OSRTDListNodeClass* pnode =
00298 (OSRTDListNodeClass*) rtxDListFindByIndex (*this, idx);
00299 return (0 != pnode) ? pnode->getData () : 0;
00300 }
00301
00307 inline OSRTDListNodeClass* getTail () {
00308 return (OSRTDListNodeClass*)tail;
00309 }
00310
00316 inline const OSRTDListNodeClass* getTail () const {
00317 return (OSRTDListNodeClass*)tail;
00318 }
00319
00328 void insert (int index, void* pdata);
00329
00330 } ;
00331
00340 class EXTRTCLASS OSRTObjListClass : public OSRTDListBaseClass {
00341 protected:
00342 void doCopy (const OSRTObjListClass&);
00343 public:
00344
00348 inline OSRTObjListClass() { }
00349
00350 OSRTObjListClass(const OSRTObjListClass&);
00351
00358 void append (OSRTBaseType* pdata);
00359
00367 void appendCopy (const OSRTBaseType* pdata);
00368
00369 OSRTBaseType* clone () const { return new OSRTObjListClass (*this); }
00370
00376 inline OSRTObjListNodeClass* getHead () {
00377 return (OSRTObjListNodeClass*)head;
00378 }
00379
00385 inline const OSRTObjListNodeClass* getHead () const {
00386 return (OSRTObjListNodeClass*)head;
00387 }
00388
00396 inline const OSRTBaseType* getItem (int idx) const {
00397 OSRTObjListNodeClass* pnode =
00398 (OSRTObjListNodeClass*) rtxDListFindByIndex (*this, idx);
00399 return (0 != pnode) ? (OSRTBaseType*)pnode->getData () : 0;
00400 }
00401
00407 inline OSRTObjListNodeClass* getTail () {
00408 return (OSRTObjListNodeClass*)tail;
00409 }
00410
00416 inline const OSRTObjListNodeClass* getTail () const {
00417 return (OSRTObjListNodeClass*)tail;
00418 }
00419
00428 void insert (int index, OSRTBaseType* pdata);
00429
00436 OSRTObjListClass& operator= (const OSRTObjListClass&);
00437 } ;
00438 #endif