ScummVM API documentation
cache.h
1
2
/* ScummVM - Graphic Adventure Engine
3
*
4
* ScummVM is the legal property of its developers, whose names
5
* are too numerous to list here. Please refer to the COPYRIGHT
6
* file distributed with this source distribution.
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, see <http://www.gnu.org/licenses/>.
20
*
21
*/
22
23
#ifndef BAGEL_BOFLIB_CACHE_H
24
#define BAGEL_BOFLIB_CACHE_H
25
26
#include "bagel/boflib/llist.h"
27
#include "bagel/boflib/stdinc.h"
28
29
namespace
Bagel
{
30
31
class
CCache
:
private
CLList
{
32
private
:
33
virtual
bool
alloc() = 0;
// These pure-virtuals MUST be defined
34
virtual
void
free() = 0;
// in the derived class.
35
36
static
CCache
*_pCacheList;
// Linked cache list
37
static
uint32 _lOldest;
// Current oldest object in cache
38
static
uint32 _lYoungest;
// Current youngest object in cache
39
static
uint16 _nEntries;
// Number of CCache Objects
40
41
uint32 _lAge;
// Age of this object
42
int
_nLockCount;
// # of locks held on this object
43
bool
_bCached;
// true if object is in the cache
44
45
bool
_bValid;
// true if this object is valid
46
47
public
:
51
CCache
();
52
56
virtual
~CCache
();
57
61
void
load
();
62
66
bool
release
();
67
68
void
lock() {
69
_nLockCount++;
70
load
();
71
}
72
void
unlock() {
73
_nLockCount--;
74
}
75
bool
isLocked() {
76
return
(_nLockCount > 0);
77
}
78
82
static
void
initialize
();
83
87
static
bool
flush
();
88
96
static
bool
optimize
(uint32 lRequestedFreeSpace);
97
};
98
99
}
// namespace Bagel
100
101
#endif
Bagel::CCache
Definition:
cache.h:31
Bagel::CCache::optimize
static bool optimize(uint32 lRequestedFreeSpace)
Bagel::CCache::flush
static bool flush()
Bagel::CCache::load
void load()
Bagel::CCache::release
bool release()
Bagel::CCache::~CCache
virtual ~CCache()
Bagel::CCache::CCache
CCache()
Bagel
Definition:
bagel.h:31
Bagel::CCache::initialize
static void initialize()
Bagel::CLList
Definition:
llist.h:31
engines
bagel
boflib
cache.h
Generated on Sat Aug 31 2024 09:08:57 for ScummVM API documentation by
1.8.13