blob: e7df736ca07158fc30bbf1f48a4f4c02a745bf46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
//=============================================================================
/**
* @file Notify_ID_Pool_T.h
*
* $Id$
*
* A class to generate ID's.
*
*
* @author Pradeep Gore <pradeep@cs.wustl.edu>
*/
//=============================================================================
#ifndef TAO_NOTIFY_ID_POOL_T_H
#define TAO_NOTIFY_ID_POOL_T_H
#include "ace/pre.h"
#include "ace/OS.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Containers_T.h"
#include "orbsvcs/CosNotifyChannelAdminS.h"
/**
* @class TAO_Notify_ID_Pool
*
* @brief ID_Pool
*
* This class is used by factories that need to associate id's with the
* objects that they create.
* The very first id generated is always 0.The condition is necessary to
* support ids for default objects that require an id of 0.
*/
template <class ID_TYPE>
class TAO_Notify_ID_Pool
{
public:
/// Constructor.
TAO_Notify_ID_Pool (void);
/// Destructor.
~TAO_Notify_ID_Pool ();
/// Returns the current id.
ID_TYPE get (void);
/// Return the id back.
void put (ID_TYPE id);
/// The current id is moved to the active_list_.
void next (void);
protected:
/// The next available id.
ID_TYPE id_;
/// List of ids currently in use by clients of this class.
ACE_Unbounded_Set <ID_TYPE> active_list_;
};
/**
* @class TAO_Notify_ID_Pool_Ex
*
* @brief TAO_Notify_ID_Pool_Ex
*
* Extends the TAO_Notify_ID_Pool with a method to convert the active_list
* into a sequence type.
*/
template <class ID_TYPE, class ID_TYPE_SEQ>
class TAO_Notify_ID_Pool_Ex : public TAO_Notify_ID_Pool <ID_TYPE>
{
public:
TAO_Notify_ID_Pool_Ex (void);
~TAO_Notify_ID_Pool_Ex ();
/// Get a list of all ids in use.
/// Essentially converts the <active_list_> to a Sequence.
ID_TYPE_SEQ* get_sequence (ACE_ENV_SINGLE_ARG_DECL);
};
#if defined (__ACE_INLINE__)
#include "Notify_ID_Pool_T.i"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "Notify_ID_Pool_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Notify_ID_Pool_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#include "ace/post.h"
#endif /* TAO_NOTIFY_ID_POOL_T_H */
|