summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Notify_ID_Pool_T.cpp
blob: 988ce522565e786db285f018a7f5cc8459c1b44f (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
// $Id$

#ifndef TAO_NOTIFY_ID_POOL_T_C
#define TAO_NOTIFY_ID_POOL_T_C

#include "Notify_ID_Pool_T.h"

#if !defined (__ACE_INLINE__)
#include "Notify_ID_Pool_T.i"
#endif /* __ACE_INLINE__ */

template <class ID_TYPE>
TAO_Notify_ID_Pool<ID_TYPE>::TAO_Notify_ID_Pool (void)
  : id_ (0)
{
  // No-Op.
}

template <class ID_TYPE>
TAO_Notify_ID_Pool<ID_TYPE>::~TAO_Notify_ID_Pool ()
{
  // No-Op.
}

template <class ID_TYPE> ID_TYPE
TAO_Notify_ID_Pool<ID_TYPE>::get (void)
{
  return ++this->id_;
}

template <class ID_TYPE> void
TAO_Notify_ID_Pool<ID_TYPE>::put (ID_TYPE id )
{
  this->active_list_.remove (id);
}

template <class ID_TYPE> void
TAO_Notify_ID_Pool<ID_TYPE>::next (void)
{
  this->active_list_.insert (this->id_);
}

template <class ID_TYPE, class ID_TYPE_SEQ>
TAO_Notify_ID_Pool_Ex<ID_TYPE, ID_TYPE_SEQ>::TAO_Notify_ID_Pool_Ex (void)
{
}

template <class ID_TYPE, class ID_TYPE_SEQ>
TAO_Notify_ID_Pool_Ex<ID_TYPE, ID_TYPE_SEQ>::~TAO_Notify_ID_Pool_Ex ()
{
}

template <class ID_TYPE, class ID_TYPE_SEQ> ID_TYPE_SEQ*
TAO_Notify_ID_Pool_Ex<ID_TYPE, ID_TYPE_SEQ>::get_sequence (CORBA::Environment & ACE_TRY_ENV)
{
  // Figure out the length of the list.
  size_t len = this->active_list_.size ();

  ID_TYPE_SEQ* list;

  // Allocate the list of <len> length.
  ACE_NEW_THROW_EX (list,
                    ID_TYPE_SEQ (len),
                    CORBA::NO_MEMORY ());
  ACE_CHECK_RETURN (0);

  list->length (len);

  ACE_Unbounded_Set_Iterator<ID_TYPE> iter (this->active_list_);
  ID_TYPE* id_ret;

  int i = 0;
  for (iter.first (); iter.next (id_ret) == 1; iter.advance ())
    (*list)[i++] = *id_ret;

  return list;
}

#endif /* TAO_NOTIFY_ID_POOL_T_C */