00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _ASN1CSEQOFLIST_H_
00025 #define _ASN1CSEQOFLIST_H_
00026
00027 #include <stdlib.h>
00028 #include "rtsrc/asn1CppTypes.h"
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 #ifndef _NO_UTILS_CLASSES
00058
00059 class EXTRTCLASS ASN1CSeqOfList;
00060
00062
00063
00064
00075 class EXTRTCLASS ASN1CSeqOfListIterator {
00076 friend class ASN1CSeqOfList;
00077 protected:
00078 ASN1CSeqOfList* pSeqList;
00079 OSRTDListNode* nextNode;
00080 OSRTDListNode* lastNode;
00081 volatile int expectedModCount;
00082 int stat;
00083
00084 EXTRTMETHOD ASN1CSeqOfListIterator(ASN1CSeqOfList* list);
00085 EXTRTMETHOD ASN1CSeqOfListIterator(ASN1CSeqOfList* list, OSRTDListNode* startNode);
00086
00087 public:
00098 inline OSBOOL hasNext() { return OSBOOL(nextNode != 0); }
00099
00110 inline OSBOOL hasPrev() { return OSBOOL(nextNode != 0); }
00111
00121 EXTRTMETHOD void* next();
00122
00133 EXTRTMETHOD void* prev();
00134
00146 EXTRTMETHOD int remove();
00147
00161 EXTRTMETHOD int set(void* data);
00162
00178 EXTRTMETHOD int insert(void* data);
00179
00180
00181 inline int getState () { return stat; }
00182
00183 protected:
00184 inline void* operator new(size_t, void* data) { return data; }
00185 #if !defined(__xlC__)
00186 inline void operator delete(void*, void*) {}
00187 #endif
00188 #ifndef __BORLANDC__
00189 inline void operator delete(void*, size_t) {}
00190 #endif
00191 } ;
00192
00193
00195
00196
00197
00204 class EXTRTCLASS ASN1CSeqOfList : public ASN1CType {
00205 friend class ASN1CSeqOfListIterator;
00206 protected:
00207 OSRTDList* pList;
00208 volatile int modCount;
00209 OSBOOL wasAssigned;
00210
00211
00212
00213 EXTRTMETHOD ASN1CSeqOfList (OSRTDList& lst);
00214 EXTRTMETHOD ASN1CSeqOfList (ASN1TSeqOfList& lst);
00215 EXTRTMETHOD ASN1CSeqOfList (ASN1TPDUSeqOfList& lst);
00216
00217 public:
00218
00232 EXTRTMETHOD ASN1CSeqOfList (OSRTMessageBufferIF& msgBuf, OSRTDList& lst,
00233 OSBOOL initBeforeUse = TRUE);
00234
00241 EXTRTMETHOD ASN1CSeqOfList (OSRTMessageBufferIF& msgBuf);
00242
00249 EXTRTMETHOD ASN1CSeqOfList (ASN1CType& ccobj);
00250
00264 EXTRTMETHOD ASN1CSeqOfList (OSRTMessageBufferIF& msgBuf, ASN1TSeqOfList& lst);
00265
00279 EXTRTMETHOD ASN1CSeqOfList (ASN1CType& ccobj, ASN1TSeqOfList& lst);
00280
00294 EXTRTMETHOD ASN1CSeqOfList (OSRTMessageBufferIF& msgBuf, ASN1TPDUSeqOfList& lst);
00295
00296 EXTRTMETHOD ASN1CSeqOfList (OSRTContext& ctxt, OSRTDList& lst,
00297 OSBOOL initBeforeUse = TRUE);
00298 EXTRTMETHOD ASN1CSeqOfList (OSRTContext& ctxt);
00299 EXTRTMETHOD ASN1CSeqOfList (OSRTContext& ctxt, ASN1TSeqOfList& lst);
00300 EXTRTMETHOD ASN1CSeqOfList (OSRTContext& ctxt, ASN1TPDUSeqOfList& lst);
00301
00302 EXTRTMETHOD ~ASN1CSeqOfList();
00303
00304
00316 EXTRTMETHOD void append(void* data);
00317
00318
00333 EXTRTMETHOD void appendArray
00334 (const void* data, OSSIZE numElems, OSSIZE elemSize);
00335
00336
00351 EXTRTMETHOD void appendArrayCopy
00352 (const void* data, OSSIZE numElems, OSSIZE elemSize);
00353
00357 inline void init () {
00358 rtxDListInit (pList);
00359 }
00360
00361
00374 EXTRTMETHOD void insert(int index, void* data);
00375
00376
00388 EXTRTMETHOD void remove(int index);
00389
00390
00401 EXTRTMETHOD void remove(void* data);
00402
00403
00410 inline void removeFirst() {
00411 remove(pList->head);
00412 }
00413
00414
00421 inline void removeLast() {
00422 remove(pList->tail);
00423 }
00424
00425
00435 EXTRTMETHOD int indexOf(void* data) const;
00436
00437
00446 inline OSBOOL contains (void* data) const {
00447 return indexOf(data) != -1;
00448 }
00449
00456 EXTRTMETHOD void* getFirst();
00457
00464 EXTRTMETHOD void* getLast();
00465
00472 EXTRTMETHOD void* get (int index) const;
00473
00482 EXTRTMETHOD void* set (int index, void* data);
00483
00487 EXTRTMETHOD void clear();
00488
00493 EXTRTMETHOD void freeMemory();
00494
00500 EXTRTMETHOD OSBOOL isEmpty() const;
00501
00507 EXTRTMETHOD OSSIZE size() const;
00508
00515 EXTRTMETHOD ASN1CSeqOfListIterator* iterator();
00516
00517
00525 EXTRTMETHOD ASN1CSeqOfListIterator* iteratorFromLast();
00526
00527
00536 EXTRTMETHOD ASN1CSeqOfListIterator* iteratorFrom(void* data);
00537
00547 EXTRTMETHOD void* toArray (OSSIZE elemSize);
00548
00549
00566 EXTRTMETHOD void* toArray
00567 (void* pArray, OSSIZE elemSize, OSSIZE allocatedElems);
00568
00569
00577 inline void* operator[](int index) const {
00578 return get(index);
00579 }
00580
00581 inline operator OSRTDList* () {
00582 return pList;
00583 }
00584 protected:
00585
00586 EXTRTMETHOD void remove(OSRTDListNode* node);
00587
00588
00589 EXTRTMETHOD void insertBefore(void* data, OSRTDListNode* node);
00590
00591
00592 EXTRTMETHOD void insertAfter(void* data, OSRTDListNode* node);
00593
00594
00595 } ;
00596 #else
00597 typedef class _ASN1CSeqOfList : public ASN1CType {
00598 public:
00599 _ASN1CSeqOfList (OSRTMessageBufferIF& msgBuf, OSRTDList& lst,
00600 OSBOOL initBeforeUse = TRUE) : ASN1CType (msgBuf) {}
00601 _ASN1CSeqOfList (OSRTMessageBufferIF& msgBuf, ASN1TSeqOfList& lst) :
00602 ASN1CType (msgBuf) {}
00603 _ASN1CSeqOfList (OSRTMessageBufferIF& msgBuf) : ASN1CType (msgBuf) {}
00604 } ASN1CSeqOfList;
00605
00606 #endif // _NO_UTILS_CLASSES
00607
00612 #endif // _ASN1CSEQOFLIST_H_