Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
include
osl
search
lRUMoves.h
Go to the documentation of this file.
1
/* lRUMoves.h
2
*/
3
#ifndef OSL_SEARCH_LRUMOVES_H
4
#define OSL_SEARCH_LRUMOVES_H
5
6
#include "
osl/move.h
"
7
#include "
osl/misc/carray.h
"
8
#ifdef OSL_SMP
9
# include "
osl/misc/lightMutex.h
"
10
#endif
11
12
namespace
osl
13
{
14
namespace
search
15
{
16
class
LRUMoves
17
{
18
typedef
CArray<Move, 2>
moves_t
;
19
moves_t
moves
;
20
#ifdef OSL_SMP
21
typedef
osl::misc::LightMutex
Mutex;
22
mutable
Mutex mutex;
23
#endif
24
public
:
25
LRUMoves
() {}
26
LRUMoves
(
const
LRUMoves
& src)
27
:
moves
(src.
moves
)
28
{
29
}
30
LRUMoves
&
operator=
(
const
LRUMoves
& src)
31
{
32
if
(
this
!= &src)
33
moves
= src.
moves
;
34
return
*
this
;
35
}
36
37
void
clear
()
38
{
39
#ifdef OSL_SMP
40
SCOPED_LOCK
(lk,mutex);
41
#endif
42
moves
.fill(
Move::INVALID
());
43
}
44
void
setMove
(
Move
best_move)
45
{
46
#ifdef OSL_SMP
47
SCOPED_LOCK
(lk,mutex);
48
#endif
49
if
(best_move.
isNormal
() &&
moves
[0] != best_move)
50
{
51
moves
[1] =
moves
[0];
52
moves
[0] = best_move;
53
}
54
}
55
const
Move
operator[]
(
size_t
i)
const
56
{
57
#ifdef OSL_USE_RACE_DETECTOR
58
SCOPED_LOCK
(lk,mutex);
59
#endif
60
return
moves
[i];
61
}
62
static
size_t
size
() {
return
moves_t::size(); }
63
};
64
}
65
}
// namespace osl
66
67
#endif
/* OSL_SEARCH_LRUMOVES_H */
68
// ;;; Local Variables:
69
// ;;; mode:c++
70
// ;;; c-basic-offset:2
71
// ;;; End:
Generated on Sun Jul 21 2013 13:37:24 by
1.8.4