GitHub Actions: Try MSVC builds with /std:c++17 and 20
[ACE_TAO.git] / ACE / ace / Cleanup_Strategies_T.cpp
blob53cf0b876ac1049f75dd9a2df8bfa86e6e7a21ed
1 #ifndef ACE_CLEANUP_STRATEGIES_T_CPP
2 #define ACE_CLEANUP_STRATEGIES_T_CPP
4 #include "ace/Cleanup_Strategies_T.h"
6 #if !defined (ACE_LACKS_PRAGMA_ONCE)
7 #pragma once
8 #endif /* ACE_LACKS_PRAGMA_ONCE */
10 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
12 ////////////////////////////////////////////////////////////////////////////
14 template <class KEY, class VALUE, class CONTAINER>
15 ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>::~ACE_Cleanup_Strategy (void)
19 template <class KEY, class VALUE, class CONTAINER> int
20 ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &container,
21 KEY *key,
22 VALUE *)
24 return container.unbind (*key);
27 ////////////////////////////////////////////////////////////////////////////
29 template <class KEY, class VALUE, class CONTAINER> int
30 ACE_Recyclable_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (
31 CONTAINER &container,
32 KEY *key,
33 VALUE *)
35 VALUE value;
37 if (container.unbind (*key, value) == -1)
38 return -1;
40 value.first->recycler (0, 0);
42 value.first->close ();
44 return 0;
47 /////////////////////////////////////////////////////////////////////////////
49 template <class KEY, class VALUE, class CONTAINER> int
50 ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy<KEY,
51 VALUE,
52 CONTAINER>::cleanup (
53 CONTAINER &,
54 KEY *,
55 VALUE *value)
57 return value->first ()->handle_close_i ();
60 ////////////////////////////////////////////////////////////////////////////
62 template <class KEY, class VALUE, class CONTAINER> int
63 ACE_Handler_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (
64 CONTAINER &container,
65 KEY *key,
66 VALUE *value)
68 // Remove the item from cache only if the handler isnt in use.
69 if ((*value)->active () == 0)
71 (*value)->close ();
73 if (container.unbind (*key) == -1)
74 return -1;
78 return 0;
81 ////////////////////////////////////////////////////////////////////////////
83 template <class KEY, class VALUE, class CONTAINER> int
84 ACE_Null_Cleanup_Strategy<KEY, VALUE, CONTAINER>::cleanup (CONTAINER &,
85 KEY *,
86 VALUE *)
88 return 0;
91 ACE_END_VERSIONED_NAMESPACE_DECL
93 #endif /* ACE_CLEANUP_STRATEGIES_T_CPP */