1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
5 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
6 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. You may obtain a copy of the License at
|
---|
8 | * http://www.mozilla.org/MPL/
|
---|
9 | *
|
---|
10 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
11 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
12 | * for the specific language governing rights and limitations under the
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is the Netscape Portable Runtime (NSPR).
|
---|
16 | *
|
---|
17 | * The Initial Developer of the Original Code is
|
---|
18 | * Netscape Communications Corporation.
|
---|
19 | * Portions created by the Initial Developer are Copyright (C) 1998-2000
|
---|
20 | * the Initial Developer. All Rights Reserved.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | *
|
---|
24 | * Alternatively, the contents of this file may be used under the terms of
|
---|
25 | * either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
26 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
27 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
28 | * of those above. If you wish to allow use of your version of this file only
|
---|
29 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
30 | * use your version of this file under the terms of the MPL, indicate your
|
---|
31 | * decision by deleting the provisions above and replace them with the notice
|
---|
32 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
33 | * the provisions above, a recipient may use your version of this file under
|
---|
34 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
35 | *
|
---|
36 | * ***** END LICENSE BLOCK ***** */
|
---|
37 |
|
---|
38 | #ifndef prcountr_h___
|
---|
39 | #define prcountr_h___
|
---|
40 |
|
---|
41 | /*----------------------------------------------------------------------------
|
---|
42 | ** prcountr.h -- NSPR Instrumentation counters
|
---|
43 | **
|
---|
44 | ** The NSPR Counter Feature provides a means to "count
|
---|
45 | ** something." Counters can be dynamically defined, incremented,
|
---|
46 | ** decremented, set, and deleted under application program
|
---|
47 | ** control.
|
---|
48 | **
|
---|
49 | ** The Counter Feature is intended to be used as instrumentation,
|
---|
50 | ** not as operational data. If you need a counter for operational
|
---|
51 | ** data, use native integral types.
|
---|
52 | **
|
---|
53 | ** Counters are 32bit unsigned intergers. On overflow, a counter
|
---|
54 | ** will wrap. No exception is recognized or reported.
|
---|
55 | **
|
---|
56 | ** A counter can be dynamically created using a two level naming
|
---|
57 | ** convention. A "handle" is returned when the counter is
|
---|
58 | ** created. The counter can subsequently be addressed by its
|
---|
59 | ** handle. An API is provided to get an existing counter's handle
|
---|
60 | ** given the names with which it was originally created.
|
---|
61 | ** Similarly, a counter's name can be retrieved given its handle.
|
---|
62 | **
|
---|
63 | ** The counter naming convention is a two-level hierarchy. The
|
---|
64 | ** QName is the higher level of the hierarchy; RName is the
|
---|
65 | ** lower level. RNames can be thought of as existing within a
|
---|
66 | ** QName. The same RName can exist within multiple QNames. QNames
|
---|
67 | ** are unique. The NSPR Counter is not a near-zero overhead
|
---|
68 | ** feature. Application designers should be aware of
|
---|
69 | ** serialization issues when using the Counter API. Creating a
|
---|
70 | ** counter locks a large asset, potentially causing a stall. This
|
---|
71 | ** suggest that applications should create counters at component
|
---|
72 | ** initialization, for example, and not create and destroy them
|
---|
73 | ** willy-nilly. ... You have been warned.
|
---|
74 | **
|
---|
75 | ** Incrementing and Adding to counters uses atomic operations.
|
---|
76 | ** The performance of these operations will vary from platform
|
---|
77 | ** to platform. On platforms where atomic operations are not
|
---|
78 | ** supported the overhead may be substantial.
|
---|
79 | **
|
---|
80 | ** When traversing the counter database with FindNext functions,
|
---|
81 | ** the instantaneous values of any given counter is that at the
|
---|
82 | ** moment of extraction. The state of the entire counter database
|
---|
83 | ** may not be viewed as atomic.
|
---|
84 | **
|
---|
85 | ** The counter interface may be disabled (No-Op'd) at compile
|
---|
86 | ** time. When DEBUG is defined at compile time, the Counter
|
---|
87 | ** Feature is compiled into NSPR and applications invoking it.
|
---|
88 | ** When DEBUG is not defined, the counter macros compile to
|
---|
89 | ** nothing. To force the Counter Feature to be compiled into an
|
---|
90 | ** optimized build, define FORCE_NSPR_COUNTERS at compile time
|
---|
91 | ** for both NSPR and the application intending to use it.
|
---|
92 | **
|
---|
93 | ** Application designers should use the macro form of the Counter
|
---|
94 | ** Feature methods to minimize performance impact in optimized
|
---|
95 | ** builds. The macros normally compile to nothing on optimized
|
---|
96 | ** builds.
|
---|
97 | **
|
---|
98 | ** Application designers should be aware of the effects of
|
---|
99 | ** debug and optimized build differences when using result of the
|
---|
100 | ** Counter Feature macros in expressions.
|
---|
101 | **
|
---|
102 | ** The Counter Feature is thread-safe and SMP safe.
|
---|
103 | **
|
---|
104 | ** /lth. 09-Jun-1998.
|
---|
105 | */
|
---|
106 |
|
---|
107 | #include "prtypes.h"
|
---|
108 |
|
---|
109 | #ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
|
---|
110 | #define PR_CreateCounter VBoxNsprPR_CreateCounter
|
---|
111 | #define PR_DestroyCounter VBoxNsprPR_DestroyCounter
|
---|
112 | #define PR_GetCounterHandleFromName VBoxNsprPR_GetCounterHandleFromName
|
---|
113 | #define PR_GetCounterNameFromHandle VBoxNsprPR_GetCounterNameFromHandle
|
---|
114 | #define PR_IncrementCounter VBoxNsprPR_IncrementCounter
|
---|
115 | #define PR_DecrementCounter VBoxNsprPR_DecrementCounter
|
---|
116 | #define PR_AddToCounter VBoxNsprPR_AddToCounter
|
---|
117 | #define PR_SubtractFromCounter VBoxNsprPR_SubtractFromCounter
|
---|
118 | #define PR_GetCounter VBoxNsprPR_GetCounter
|
---|
119 | #define PR_SetCounter VBoxNsprPR_SetCounter
|
---|
120 | #define PR_FindNextCounterQname VBoxNsprPR_FindNextCounterQname
|
---|
121 | #define PR_FindNextCounterRname VBoxNsprPR_FindNextCounterRname
|
---|
122 | #endif /* VBOX_WITH_XPCOM_NAMESPACE_CLEANUP */
|
---|
123 |
|
---|
124 | PR_BEGIN_EXTERN_C
|
---|
125 |
|
---|
126 | /*
|
---|
127 | ** Opaque counter handle type.
|
---|
128 | ** ... don't even think of looking in here.
|
---|
129 | **
|
---|
130 | */
|
---|
131 | typedef void * PRCounterHandle;
|
---|
132 |
|
---|
133 | #define PRCOUNTER_NAME_MAX 31
|
---|
134 | #define PRCOUNTER_DESC_MAX 255
|
---|
135 |
|
---|
136 |
|
---|
137 |
|
---|
138 | /* -----------------------------------------------------------------------
|
---|
139 | ** FUNCTION: PR_DEFINE_COUNTER() -- Define a PRCounterHandle
|
---|
140 | **
|
---|
141 | ** DESCRIPTION: PR_DEFINE_COUNTER() is used to define a counter
|
---|
142 | ** handle.
|
---|
143 | **
|
---|
144 | */
|
---|
145 | #define PR_DEFINE_COUNTER(name) PRCounterHandle name
|
---|
146 |
|
---|
147 | /* -----------------------------------------------------------------------
|
---|
148 | ** FUNCTION: PR_INIT_COUNTER_HANDLE() -- Set the value of a PRCounterHandle
|
---|
149 | **
|
---|
150 | ** DESCRIPTION:
|
---|
151 | ** PR_INIT_COUNTER_HANDLE() sets the value of a PRCounterHandle
|
---|
152 | ** to value.
|
---|
153 | **
|
---|
154 | */
|
---|
155 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
156 | #define PR_INIT_COUNTER_HANDLE(handle,value)\
|
---|
157 | (handle) = (PRCounterHandle)(value)
|
---|
158 | #else
|
---|
159 | #define PR_INIT_COUNTER_HANDLE(handle,value)
|
---|
160 | #endif
|
---|
161 |
|
---|
162 | /* -----------------------------------------------------------------------
|
---|
163 | ** FUNCTION: PR_CreateCounter() -- Create a counter
|
---|
164 | **
|
---|
165 | ** DESCRIPTION: PR_CreateCounter() creates a counter object and
|
---|
166 | ** initializes it to zero.
|
---|
167 | **
|
---|
168 | ** The macro form takes as its first argument the name of the
|
---|
169 | ** PRCounterHandle to receive the handle returned from
|
---|
170 | ** PR_CreateCounter().
|
---|
171 | **
|
---|
172 | ** INPUTS:
|
---|
173 | ** qName: The QName for the counter object. The maximum length
|
---|
174 | ** of qName is defined by PRCOUNTER_NAME_MAX
|
---|
175 | **
|
---|
176 | ** rName: The RName for the counter object. The maximum length
|
---|
177 | ** of qName is defined by PRCOUNTER_NAME_MAX
|
---|
178 | **
|
---|
179 | ** descrioption: The description of the counter object. The
|
---|
180 | ** maximum length of description is defined by
|
---|
181 | ** PRCOUNTER_DESC_MAX.
|
---|
182 | **
|
---|
183 | ** OUTPUTS:
|
---|
184 | **
|
---|
185 | ** RETURNS:
|
---|
186 | ** PRCounterHandle.
|
---|
187 | **
|
---|
188 | ** RESTRICTIONS:
|
---|
189 | **
|
---|
190 | */
|
---|
191 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
192 | #define PR_CREATE_COUNTER(handle,qName,rName,description)\
|
---|
193 | (handle) = PR_CreateCounter((qName),(rName),(description))
|
---|
194 | #else
|
---|
195 | #define PR_CREATE_COUNTER(handle,qName,rName,description)
|
---|
196 | #endif
|
---|
197 |
|
---|
198 | NSPR_API(PRCounterHandle)
|
---|
199 | PR_CreateCounter(
|
---|
200 | const char *qName,
|
---|
201 | const char *rName,
|
---|
202 | const char *description
|
---|
203 | );
|
---|
204 |
|
---|
205 | /* -----------------------------------------------------------------------
|
---|
206 | ** FUNCTION: PR_DestroyCounter() -- Destroy a counter object.
|
---|
207 | **
|
---|
208 | ** DESCRIPTION: PR_DestroyCounter() removes a counter and
|
---|
209 | ** unregisters its handle from the counter database.
|
---|
210 | **
|
---|
211 | ** INPUTS:
|
---|
212 | ** handle: the PRCounterHandle of the counter to be destroyed.
|
---|
213 | **
|
---|
214 | ** OUTPUTS:
|
---|
215 | ** The counter is destroyed.
|
---|
216 | **
|
---|
217 | ** RETURNS: void
|
---|
218 | **
|
---|
219 | ** RESTRICTIONS:
|
---|
220 | **
|
---|
221 | */
|
---|
222 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
223 | #define PR_DESTROY_COUNTER(handle) PR_DestroyCounter((handle))
|
---|
224 | #else
|
---|
225 | #define PR_DESTROY_COUNTER(handle)
|
---|
226 | #endif
|
---|
227 |
|
---|
228 | NSPR_API(void)
|
---|
229 | PR_DestroyCounter(
|
---|
230 | PRCounterHandle handle
|
---|
231 | );
|
---|
232 |
|
---|
233 |
|
---|
234 | /* -----------------------------------------------------------------------
|
---|
235 | ** FUNCTION: PR_GetCounterHandleFromName() -- Retreive a
|
---|
236 | ** counter's handle give its name.
|
---|
237 | **
|
---|
238 | ** DESCRIPTION: PR_GetCounterHandleFromName() retreives a
|
---|
239 | ** counter's handle from the counter database, given the name
|
---|
240 | ** the counter was originally created with.
|
---|
241 | **
|
---|
242 | ** INPUTS:
|
---|
243 | ** qName: Counter's original QName.
|
---|
244 | ** rName: Counter's original RName.
|
---|
245 | **
|
---|
246 | ** OUTPUTS:
|
---|
247 | **
|
---|
248 | ** RETURNS:
|
---|
249 | ** PRCounterHandle or PRCounterError.
|
---|
250 | **
|
---|
251 | ** RESTRICTIONS:
|
---|
252 | **
|
---|
253 | */
|
---|
254 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
255 | #define PR_GET_COUNTER_HANDLE_FROM_NAME(handle,qName,rName)\
|
---|
256 | (handle) = PR_GetCounterHandleFromName((qName),(rName))
|
---|
257 | #else
|
---|
258 | #define PR_GET_COUNTER_HANDLE_FROM_NAME(handle,qName,rName)
|
---|
259 | #endif
|
---|
260 |
|
---|
261 | NSPR_API(PRCounterHandle)
|
---|
262 | PR_GetCounterHandleFromName(
|
---|
263 | const char *qName,
|
---|
264 | const char *rName
|
---|
265 | );
|
---|
266 |
|
---|
267 | /* -----------------------------------------------------------------------
|
---|
268 | ** FUNCTION: PR_GetCounterNameFromHandle() -- Retreive a
|
---|
269 | ** counter's name, given its handle.
|
---|
270 | **
|
---|
271 | ** DESCRIPTION: PR_GetCounterNameFromHandle() retreives a
|
---|
272 | ** counter's name given its handle.
|
---|
273 | **
|
---|
274 | ** INPUTS:
|
---|
275 | ** qName: Where to store a pointer to qName.
|
---|
276 | ** rName: Where to store a pointer to rName.
|
---|
277 | ** description: Where to store a pointer to description.
|
---|
278 | **
|
---|
279 | ** OUTPUTS: Pointers to the Counter Feature's copies of the names
|
---|
280 | ** used when the counters were created.
|
---|
281 | **
|
---|
282 | ** RETURNS: void
|
---|
283 | **
|
---|
284 | ** RESTRICTIONS:
|
---|
285 | **
|
---|
286 | */
|
---|
287 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
288 | #define PR_GET_COUNTER_NAME_FROM_HANDLE(handle,qName,rName,description)\
|
---|
289 | PR_GetCounterNameFromHandle((handle),(qName),(rName),(description))
|
---|
290 | #else
|
---|
291 | #define PR_GET_COUNTER_NAME_FROM_HANDLE(handle,qName,rName,description )
|
---|
292 | #endif
|
---|
293 |
|
---|
294 | NSPR_API(void)
|
---|
295 | PR_GetCounterNameFromHandle(
|
---|
296 | PRCounterHandle handle,
|
---|
297 | const char **qName,
|
---|
298 | const char **rName,
|
---|
299 | const char **description
|
---|
300 | );
|
---|
301 |
|
---|
302 |
|
---|
303 | /* -----------------------------------------------------------------------
|
---|
304 | ** FUNCTION: PR_IncrementCounter() -- Add one to the referenced
|
---|
305 | ** counter.
|
---|
306 | **
|
---|
307 | ** DESCRIPTION: Add one to the referenced counter.
|
---|
308 | **
|
---|
309 | ** INPUTS:
|
---|
310 | ** handle: The PRCounterHandle of the counter to be incremented
|
---|
311 | **
|
---|
312 | ** OUTPUTS: The counter is incrementd.
|
---|
313 | **
|
---|
314 | ** RETURNS: void
|
---|
315 | **
|
---|
316 | ** RESTRICTIONS:
|
---|
317 | **
|
---|
318 | */
|
---|
319 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
320 | #define PR_INCREMENT_COUNTER(handle) PR_IncrementCounter(handle)
|
---|
321 | #else
|
---|
322 | #define PR_INCREMENT_COUNTER(handle)
|
---|
323 | #endif
|
---|
324 |
|
---|
325 | NSPR_API(void)
|
---|
326 | PR_IncrementCounter(
|
---|
327 | PRCounterHandle handle
|
---|
328 | );
|
---|
329 |
|
---|
330 |
|
---|
331 | /* -----------------------------------------------------------------------
|
---|
332 | ** FUNCTION: PR_DecrementCounter() -- Subtract one from the
|
---|
333 | ** referenced counter
|
---|
334 | **
|
---|
335 | ** DESCRIPTION: Subtract one from the referenced counter.
|
---|
336 | **
|
---|
337 | ** INPUTS:
|
---|
338 | ** handle: The PRCounterHandle of the coutner to be
|
---|
339 | ** decremented.
|
---|
340 | **
|
---|
341 | ** OUTPUTS: the counter is decremented.
|
---|
342 | **
|
---|
343 | ** RETURNS: void
|
---|
344 | **
|
---|
345 | ** RESTRICTIONS:
|
---|
346 | **
|
---|
347 | */
|
---|
348 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
349 | #define PR_DECREMENT_COUNTER(handle) PR_DecrementCounter(handle)
|
---|
350 | #else
|
---|
351 | #define PR_DECREMENT_COUNTER(handle)
|
---|
352 | #endif
|
---|
353 |
|
---|
354 | NSPR_API(void)
|
---|
355 | PR_DecrementCounter(
|
---|
356 | PRCounterHandle handle
|
---|
357 | );
|
---|
358 |
|
---|
359 | /* -----------------------------------------------------------------------
|
---|
360 | ** FUNCTION: PR_AddToCounter() -- Add a value to a counter.
|
---|
361 | **
|
---|
362 | ** DESCRIPTION: Add value to the counter referenced by handle.
|
---|
363 | **
|
---|
364 | ** INPUTS:
|
---|
365 | ** handle: the PRCounterHandle of the counter to be added to.
|
---|
366 | **
|
---|
367 | ** value: the value to be added to the counter.
|
---|
368 | **
|
---|
369 | ** OUTPUTS: new value for counter.
|
---|
370 | **
|
---|
371 | ** RETURNS: void
|
---|
372 | **
|
---|
373 | ** RESTRICTIONS:
|
---|
374 | **
|
---|
375 | */
|
---|
376 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
377 | #define PR_ADD_TO_COUNTER(handle,value)\
|
---|
378 | PR_AddToCounter((handle),(value))
|
---|
379 | #else
|
---|
380 | #define PR_ADD_TO_COUNTER(handle,value)
|
---|
381 | #endif
|
---|
382 |
|
---|
383 | NSPR_API(void)
|
---|
384 | PR_AddToCounter(
|
---|
385 | PRCounterHandle handle,
|
---|
386 | PRUint32 value
|
---|
387 | );
|
---|
388 |
|
---|
389 |
|
---|
390 | /* -----------------------------------------------------------------------
|
---|
391 | ** FUNCTION: PR_SubtractFromCounter() -- A value is subtracted
|
---|
392 | ** from a counter.
|
---|
393 | **
|
---|
394 | ** DESCRIPTION:
|
---|
395 | ** Subtract a value from a counter.
|
---|
396 | **
|
---|
397 | ** INPUTS:
|
---|
398 | ** handle: the PRCounterHandle of the counter to be subtracted
|
---|
399 | ** from.
|
---|
400 | **
|
---|
401 | ** value: the value to be subtracted from the counter.
|
---|
402 | **
|
---|
403 | ** OUTPUTS: new value for counter
|
---|
404 | **
|
---|
405 | ** RETURNS: void
|
---|
406 | **
|
---|
407 | ** RESTRICTIONS:
|
---|
408 | **
|
---|
409 | */
|
---|
410 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
411 | #define PR_SUBTRACT_FROM_COUNTER(handle,value)\
|
---|
412 | PR_SubtractFromCounter((handle),(value))
|
---|
413 | #else
|
---|
414 | #define PR_SUBTRACT_FROM_COUNTER(handle,value)
|
---|
415 | #endif
|
---|
416 |
|
---|
417 | NSPR_API(void)
|
---|
418 | PR_SubtractFromCounter(
|
---|
419 | PRCounterHandle handle,
|
---|
420 | PRUint32 value
|
---|
421 | );
|
---|
422 |
|
---|
423 |
|
---|
424 | /* -----------------------------------------------------------------------
|
---|
425 | ** FUNCTION: PR_GetCounter() -- Retreive the value of a counter
|
---|
426 | **
|
---|
427 | ** DESCRIPTION:
|
---|
428 | ** Retreive the value of a counter.
|
---|
429 | **
|
---|
430 | ** INPUTS:
|
---|
431 | ** handle: the PR_CounterHandle of the counter to be retreived
|
---|
432 | **
|
---|
433 | ** OUTPUTS:
|
---|
434 | **
|
---|
435 | ** RETURNS: The value of the referenced counter
|
---|
436 | **
|
---|
437 | ** RESTRICTIONS:
|
---|
438 | **
|
---|
439 | */
|
---|
440 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
441 | #define PR_GET_COUNTER(counter,handle)\
|
---|
442 | (counter) = PR_GetCounter((handle))
|
---|
443 | #else
|
---|
444 | #define PR_GET_COUNTER(counter,handle) 0
|
---|
445 | #endif
|
---|
446 |
|
---|
447 | NSPR_API(PRUint32)
|
---|
448 | PR_GetCounter(
|
---|
449 | PRCounterHandle handle
|
---|
450 | );
|
---|
451 |
|
---|
452 | /* -----------------------------------------------------------------------
|
---|
453 | ** FUNCTION: PR_SetCounter() -- Replace the content of counter
|
---|
454 | ** with value.
|
---|
455 | **
|
---|
456 | ** DESCRIPTION: The contents of the referenced counter are
|
---|
457 | ** replaced by value.
|
---|
458 | **
|
---|
459 | ** INPUTS:
|
---|
460 | ** handle: the PRCounterHandle of the counter whose contents
|
---|
461 | ** are to be replaced.
|
---|
462 | **
|
---|
463 | ** value: the new value of the counter.
|
---|
464 | **
|
---|
465 | ** OUTPUTS:
|
---|
466 | **
|
---|
467 | ** RETURNS: void
|
---|
468 | **
|
---|
469 | ** RESTRICTIONS:
|
---|
470 | **
|
---|
471 | */
|
---|
472 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
473 | #define PR_SET_COUNTER(handle,value) PR_SetCounter((handle),(value))
|
---|
474 | #else
|
---|
475 | #define PR_SET_COUNTER(handle,value)
|
---|
476 | #endif
|
---|
477 |
|
---|
478 | NSPR_API(void)
|
---|
479 | PR_SetCounter(
|
---|
480 | PRCounterHandle handle,
|
---|
481 | PRUint32 value
|
---|
482 | );
|
---|
483 |
|
---|
484 |
|
---|
485 | /* -----------------------------------------------------------------------
|
---|
486 | ** FUNCTION: PR_FindNextCounterQname() -- Retreive the next QName counter
|
---|
487 | ** handle iterator
|
---|
488 | **
|
---|
489 | ** DESCRIPTION:
|
---|
490 | ** PR_FindNextCounterQname() retreives the first or next Qname
|
---|
491 | ** the counter data base, depending on the value of handle. When
|
---|
492 | ** handle is NULL, the function attempts to retreive the first
|
---|
493 | ** QName handle in the database. When handle is a handle previosly
|
---|
494 | ** retreived QName handle, then the function attempts to retreive
|
---|
495 | ** the next QName handle.
|
---|
496 | **
|
---|
497 | ** INPUTS:
|
---|
498 | ** handle: PRCounterHandle or NULL.
|
---|
499 | **
|
---|
500 | ** OUTPUTS: returned
|
---|
501 | **
|
---|
502 | ** RETURNS: PRCounterHandle or NULL when no more QName counter
|
---|
503 | ** handles are present.
|
---|
504 | **
|
---|
505 | ** RESTRICTIONS:
|
---|
506 | ** A concurrent PR_CreateCounter() or PR_DestroyCounter() may
|
---|
507 | ** cause unpredictable results.
|
---|
508 | **
|
---|
509 | ** A PRCounterHandle returned from this function may only be used
|
---|
510 | ** in another PR_FindNextCounterQname() function call; other
|
---|
511 | ** operations may cause unpredictable results.
|
---|
512 | **
|
---|
513 | */
|
---|
514 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
515 | #define PR_FIND_NEXT_COUNTER_QNAME(next,handle)\
|
---|
516 | (next) = PR_FindNextCounterQname((handle))
|
---|
517 | #else
|
---|
518 | #define PR_FIND_NEXT_COUNTER_QNAME(next,handle) NULL
|
---|
519 | #endif
|
---|
520 |
|
---|
521 | NSPR_API(PRCounterHandle)
|
---|
522 | PR_FindNextCounterQname(
|
---|
523 | PRCounterHandle handle
|
---|
524 | );
|
---|
525 |
|
---|
526 | /* -----------------------------------------------------------------------
|
---|
527 | ** FUNCTION: PR_FindNextCounterRname() -- Retreive the next RName counter
|
---|
528 | ** handle iterator
|
---|
529 | **
|
---|
530 | ** DESCRIPTION:
|
---|
531 | ** PR_FindNextCounterRname() retreives the first or next RNname
|
---|
532 | ** handle from the counter data base, depending on the
|
---|
533 | ** value of handle. When handle is NULL, the function attempts to
|
---|
534 | ** retreive the first RName handle in the database. When handle is
|
---|
535 | ** a handle previosly retreived RName handle, then the function
|
---|
536 | ** attempts to retreive the next RName handle.
|
---|
537 | **
|
---|
538 | ** INPUTS:
|
---|
539 | ** handle: PRCounterHandle or NULL.
|
---|
540 | ** qhandle: PRCounterHandle of a previously aquired via
|
---|
541 | ** PR_FIND_NEXT_QNAME_HANDLE()
|
---|
542 | **
|
---|
543 | ** OUTPUTS: returned
|
---|
544 | **
|
---|
545 | ** RETURNS: PRCounterHandle or NULL when no more RName counter
|
---|
546 | ** handles are present.
|
---|
547 | **
|
---|
548 | ** RESTRICTIONS:
|
---|
549 | ** A concurrent PR_CreateCounter() or PR_DestroyCounter() may
|
---|
550 | ** cause unpredictable results.
|
---|
551 | **
|
---|
552 | ** A PRCounterHandle returned from this function may only be used
|
---|
553 | ** in another PR_FindNextCounterRname() function call; other
|
---|
554 | ** operations may cause unpredictable results.
|
---|
555 | **
|
---|
556 | */
|
---|
557 | #if defined(DEBUG) || defined(FORCE_NSPR_COUNTERS)
|
---|
558 | #define PR_FIND_NEXT_COUNTER_RNAME(next,rhandle,qhandle)\
|
---|
559 | (next) = PR_FindNextCounterRname((rhandle),(qhandle))
|
---|
560 | #else
|
---|
561 | #define PR_FIND_NEXT_COUNTER_RNAME(next,rhandle,qhandle)
|
---|
562 | #endif
|
---|
563 |
|
---|
564 | NSPR_API(PRCounterHandle)
|
---|
565 | PR_FindNextCounterRname(
|
---|
566 | PRCounterHandle rhandle,
|
---|
567 | PRCounterHandle qhandle
|
---|
568 | );
|
---|
569 |
|
---|
570 | PR_END_EXTERN_C
|
---|
571 |
|
---|
572 | #endif /* prcountr_h___ */
|
---|