Loading...
Searching...
No Matches
LFUCachePolicy.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file LFUCachePolicy.h
22
23 \brief This class is used to implement the LFU cache policy.
24*/
25
26#ifndef __TERRALIB_GRAPH_INTERNAL_LFUCACHEPOLICY_H
27#define __TERRALIB_GRAPH_INTERNAL_LFUCACHEPOLICY_H
28
29// Terralib Includes
30#include "../Config.h"
31#include "AbstractCachePolicy.h"
32
33// STL Includes
34#include <map>
35
36namespace te
37{
38 namespace graph
39 {
40 /*!
41 \class LFUCachePolicy
42
43 \brief This class is used to implement the LFU cache policy.
44
45 \sa AbstractCachePolicy
46 */
47
49 {
50 public:
51
52 /*! \brief Default constructor. */
54
55 /*! \brief Virtual destructor. */
56 virtual ~LFUCachePolicy();
57
58
59 /** @name Access Methods
60 * Method used to access the cache policy
61 */
62 //@{
63
64 /*!
65 \brief Function used to add a new index to be controlled.
66
67 \param value Object index attribute
68
69 */
70 virtual void added(int value);
71
72 /*!
73 \brief Function used to inform that an index must be updated
74
75 \param value Object index attribute
76
77 */
78 virtual void update(int value);
79
80 /*!
81 \brief Function used to check what index has to be removed from the cache
82
83 \param value Object index attribute
84
85 */
86 virtual void toRemove(int& value);
87
88 /*!
89 \brief Function used to inform that an index was accessed.
90
91 \param value Object index attribute
92
93 */
94 virtual void accessed(int value);
95
96 //@}
97
98 protected:
99
100 std::map<int, double> m_LFU; // This map is used to keep the least frequently used order - LFU policy
101 };
102
103 } // end namespace graph
104} // end namespace te
105
106#endif // __TERRALIB_GRAPH_INTERNAL_LFUCACHEPOLICY_H
This class is used to set the main functions of a cache policy.
This class is used to set the main functions of a cache policy.
This class is used to implement the LFU cache policy.
virtual void toRemove(int &value)
Function used to check what index has to be removed from the cache.
virtual ~LFUCachePolicy()
Virtual destructor.
std::map< int, double > m_LFU
virtual void accessed(int value)
Function used to inform that an index was accessed.
LFUCachePolicy()
Default constructor.
virtual void update(int value)
Function used to inform that an index must be updated.
virtual void added(int value)
Function used to add a new index to be controlled.
TerraLib.
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:178