ver4_dict_constants.h revision 2ac934296c0571ea252f3fb5a23fba29eb89c666
1/*
2 * Copyright (C) 2013, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef LATINIME_VER4_DICT_CONSTANTS_H
18#define LATINIME_VER4_DICT_CONSTANTS_H
19
20#include "defines.h"
21
22#include <cstddef>
23
24namespace latinime {
25
26// TODO: Create PtConstants under the pt_common and move some constant values there.
27// Note that there are corresponding definitions in FormatSpec.java.
28class Ver4DictConstants {
29 public:
30    static const char *const BODY_FILE_EXTENSION;
31    static const char *const HEADER_FILE_EXTENSION;
32    static const int MAX_DICTIONARY_SIZE;
33    static const int MAX_DICT_EXTENDED_REGION_SIZE;
34
35    static const size_t NUM_OF_CONTENT_BUFFERS_IN_BODY_FILE;
36    static const int TRIE_BUFFER_INDEX;
37    static const int TERMINAL_ADDRESS_LOOKUP_TABLE_BUFFER_INDEX;
38    static const int PROBABILITY_BUFFER_INDEX;
39    static const int BIGRAM_BUFFERS_INDEX;
40    static const int SHORTCUT_BUFFERS_INDEX;
41
42    static const int NOT_A_TERMINAL_ID;
43    static const int PROBABILITY_SIZE;
44    static const int FLAGS_IN_PROBABILITY_FILE_SIZE;
45    static const int TERMINAL_ADDRESS_TABLE_ADDRESS_SIZE;
46    static const int NOT_A_TERMINAL_ADDRESS;
47    static const int TERMINAL_ID_FIELD_SIZE;
48    static const int TIME_STAMP_FIELD_SIZE;
49    static const int WORD_LEVEL_FIELD_SIZE;
50    static const int WORD_COUNT_FIELD_SIZE;
51
52    static const int BIGRAM_ADDRESS_TABLE_BLOCK_SIZE;
53    static const int BIGRAM_ADDRESS_TABLE_DATA_SIZE;
54    static const int SHORTCUT_ADDRESS_TABLE_BLOCK_SIZE;
55    static const int SHORTCUT_ADDRESS_TABLE_DATA_SIZE;
56
57    static const int BIGRAM_FLAGS_FIELD_SIZE;
58    static const int BIGRAM_TARGET_TERMINAL_ID_FIELD_SIZE;
59    static const int INVALID_BIGRAM_TARGET_TERMINAL_ID;
60    static const int BIGRAM_IS_LINK_MASK;
61    static const int BIGRAM_PROBABILITY_MASK;
62    // Used when bigram list has time stamp.
63    static const int BIGRAM_LARGE_PROBABILITY_FIELD_SIZE;
64
65    static const int SHORTCUT_FLAGS_FIELD_SIZE;
66    static const int SHORTCUT_PROBABILITY_MASK;
67    static const int SHORTCUT_HAS_NEXT_MASK;
68
69 private:
70    DISALLOW_IMPLICIT_CONSTRUCTORS(Ver4DictConstants);
71
72    static const size_t NUM_OF_BUFFERS_FOR_SINGLE_DICT_CONTENT;
73    static const size_t NUM_OF_BUFFERS_FOR_SPARSE_TABLE_DICT_CONTENT;
74};
75} // namespace latinime
76#endif /* LATINIME_VER4_DICT_CONSTANTS_H */
77