My Project
core
osl
bits
squareCompressor.cc
Go to the documentation of this file.
1
/* squareCompressor.cc
2
*/
3
#include "
osl/bits/squareCompressor.h
"
4
#include "
osl/basic_type.h
"
5
#include <algorithm>
6
namespace
osl
7
{
8
CArray<signed char, Square::SIZE>
SquareCompressor::positionToIndex
;
9
10
class
SquareCompressor::Initializer
11
{
12
public
:
13
Initializer
()
14
{
15
std::fill(
positionToIndex
.
begin
(),
positionToIndex
.
end
(), -1);
16
17
int
cur = 0;
18
positionToIndex
[0] = cur++;
19
for
(
int
x=1; x<=9; ++x)
20
{
21
for
(
int
y=1; y<=9; ++y)
22
{
23
positionToIndex
[
Square
(x,y).
index
()] = cur++;
24
}
25
}
26
assert(cur == 82);
27
}
28
};
29
30
namespace
31
{
32
SquareCompressor::Initializer
init;
33
}
// anonymous namespace
34
}
35
36
/* ------------------------------------------------------------------------- */
37
// ;;; Local Variables:
38
// ;;; mode:c++
39
// ;;; c-basic-offset:2
40
// ;;; End:
basic_type.h
osl::CArray::end
iterator end()
Definition
container.h:65
osl::CArray::begin
iterator begin()
Definition
container.h:64
osl::SquareCompressor::Initializer
Definition
squareCompressor.cc:11
osl::SquareCompressor::Initializer::Initializer
Initializer()
Definition
squareCompressor.cc:13
osl::Square
Definition
basic_type.h:532
osl::Square::index
unsigned int index() const
Definition
basic_type.h:572
osl
Definition
additionalEffect.h:6
squareCompressor.h
osl::SquareCompressor::positionToIndex
static CArray< signed char, Square::SIZE > positionToIndex
本当はconst にしたいけど初期化が手間なので後回し
Definition
squareCompressor.h:19
Generated by
1.9.8