MAK RTIspy API Documentation for HLA Evolved
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

Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)