HCE project C++ developers source code library
1.1.1
HCE project developer library
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
MorphChangeGradBitset.hpp
Go to the documentation of this file.
1
8
#ifndef _MORPH_CHANGE_GRAD_BITSET_HPP
9
#define _MORPH_CHANGE_GRAD_BITSET_HPP
10
11
#include <string>
12
13
#include "
BitsetBase.hpp
"
14
15
namespace
HCE
16
{
17
18
19
enum
MCG_Consistency
20
{
21
// 0-15 bit flags in MorphChangeGrad
22
// 15 - topic bit
23
MCG_TOPIC_BIT_NUMBER
= 15,
24
// 14,13 - case regulators:
25
MCG_START_UPPERCASE
= 14,
26
MCG_OTHER_UPPERCASE
= 13,
27
// 8-12 - synonym id
28
MCG_SYNONYM_BIT_SIZE
= 5,
29
MCG_SYNONYM_LOWEST_BIT_NUMBER
= 8,
30
// 7-0 - grammar category id
31
MCG_GRAMMAR_BIT_SIZE
= 8,
32
MCG_GRAMMAR_LOWEST_BIT_NUMBER
= 0,
// MUST NOT be changed
33
// MCG constants for the whole value
34
MCG_OBSCENE_WORD_VALUE
= 1 <<
MCG_TOPIC_BIT_NUMBER
,
35
};
36
37
38
static
const
unsigned
long
MCG_NUM = 16;
39
40
41
template
<
size_t
N>
42
class
MorphChangeGradBitset
:
public
BitsetBase
<N>
43
{
44
private
:
45
std::bitset<N> _synonymIdMask;
46
std::bitset<N> _grammarCategoryIdMask;
47
public
:
48
MorphChangeGradBitset<N>
() :
50
_synonymIdMask(std::string(
"0001111100000000"
)),
51
_grammarCategoryIdMask(std::string(
"0000000011111111"
)) {}
52
~
MorphChangeGradBitset<N>
() {}
53
public
:
54
inline
const
bool
isTopicBitSet
()
const
{
return
BitsetBase<N>::_bitset
.test(
MCG_TOPIC_BIT_NUMBER
); }
55
inline
const
bool
isStartUpperCaseBitSet
()
const
{
return
BitsetBase<N>::_bitset
.test(
MCG_START_UPPERCASE
); }
56
inline
const
bool
isOtherUpperCaseBitSet
()
const
{
return
BitsetBase<N>::_bitset
.test(
MCG_OTHER_UPPERCASE
); }
57
inline
const
unsigned
long
getSynonimIdBitSet
()
const
{
return
((
BitsetBase<N>::_bitset
&_synonymIdMask)>>
MCG_SYNONYM_LOWEST_BIT_NUMBER
).to_ulong(); }
58
inline
const
unsigned
long
getGrammarCategoryIdBitSet
()
const
{
return
((
BitsetBase<N>::_bitset
&_grammarCategoryIdMask)>>
MCG_GRAMMAR_LOWEST_BIT_NUMBER
).to_ulong(); }
59
};
60
61
62
}
63
64
65
#endif
sources
refine
src
MorphChangeGradBitset.hpp
Generated on Mon Jan 13 2014 13:08:38 for HCE project C++ developers source code library by
1.8.1.2