MAK RTIspy API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sortedList.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1997 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: sortedList.h,v $ $Revision: 1.4 $ $State: Exp $
7 *********************************************************************/
8 
11 
12 #ifndef DtSortedList_H_
13 #define DtSortedList_H_
14 
15 #include "rtiMsConfig.h"
16 #include <stddef.h>
17 #include <vlutil/vlMachineTypes.h>
18 
25 {
26 public:
27 
28  friend class DtSortedList;
29 
30 public:
31 
33  virtual ~DtSortedListItem();
34 
37  DtSortedListItem* prev() const;
38  DtSortedListItem* next() const;
39 
41  void* data() const;
42 
44  virtual bool operator<= (const DtSortedListItem&) const;
45  virtual bool operator< (const DtSortedListItem&) const;
46  virtual bool operator>= (const DtSortedListItem&) const;
47  virtual bool operator> (const DtSortedListItem&) const;
48  virtual bool operator== (const DtSortedListItem&) const;
49 
51  virtual void printData();
52 
53 protected:
54 
56  DtSortedListItem(void* d);
57 
58 protected:
59 
62  void* myData;
63 };
64 
65 inline void* DtSortedListItem::data() const
66 {
67  return myData;
68 }
69 
71 {
72  return myPrev;
73 }
74 
76 {
77  return myNext;
78 }
79 
81 {
84 };
85 
97 
99 {
100 
101 public:
102 
105 
108  virtual ~DtSortedList();
109 
112  DtSortedList(const DtSortedList& orig);
113 
118  DtSortedList& operator=(const DtSortedList& orig);
119 
122  virtual void setSortOrder(DtSortOrder sortOrderValue);
123  virtual DtSortOrder sortOrder() const;
124 
127  virtual DtSortedListItem* first() const;
128  virtual DtSortedListItem* last() const;
129 
131  unsigned count() const;
132 
135  virtual bool compareItems(const DtSortedListItem& firstItem,
136  const DtSortedListItem& secondItem) const;
137 
140  virtual DtSortedListItem* add(void* data);
141 
147  virtual void* remove(DtSortedListItem* item);
148 
151  virtual void removeAll();
152 
155  virtual DtSortedListItem* itemLookup(void* data) const;
156 
158  virtual void reverseSortOrder();
159 
161  virtual void printData(DtSortOrder order=DtSortOrderAscending);
162 
163 protected:
164 
167  virtual DtSortedListItem* newItem(void* data);
168 
171  virtual void addToList(DtSortedListItem* item, DtSortedListItem* before);
172 
174  virtual void removeFromList(DtSortedListItem* item);
175 
177  virtual void reposition(DtSortedListItem* item);
178 
182  virtual void repositionForward(DtSortedListItem* item,
183  DtSortedListItem* positionItem);
184 
188  virtual void repositionBackward(DtSortedListItem* item,
189  DtSortedListItem* positionItem);
190 
193  virtual void insertBefore(DtSortedListItem* item,
194  DtSortedListItem* positionItem);
195 
198  virtual void insertAfter(DtSortedListItem* item,
199  DtSortedListItem* positionItem);
200 
201 protected:
202 
205  unsigned myCount;
207 };
208 
210 {
211  return mySortOrder;
212 }
213 
214 inline bool DtSortedList::compareItems(const DtSortedListItem& firstItem,
215  const DtSortedListItem& secondItem) const
216 {
218  ? (firstItem <= secondItem) : (firstItem >= secondItem);
219 }
220 
222 {
223  return myFirst;
224 }
225 
227 {
228  return myLast;
229 }
230 
231 inline unsigned DtSortedList::count() const
232 {
233  return myCount;
234 }
235 
236 #endif
DtSortedListItem * myNext
Definition: sortedList.h:61
virtual bool compareItems(const DtSortedListItem &firstItem, const DtSortedListItem &secondItem) const
Compare the two items based on sort order and return true if first comes first in order to second...
Definition: sortedList.h:214
Definition: sortedList.h:83
unsigned count() const
Returns the number of elements in the list.
Definition: sortedList.h:231
unsigned myCount
Definition: sortedList.h:205
virtual void printData(DtSortOrder order=DtSortOrderAscending)
Print the list.
DtSortedListItem * myPrev
Definition: sortedList.h:60
DtSortOrder
Definition: sortedList.h:80
DtSortedListItem is an envelope class used by DtSortedList.
Definition: sortedList.h:24
void * myData
Definition: sortedList.h:62
void * data() const
Returns the data element contained in the DtSortedListItem envelope.
Definition: sortedList.h:65
DtSortedListItem * myFirst
Definition: sortedList.h:203
DtSortedListItem * prev() const
Return previous (next) item.
Definition: sortedList.h:70
virtual DtSortOrder sortOrder() const
Definition: sortedList.h:209
virtual DtSortedListItem * first() const
Return first and last item on the list.
Definition: sortedList.h:221
DtSortedListItem * next() const
Definition: sortedList.h:75
DtSortedListItem * myLast
Definition: sortedList.h:204
#define DT_DLL_RTIUTIL
Definition: rtiMsConfig.h:127
A DtSortedList is a list of elements of arbitrary type.
Definition: sortedList.h:98
virtual DtSortedListItem * last() const
Definition: sortedList.h:226
Definition: sortedList.h:82
DtSortOrder mySortOrder
Definition: sortedList.h:206

Document ID: Generated on Thu May 11 15:55:32 EDT 2023 from SVN revision 254743
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)