| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#ifndef BALL_MOLMEC_COMMON_RULEEVALUATOR_H |
| 10 |
#define BALL_MOLMEC_COMMON_RULEEVALUATOR_H |
| 11 |
|
| 12 |
#ifndef BALL_DATATYPE_STRINGHASHMAP_H |
| 13 |
# include <BALL/DATATYPE/stringHashMap.h> |
| 14 |
#endif |
| 15 |
|
| 16 |
#ifndef BALL_KERNEL_EXPRESSION_H |
| 17 |
# include <BALL/KERNEL/expression.h> |
| 18 |
#endif |
| 19 |
|
| 20 |
#include <list> |
| 21 |
#include <utility> |
| 22 |
|
| 23 |
namespace BALL |
| 24 |
{ |
| 25 |
class INIFile; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
class BALL_EXPORT RuleEvaluator |
| 38 |
{ |
| 39 |
public: |
| 40 |
|
| 41 |
BALL_CREATE(RuleEvaluator) |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
typedef std::list<std::pair<Expression, String> > RuleList; |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
typedef StringHashMap<RuleList> RuleMap; |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
RuleEvaluator() ; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
RuleEvaluator(INIFile& file, const String& prefix) ; |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
RuleEvaluator(const RuleEvaluator& evaluator) ; |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
virtual ~RuleEvaluator() ; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
bool initialize(INIFile& file, const String& prefix) ; |
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
const String& getPrefix() const ; |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
void setPrefix(const String& prefix) ; |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
const RuleEvaluator& operator = (const RuleEvaluator& evaluator) |
| 101 |
; |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
virtual void clear() ; |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
String operator () (const Atom& atom) const ; |
| 118 |
|
| 119 |
|
| 120 |
bool operator == (const RuleEvaluator& evaluator) const ; |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 129 |
bool isValid() const ; |
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
void dump(std::ostream& s = std::cout, Size indent_depth = 0) const |
| 134 |
; |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
protected: |
| 139 |
|
| 140 |
|
| 141 |
void extractSection_(INIFile& file, const String& symbol) ; |
| 142 |
|
| 143 |
|
| 144 |
String prefix_; |
| 145 |
|
| 146 |
|
| 147 |
RuleMap rule_map_; |
| 148 |
|
| 149 |
|
| 150 |
bool valid_; |
| 151 |
|
| 152 |
}; |
| 153 |
} |
| 154 |
|
| 155 |
|
| 156 |
#endif |