rtxCppDList.h
Go to the documentation of this file.00001 /* 00002 * Copyright (c) 2003-2017 Objective Systems, Inc. 00003 * 00004 * This software is furnished under a license and may be used and copied 00005 * only in accordance with the terms of such license and with the 00006 * inclusion of the above copyright notice. This software or any other 00007 * copies thereof may not be provided or otherwise made available to any 00008 * other person. No title to and ownership of the software is hereby 00009 * transferred. 00010 * 00011 * The information in this software is subject to change without notice 00012 * and should not be construed as a commitment by Objective Systems, Inc. 00013 * 00014 * PROPRIETARY NOTICE 00015 * 00016 * This software is an unpublished work subject to a confidentiality agreement 00017 * and is protected by copyright and trade secret law. Unauthorized copying, 00018 * redistribution or other use of this work is prohibited. 00019 * 00020 * The above notice of copyright on this source code product does not indicate 00021 * any actual or intended publication of such source code. 00022 * 00023 *****************************************************************************/ 00027 #ifndef _RTXCPPDLIST_H_ 00028 #define _RTXCPPDLIST_H_ 00029 00030 #include "rtxsrc/OSRTBaseType.h" 00031 #include "rtxsrc/rtxDList.h" 00032 00037 class EXTRTCLASS OSRTDListNodeBaseClass : protected OSRTDListNode { 00038 friend class OSRTDListBaseClass; 00039 friend class OSRTDListClass; 00040 friend class OSRTObjListClass; 00041 protected: 00042 inline operator OSRTDListNode* () { return this; } 00043 inline operator const OSRTDListNode* () const { return this; } 00044 00045 OSRTDListNodeBaseClass (); 00046 public: 00047 OSRTDListNodeBaseClass (void* pdata); 00048 virtual ~OSRTDListNodeBaseClass() {} 00049 } ; 00050 00055 class EXTRTCLASS OSRTDListNodeClass : public OSRTDListNodeBaseClass { 00056 public: 00057 inline OSRTDListNodeClass (void* pdata) : 00058 OSRTDListNodeBaseClass (pdata) {} 00059 virtual ~OSRTDListNodeClass(); 00060 00066 inline void* getData () { return data; } 00067 00073 inline const void* getData () const { return data; } 00074 00080 inline OSRTDListNodeClass* getNext () { 00081 return (OSRTDListNodeClass*)next; 00082 } 00083 00089 inline const OSRTDListNodeClass* getNext () const { 00090 return (OSRTDListNodeClass*)next; 00091 } 00092 00098 inline OSRTDListNodeClass* getPrev () { 00099 return (OSRTDListNodeClass*)prev; 00100 } 00101 00107 inline const OSRTDListNodeClass* getPrev () const { 00108 return (OSRTDListNodeClass*)prev; 00109 } 00110 } ; 00111 00116 class EXTRTCLASS OSRTObjListNodeClass : public OSRTDListNodeBaseClass { 00117 public: 00118 OSRTObjListNodeClass (OSRTBaseType* pdata); 00119 OSRTObjListNodeClass (const OSRTObjListNodeClass&); 00120 virtual ~OSRTObjListNodeClass(); 00121 00127 inline OSRTBaseType* getData () { return (OSRTBaseType*)data; } 00128 00134 inline const OSRTBaseType* getData () const { return (OSRTBaseType*)data; } 00135 00141 inline OSRTObjListNodeClass* getNext () { 00142 return (OSRTObjListNodeClass*)next; 00143 } 00144 00150 inline const OSRTObjListNodeClass* getNext () const { 00151 return (OSRTObjListNodeClass*)next; 00152 } 00153 00159 inline OSRTObjListNodeClass* getPrev () { 00160 return (OSRTObjListNodeClass*)prev; 00161 } 00162 00168 inline const OSRTObjListNodeClass* getPrev () const { 00169 return (OSRTObjListNodeClass*)prev; 00170 } 00171 } ; 00172 00179 class EXTRTCLASS OSRTDListBaseClass : public OSRTDList, public OSRTBaseType { 00180 protected: 00181 inline OSRTDListBaseClass(const OSRTDListBaseClass& o):OSRTBaseType (o) {} 00182 00183 public: 00184 inline operator OSRTDList* () { return this; } 00185 inline operator const OSRTDList* () const { return this; } 00186 00190 inline OSRTDListBaseClass() { count = 0; head = 0; tail = 0; } 00191 00195 virtual ~OSRTDListBaseClass(); 00196 00202 inline OSSIZE getCount () const { return count; } 00203 00211 inline OSRTDList* getList () { return this; } 00212 00220 inline const OSRTDList* getList () const { return this; } 00221 00228 void remove (int index); 00229 00230 void release (); 00231 } ; 00232 00240 class EXTRTCLASS OSRTDListClass : public OSRTDListBaseClass { 00241 public: 00245 OSRTDListClass() {} 00246 00250 OSRTDListClass (const OSRTDListClass& o) : OSRTDListBaseClass(o) {} 00251 00258 void append (void* pdata); 00259 00268 void appendCopy (void* pdata, size_t nbytes); 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 00327 void insert (int index, void* pdata); 00328 00329 } ; 00330 00339 class EXTRTCLASS OSRTObjListClass : public OSRTDListBaseClass { 00340 protected: 00341 void doCopy (const OSRTObjListClass&); 00342 public: 00343 00347 inline OSRTObjListClass() { } 00348 00349 OSRTObjListClass(const OSRTObjListClass&); 00350 00357 void append (OSRTBaseType* pdata); 00358 00366 void appendCopy (const OSRTBaseType* pdata); 00367 00368 OSRTBaseType* clone () const { return new OSRTObjListClass (*this); } 00369 00375 inline OSRTObjListNodeClass* getHead () { 00376 return (OSRTObjListNodeClass*)head; 00377 } 00378 00384 inline const OSRTObjListNodeClass* getHead () const { 00385 return (OSRTObjListNodeClass*)head; 00386 } 00387 00395 inline const OSRTBaseType* getItem (int idx) const { 00396 OSRTObjListNodeClass* pnode = 00397 (OSRTObjListNodeClass*) rtxDListFindByIndex (*this, idx); 00398 return (0 != pnode) ? (OSRTBaseType*)pnode->getData () : 0; 00399 } 00400 00406 inline OSRTObjListNodeClass* getTail () { 00407 return (OSRTObjListNodeClass*)tail; 00408 } 00409 00415 inline const OSRTObjListNodeClass* getTail () const { 00416 return (OSRTObjListNodeClass*)tail; 00417 } 00418 00427 void insert (int index, OSRTBaseType* pdata); 00428 00435 OSRTObjListClass& operator= (const OSRTObjListClass&); 00436 } ; 00437 #endif