MAK RTIspy API Documentation for HLA 1.3
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
libsrc
rtiutil
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
24
class
DT_DLL_RTIUTIL
DtSortedListItem
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
60
DtSortedListItem
*
myPrev
;
61
DtSortedListItem
*
myNext
;
62
void
*
myData
;
63
};
64
65
inline
void
*
DtSortedListItem::data
()
const
66
{
67
return
myData
;
68
}
69
70
inline
DtSortedListItem
*
DtSortedListItem::prev
()
const
71
{
72
return
myPrev
;
73
}
74
75
inline
DtSortedListItem
*
DtSortedListItem::next
()
const
76
{
77
return
myNext
;
78
}
79
80
enum
DtSortOrder
81
{
82
DtSortOrderAscending
,
83
DtSortOrderDescending
84
};
85
97
98
class
DT_DLL_RTIUTIL
DtSortedList
99
{
100
101
public
:
102
104
DtSortedList
(
DtSortOrder
sortOrderVal=
DtSortOrderAscending
);
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
203
DtSortedListItem
*
myFirst
;
204
DtSortedListItem
*
myLast
;
205
unsigned
myCount
;
206
DtSortOrder
mySortOrder
;
207
};
208
209
inline
DtSortOrder
DtSortedList::sortOrder
()
const
210
{
211
return
mySortOrder
;
212
}
213
214
inline
bool
DtSortedList::compareItems
(
const
DtSortedListItem
& firstItem,
215
const
DtSortedListItem
& secondItem)
const
216
{
217
return
(
mySortOrder
==
DtSortOrderAscending
)
218
? (firstItem <= secondItem) : (firstItem >= secondItem);
219
}
220
221
inline
DtSortedListItem
*
DtSortedList::first
()
const
222
{
223
return
myFirst
;
224
}
225
226
inline
DtSortedListItem
*
DtSortedList::last
()
const
227
{
228
return
myLast
;
229
}
230
231
inline
unsigned
DtSortedList::count
()
const
232
{
233
return
myCount
;
234
}
235
236
#endif
Document ID: Generated on Wed Mar 11 20:26:49 EDT 2015 from SVN revision 150939
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (
www.mak.com
)