ReactOS
0.4.16-dev-340-g0540c21
fxcollection.hpp
Go to the documentation of this file.
1
/*++
2
3
Copyright (c) Microsoft Corporation
4
5
Module Name:
6
7
FxCollection.hpp
8
9
Abstract:
10
11
This module implements a simple collection class to operate on
12
objects derived from FxObject.
13
14
Author:
15
16
17
18
Environment:
19
20
Both kernel and user mode
21
22
Revision History:
23
24
--*/
25
26
#ifndef _FXCOLLECTION_HPP_
27
#define _FXCOLLECTION_HPP_
28
29
class
FxCollectionEntry
:
public
FxStump
{
30
31
friend
FxCollection
;
32
friend
FxCollectionInternal
;
33
34
protected
:
35
FxCollectionEntry
(
36
VOID
37
)
38
{
39
}
40
41
public
:
42
FxObject
*
m_Object
;
43
44
LIST_ENTRY
m_ListEntry
;
45
46
public
:
47
FxCollectionEntry
*
48
Next
(
49
VOID
50
)
51
{
52
return
CONTAINING_RECORD
(
m_ListEntry
.
Flink
,
FxCollectionEntry
,
m_ListEntry
);
53
}
54
};
55
56
struct
FxCollectionInternal
{
57
protected
:
58
ULONG
m_Count
;
59
60
LIST_ENTRY
m_ListHead
;
61
62
public
:
63
FxCollectionInternal
(
64
VOID
65
);
66
67
~FxCollectionInternal
(
68
VOID
69
);
70
71
_Must_inspect_result_
72
FxCollectionEntry
*
73
FindEntry
(
74
__in
ULONG
Index
75
);
76
77
_Must_inspect_result_
78
FxCollectionEntry
*
79
FindEntryByObject
(
80
__in
FxObject
*
Object
81
);
82
83
ULONG
84
Count
(
85
VOID
86
);
87
88
BOOLEAN
89
Add
(
90
__in
PFX_DRIVER_GLOBALS
FxDriverGlobals,
91
__in
FxObject
*
Item
92
);
93
94
_Must_inspect_result_
95
FxObject
*
96
GetItem
(
97
__in
ULONG
Index
98
);
99
100
_Must_inspect_result_
101
FxObject
*
102
GetFirstItem
(
103
VOID
104
);
105
106
_Must_inspect_result_
107
FxObject
*
108
GetLastItem
(
109
VOID
110
);
111
112
NTSTATUS
113
Remove
(
114
__in
ULONG
Index
115
);
116
117
VOID
118
CleanupEntry
(
119
__in
FxCollectionEntry
*
Entry
120
);
121
122
VOID
123
CleanupEntryObject
(
124
__in
FxObject
*
Object
125
)
126
{
127
Object
->RELEASE(
this
);
128
}
129
130
NTSTATUS
131
RemoveEntry
(
132
__in
FxCollectionEntry
*
Entry
133
);
134
135
_Must_inspect_result_
136
NTSTATUS
137
RemoveItem
(
138
__in
FxObject
*
Item
139
);
140
141
_Must_inspect_result_
142
FxCollectionEntry
*
143
Start
(
144
VOID
145
)
146
{
147
return
CONTAINING_RECORD
(
m_ListHead
.
Flink
,
FxCollectionEntry
, m_ListEntry);
148
}
149
150
_Must_inspect_result_
151
FxCollectionEntry
*
152
End
(
153
VOID
154
)
155
{
156
return
CONTAINING_RECORD
(&
m_ListHead
,
FxCollectionEntry
, m_ListEntry);
157
}
158
159
VOID
160
Clear
(
161
VOID
162
);
163
164
protected
:
165
_Must_inspect_result_
166
FxCollectionEntry
*
167
AllocateEntry
(
168
__in
PFX_DRIVER_GLOBALS
FxDriverGlobals
169
)
170
{
171
return
new
(FxDriverGlobals)
FxCollectionEntry
();
172
}
173
174
VOID
175
AddEntry
(
176
__in
FxCollectionEntry
*
Node
,
177
__in
FxObject
*
Item
178
)
179
{
180
Node
->m_Object =
Item
;
181
182
//
183
// Refcount the item we are adding to the list.
184
//
185
Item
->ADDREF(
this
);
186
187
//
188
// Increment the number of items in the collection.
189
//
190
m_Count
++;
191
}
192
};
193
194
class
FxCollection
:
public
FxNonPagedObject
,
public
FxCollectionInternal
{
195
196
public
:
197
FxCollection
(
198
__in
PFX_DRIVER_GLOBALS
FxDriverGlobals
199
);
200
201
~FxCollection
(
202
VOID
203
);
204
205
BOOLEAN
206
Add
(
207
__in
FxObject
*
Item
208
)
209
{
210
return
FxCollectionInternal::Add
(
GetDriverGlobals
(),
Item
);
211
}
212
213
VOID
214
StealCollection
(
215
__in
FxCollection
*
Collection
216
);
217
218
protected
:
219
FxCollection
(
220
__in
PFX_DRIVER_GLOBALS
FxDriverGlobals,
221
__in
WDFTYPE
Type
,
222
__in
USHORT
Size
223
);
224
225
};
226
227
#endif
// _FXCOLLECTION_HPP_
BOOLEAN
unsigned char BOOLEAN
Definition:
ProcessorBind.h:185
Type
Type
Definition:
Type.h:7
NTSTATUS
LONG NTSTATUS
Definition:
precomp.h:26
FxCollectionEntry
Definition:
fxcollection.hpp:29
FxCollectionEntry::m_Object
FxObject * m_Object
Definition:
fxcollection.hpp:42
FxCollectionEntry::FxCollectionInternal
friend FxCollectionInternal
Definition:
fxcollection.hpp:32
FxCollectionEntry::Next
FxCollectionEntry * Next(VOID)
Definition:
fxcollection.hpp:48
FxCollectionEntry::FxCollectionEntry
FxCollectionEntry(VOID)
Definition:
fxcollection.hpp:35
FxCollectionEntry::FxCollection
friend FxCollection
Definition:
fxcollection.hpp:31
FxCollectionEntry::m_ListEntry
LIST_ENTRY m_ListEntry
Definition:
fxcollection.hpp:44
FxCollection
Definition:
fxcollection.hpp:194
FxCollection::~FxCollection
~FxCollection(VOID)
Definition:
fxcollection.cpp:247
FxCollection::StealCollection
VOID StealCollection(__in FxCollection *Collection)
Definition:
fxcollection.cpp:255
FxCollection::Add
BOOLEAN Add(__in FxObject *Item)
Definition:
fxcollection.hpp:206
FxNonPagedObject
Definition:
fxnonpagedobject.hpp:46
FxObject
Definition:
fxobject.hpp:232
FxObject::GetDriverGlobals
__inline PFX_DRIVER_GLOBALS GetDriverGlobals(VOID)
Definition:
fxobject.hpp:734
__in
#define __in
Definition:
dbghelp.h:35
WDFTYPE
USHORT WDFTYPE
Definition:
fxtypes.h:29
void
Definition:
nsiface.idl:2307
Clear
static void Clear(void)
Definition:
treeview.c:388
_Must_inspect_result_
#define _Must_inspect_result_
Definition:
no_sal2.h:62
Count
int Count
Definition:
noreturn.cpp:7
USHORT
unsigned short USHORT
Definition:
pedump.c:61
Entry
base of all file and directory entries
Definition:
entries.h:83
FxCollectionInternal
Definition:
fxcollection.hpp:56
FxCollectionInternal::FindEntry
_Must_inspect_result_ FxCollectionEntry * FindEntry(__in ULONG Index)
Definition:
fxcollection.cpp:82
FxCollectionInternal::Start
_Must_inspect_result_ FxCollectionEntry * Start(VOID)
Definition:
fxcollection.hpp:143
FxCollectionInternal::~FxCollectionInternal
~FxCollectionInternal(VOID)
Definition:
fxcollection.cpp:36
FxCollectionInternal::m_ListHead
LIST_ENTRY m_ListHead
Definition:
fxcollection.hpp:60
FxCollectionInternal::m_Count
ULONG m_Count
Definition:
fxcollection.hpp:58
FxCollectionInternal::CleanupEntry
VOID CleanupEntry(__in FxCollectionEntry *Entry)
Definition:
fxcollection.cpp:161
FxCollectionInternal::RemoveEntry
NTSTATUS RemoveEntry(__in FxCollectionEntry *Entry)
Definition:
fxcollection.cpp:172
FxCollectionInternal::RemoveItem
_Must_inspect_result_ NTSTATUS RemoveItem(__in FxObject *Item)
Definition:
fxcollection.cpp:145
FxCollectionInternal::GetLastItem
_Must_inspect_result_ FxObject * GetLastItem(VOID)
Definition:
fxcollection.cpp:218
FxCollectionInternal::AddEntry
VOID AddEntry(__in FxCollectionEntry *Node, __in FxObject *Item)
Definition:
fxcollection.hpp:175
FxCollectionInternal::GetItem
_Must_inspect_result_ FxObject * GetItem(__in ULONG Index)
Definition:
fxcollection.cpp:184
FxCollectionInternal::Add
BOOLEAN Add(__in PFX_DRIVER_GLOBALS FxDriverGlobals, __in FxObject *Item)
Definition:
fxcollection.cpp:62
FxCollectionInternal::End
_Must_inspect_result_ FxCollectionEntry * End(VOID)
Definition:
fxcollection.hpp:152
FxCollectionInternal::FindEntryByObject
_Must_inspect_result_ FxCollectionEntry * FindEntryByObject(__in FxObject *Object)
Definition:
fxcollection.cpp:108
FxCollectionInternal::GetFirstItem
_Must_inspect_result_ FxObject * GetFirstItem(VOID)
Definition:
fxcollection.cpp:202
FxCollectionInternal::CleanupEntryObject
VOID CleanupEntryObject(__in FxObject *Object)
Definition:
fxcollection.hpp:123
FxCollectionInternal::AllocateEntry
_Must_inspect_result_ FxCollectionEntry * AllocateEntry(__in PFX_DRIVER_GLOBALS FxDriverGlobals)
Definition:
fxcollection.hpp:167
FxStump
Definition:
fxstump.hpp:20
_FX_DRIVER_GLOBALS
Definition:
fxglobals.h:165
_LIST_ENTRY
Definition:
typedefs.h:120
_LIST_ENTRY::Flink
struct _LIST_ENTRY * Flink
Definition:
typedefs.h:121
CONTAINING_RECORD
#define CONTAINING_RECORD(address, type, field)
Definition:
typedefs.h:260
ULONG
uint32_t ULONG
Definition:
typedefs.h:59
node
Definition:
dlist.c:348
Object
_Must_inspect_result_ _In_ WDFCOLLECTION _In_ WDFOBJECT Object
Definition:
wdfcollection.h:123
Index
_In_ WDFCOLLECTION _In_ ULONG Index
Definition:
wdfcollection.h:182
Item
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
Definition:
wdfcollection.h:153
Size
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition:
wdfdevice.h:4533
Collection
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ WDFCOLLECTION Collection
Definition:
wdfregistry.h:374
Remove
_In_ BOOLEAN Remove
Definition:
psfuncs.h:110
sdk
lib
drivers
wdf
shared
inc
private
common
fxcollection.hpp
Generated on Sat Dec 14 2024 06:13:39 for ReactOS by
1.9.6