blob: df9673498c1f11f6bcec1d3fb238877e1d3407cf (
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
|
/* -*- C++ -*- */
// $Id$
// ============================================================================
//
// = LIBRARY
// ace
//
// = FILENAME
// Caching_Strategy_Utility_T.h
//
// = AUTHOR
// Kirthika Parameswaran <kirthika@cs.wustl.edu>
//
// ============================================================================
#ifndef CACHING_STRATEGY_UTILITY_H
#define CACHING_STRATEGY_UTILITY_H
#include "ace/OS.h"
#include <math.h>
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#define ACE_LACKS_PRAGMA_ONCE
#endif /* ACE_LACKS_PRAGMA_ONCE */
// Forward declaration
template <class CONTAINER>
class ACE_Cleanup_Strategy;
template <class CONTAINER, class ATTRIBUTES>
class ACE_Caching_Strategy_Utility
{
// = TITLE
// Defines a helper class for the Caching Strategies.
//
// = DESCRIPTION
// This class defines the methods commonly used by the
// different caching strategies. For instance: clear_cache ()
// method which decides and purges the entry from the container.
public:
// = Traits.
typedef ACE_TYPENAME CONTAINER::KEY KEY;
typedef ACE_TYPENAME CONTAINER::VALUE VALUE;
int clear_cache (CONTAINER &container,
ACE_Cleanup_Strategy<CONTAINER> *cleanup_s,
const unsigned int purge_percent,
unsigned int &entries);
// Purge entries from the <container>. The <entries> had to be
// passed by refernce as it wuold reduce on cleanup.
void minimum (CONTAINER &container,
KEY *&key,
VALUE *&value);
// Find the entry with minimum caching attributes.
};
#if defined (__ACE_INLINE__)
#include "ace/Caching_Strategy_Utility_T.i"
#endif /* __ACE_INLINE__ */
#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "ace/Caching_Strategy_Utility_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation "ace/Caching_Strategy_Utility_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#endif /* CACHING_STRATEGY_UTILITY_H */
|