summaryrefslogtreecommitdiff
path: root/ace/Cleanup_Strategies_T.cpp
blob: b54db63adf3b285b54f0a2ba4babd62930127d6e (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
//$Id$

#ifndef CLEANUP_STRATEGIES_T_C
#define CLEANUP_STRATEGIES_T_C

#define ACE_BUILD_DLL

#include "ace/Cleanup_Strategies_T.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#define ACE_LACKS_PRAGMA_ONCE
#endif /* ACE_LACKS_PRAGMA_ONCE */

#if defined (ACE_LACKS_INLINE_FUNCTIONS)
#include "ace/Cleanup_Strategies_T.i"
#endif /* ACE_LACKS_INLINE_FUNCTIONS */

ACE_RCSID(ace, Cleanup_Strategies_T, "$Id$")

template <class KEY, class VALUE, class CONTAINER>
ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>::~ACE_Cleanup_Strategy (void)
{
}

////////////////////////////////////////////////////////////////////////////

template <class KEY, class VALUE, class CONTAINER> int
ACE_Default_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, 
                                                              KEY *key, 
                                                              VALUE *value)
{
  ACE_UNUSED_ARG (value);

  return container.unbind (*key);
}

////////////////////////////////////////////////////////////////////////////

template <class KEY, class VALUE, class CONTAINER> int
ACE_Svc_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, 
                                                          KEY *key, 
                                                          VALUE *value)
{
  (value->first ())->recycler (0, 0);

  (value->first ())->close ();
  
  if (container.unbind (*key) == -1)
    return -1;
   
  return 0; 
}

/////////////////////////////////////////////////////////////////////////////
template <class KEY, class VALUE, class CONTAINER> int
ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, 
                                                              KEY *key, 
                                                              VALUE *value)
{
  // Remove the item from cache only if the handler isnt in use.
  if ((*value)->active () == 0)
    {
      (*value)->close ();

      if (container.unbind (*key) == -1)
        return -1;

    }

  return 0;

}

////////////////////////////////////////////////////////////////////////////
template <class KEY, class VALUE, class CONTAINER> int
ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container, 
                                                           KEY *key, 
                                                           VALUE *value)
{

  ACE_UNUSED_ARG (container);
  ACE_UNUSED_ARG (key);
  ACE_UNUSED_ARG (value);

  return 0;
}

#endif /* CLEANUP_STRATEGIES_T_C */