iRoCS Toolbox
1.1.0
src
libsvmtl
Cache.hh
Go to the documentation of this file.
1
/**************************************************************************
2
*
3
* Copyright (C) 2004-2015 Olaf Ronneberger, Florian Pigorsch, Jörg Mechnich,
4
* Thorsten Falk
5
*
6
* Image Analysis Lab, University of Freiburg, Germany
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation; either version 3 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
17
*
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software Foundation,
20
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
*
22
**************************************************************************/
23
24
/**************************************************************************
25
** Title: Kernel cache
26
** $RCSfile$
27
** $Revision: 2825 $$Name$
28
** $Date: 2009-09-15 17:04:15 +0200 (Tue, 15 Sep 2009) $
29
** Copyright: LGPL $Author: ronneber $
30
** Description:
31
**
32
**
33
**
34
**-------------------------------------------------------------------------
35
**
36
** $Log$
37
** Revision 1.2 2007/01/10 09:50:26 fehr
38
** cache size bug sixed
39
**
40
** Revision 1.1 2004/08/26 08:36:58 ronneber
41
** initital import
42
**
43
** Revision 1.1 2002/03/26 12:44:02 ronneber
44
** restructured for autoconf
45
**
46
** Revision 1.3 2002/03/13 13:53:42 pigorsch
47
** * put sources in Cache.cc
48
** * added comments
49
**
50
** Revision 1.2 2002/01/28 13:40:40 pigorsch
51
** * fixed license
52
**
53
** Revision 1.1 2001/12/11 11:03:00 pigorsch
54
** Initial Revision
55
**
56
**
57
**
58
**************************************************************************/
59
60
#ifndef CACHE_HH
61
#define CACHE_HH
62
63
#ifdef HAVE_CONFIG_H
64
#include <config.hh>
65
#endif
66
67
#include "
svm_defines.hh
"
68
#include "
SVMError.hh
"
69
70
namespace
svt
71
{
72
//
73
// Kernel Cache
74
//
75
// l is the number of total data items
76
// size is the cache size limit in bytes
77
//
78
class
Cache
79
{
80
public
:
81
Cache
(
long
l,
long
size);
82
~Cache
();
83
private
:
84
// forbid copying of Cache
85
Cache
(
const
Cache
&) {}
86
void
operator=(
const
Cache
&) {}
87
public
:
88
89
90
// request data [0,len)
91
// return some position p where [p,len) need to be filled
92
// (p >= len if nothing needs to be filled)
93
long
get_data
(
const
long
index,
Qfloat
**data,
long
len);
94
void
swap_index
(
long
i,
long
j);
// future_option
95
private
:
96
long
l;
97
long
size;
98
struct
head_t
99
{
100
head_t *prev, *next;
// a cicular list
101
Qfloat
*data;
102
long
len;
// data[0,len) is cached in this entry
103
};
104
105
head_t* head;
106
head_t lru_head;
107
void
lru_delete(head_t *h);
108
void
lru_insert(head_t *h);
109
};
110
}
111
112
#endif
svt::Cache
Definition:
Cache.hh:78
svt::Cache::get_data
long get_data(const long index, Qfloat **data, long len)
svt::Cache::swap_index
void swap_index(long i, long j)
svt
Definition:
adjustUniqueIDs.hh:61
SVMError.hh
svt::Cache::~Cache
~Cache()
svm_defines.hh
svt::Cache::Cache
Cache(long l, long size)
Qfloat
float Qfloat
Definition:
svm_defines.hh:66
Generated on Wed Jul 31 2019 12:33:02 for iRoCS Toolbox by
1.8.13