BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ruleEvaluator.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 // $Id: ruleEvaluator.h,v 1.16 2005/12/23 17:01:52 amoll Exp $
5 //
6 
7 // Molecular Mechanics: rule-based assignment of properties (typenames, charges, radii, etc.)
8 
9 #ifndef BALL_MOLMEC_COMMON_RULEEVALUATOR_H
10 #define BALL_MOLMEC_COMMON_RULEEVALUATOR_H
11 
12 #ifndef 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 
38  {
39  public:
40 
42 
43 
46 
49  typedef std::list<std::pair<Expression, String> > RuleList;
50 
53  typedef StringHashMap<RuleList> RuleMap;
54 
56 
59 
62  RuleEvaluator() ;
63 
66  RuleEvaluator(INIFile& file, const String& prefix) ;
67 
70  RuleEvaluator(const RuleEvaluator& evaluator) ;
71 
74  virtual ~RuleEvaluator() ;
75 
77 
80 
83  bool initialize(INIFile& file, const String& prefix) ;
84 
87  const String& getPrefix() const ;
88 
91  void setPrefix(const String& prefix) ;
92 
94 
97 
100  const RuleEvaluator& operator = (const RuleEvaluator& evaluator)
101  ;
102 
105  virtual void clear() ;
106 
108 
111 
117  String operator () (const Atom& atom) const ;
118 
120  bool operator == (const RuleEvaluator& evaluator) const ;
121 
123 
126 
129  bool isValid() const ;
130 
133  void dump(std::ostream& s = std::cout, Size indent_depth = 0) const
134  ;
135 
137 
138  protected:
139 
140  //_ parse the section with name: predicate_ + ":" + symbol of file
141  void extractSection_(INIFile& file, const String& symbol) ;
142 
143  //_ The INI file section prefix
144  String prefix_;
145 
146  //_ The map relating an element name and the corresponding list of expressions
147  RuleMap rule_map_;
148 
149  //_
150  bool valid_;
151 
152  };
153 } // namespace BALL
154 
155 
156 #endif // BALL_MOLMEC_COMMON_RULEEVALUATOR_H
#define BALL_CREATE(name)
Definition: create.h:62
std::list< std::pair< Expression, String > > RuleList
Definition: ruleEvaluator.h:49
#define BALL_EXPORT
Definition: COMMON/global.h:50