highlighter application  1.1
HCE project utils : highlighter
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 
20  {
21  // 0-15 bit flags in MorphChangeGrad
22  // 15 - topic bit
24  // 14,13 - case regulators:
27  // 8-12 - synonym id
30  // 7-0 - grammar category id
32  MCG_GRAMMAR_LOWEST_BIT_NUMBER = 0, // MUST NOT be changed
33  // MCG constants for the whole value
35  };
36 
37 
38  static const unsigned long MCG_NUM = 16;
39 
40 
41  template<size_t N>
43  {
44  private:
45  std::bitset<N> _synonymIdMask;
46  std::bitset<N> _grammarCategoryIdMask;
47  public:
50  _synonymIdMask(std::string("0001111100000000")),
51  _grammarCategoryIdMask(std::string("0000000011111111")) {}
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