summaryrefslogtreecommitdiff
path: root/ace/Cleanup_Strategies_T.h
blob: 1dd43239e270fd4067d86a7358cc989ab7d7f784 (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/* -*- C++ -*- */
// $Id$

// ============================================================================
//
// = LIBRARY
//    ace
//
// = FILENAME
//    Cleanup_Strategies_T.h
//
// = AUTHOR
//    Kirthika Parameswaran <kirthika@cs.wustl.edu>
//
// ============================================================================

#ifndef CLEANUP_STRATEGIES_H
#define CLEANUP_STRATEGIES_H
#include "ace/pre.h"

#include "ace/OS.h"

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

// For linkers that cant grok long names.
#define ACE_Cleanup_Strategy ACLE

template <class KEY, class VALUE, class CONTAINER>
class ACE_Cleanup_Strategy
{
  // = TITLE
  //     Defines a default strategy to be followed for cleaning up
  //     entries from a map which is the container.
  //
  // = DESCRIPTION
  //     By default the entry to be cleaned up is removed from the
  //     container.

public:

  virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
  // The method which will do the cleanup of the entry in the container.
};

//////////////////////////////////////////////////////////////////////
#define ACE_Recyclable_Handler_Cleanup_Strategy ARHCLE

template <class KEY, class VALUE, class CONTAINER>
class ACE_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
{
  // = TITLE
  //     Defines a strategy to be followed for cleaning up
  //     entries which are svc_handlers from a container.
  //
  // = DESCRIPTION
  //     The entry to be cleaned up is removed from the container.
  //     Here, since we are dealing with svc_handlers specifically, we
  //     perform a couple of extra operations. Note: To be used when
  //     the handler is recyclable.

public:

  virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
  // The method which will do the cleanup of the entry in the container.
};

//////////////////////////////////////////////////////////////////////
#define ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy ARRHCLE

template <class KEY, class VALUE, class CONTAINER>
class ACE_Refcounted_Recyclable_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
{
  // = TITLE
  //     Defines a strategy to be followed for cleaning up
  //     entries which are svc_handlers from a container.
  //
  // = DESCRIPTION
  //     The entry to be cleaned up is removed from the container.
  //     Here, since we are dealing with recyclable svc_handlers with
  //     addresses which are refcountable specifically, we perform a
  //     couple of extra operations and do so without any locking. 

public:

  virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
  // The method which will do the cleanup of the entry in the container.
};

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

template <class KEY, class VALUE, class CONTAINER>
class ACE_Handler_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
{
  // = TITLE
  //     Defines a strategy to be followed for cleaning up
  //     entries which are svc_handlers from a container.
  //
  // = DESCRIPTION
  //     The entry to be cleaned up is removed from the container.
  //     Here, since we are dealing with svc_handlers specifically, we
  //     perform a couple of extra operations. Note: This cleanup strategy
  //     should be used in the case when the handler has the caching
  //     attributes.

public:

  virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
  // The method which will do the cleanup of the entry in the container.
};

//////////////////////////////////////////////////////////////////////
#define ACE_Null_Cleanup_Strategy ANCLE

template <class KEY, class VALUE, class CONTAINER>
class ACE_Null_Cleanup_Strategy : public ACE_Cleanup_Strategy<KEY, VALUE, CONTAINER>
{
  // = TITLE
  //     Defines a do-nothing implementation of the cleanup strategy.
  //
  // = DESCRIPTION
  //     This class simply does nothing at all! Can be used to nullify
  //     the effect of the Cleanup Strategy.

public:

  virtual int cleanup (CONTAINER &container, KEY *key, VALUE *value);
  // The dummy cleanup method.
};

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Cleanup_Strategies_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Cleanup_Strategies_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

#include "ace/post.h"
#endif /* CLEANUP_STRATEGIES_H */