artdaq_mfextensions  v1_05_00
ma_domain_cond.h
1 #ifndef ERROR_HANDLER_MA_DOMAIN_COND_H
2 #define ERROR_HANDLER_MA_DOMAIN_COND_H
3 
4 // from novadaq
5 #include "ErrorHandler/MessageAnalyzer/ma_types.h"
6 #include "ErrorHandler/MessageAnalyzer/ma_condition.h"
7 
8 // from ups
9 #include <boost/shared_ptr.hpp>
10 
11 // from system
12 #include <list>
13 
14 namespace novadaq {
15 namespace errorhandler {
16 
17 // An elemental domain condition could be one of the followings:
18 // 1. rule_cond_1.$[s|t] = rule_cond_2.$[s|t] ( = "string literal" )
19 // 2. '(' >> domain_expr >> ')'
20 
21 class ma_rule;
22 class ma_domain_expr;
23 
25 {
26 public:
27 
28  ma_domain_cond( );
29 
30  // evaluate domains of this ma_domain_cond, then merge the
31  // result with passed in domains
32  void evaluate(ma_domains & domains) const;
33 
34  // insert condition idx and $s/$t
35  void insert_cond_arg( cond_idx_t ci, arg_t arg, size_t size )
36  { conds.push_back(std::make_pair(ci, arg)); cond_size = size; }
37 
38  // insert string condition ( cond.$s = 'str_cond' )
39  void insert_str_cond( std::string const & str )
40  { str_cond = str; }
41 
42  // insert domain_expr ( cond_type = EXPR )
43  void insert_expr( ma_domain_expr const & expr );
44 
45  // and-merge domains from worksheet into domains
46  ma_domains &
47  and_merge( ma_domains & domains, ma_domains & worksheet ) const;
48 
49 private:
50 
51  // type of this elemental condition
52  cond_type_t cond_type;
53 
54  // case CONDS: rule_cond_args connected with '='
55  cond_arg_list_t conds;
56  std::string str_cond;
57  size_t cond_size; // # of conds in the parent rule
58 
59  // case EXPR: an expression
60  // it has to be a ptr to domain_expression to avoid circulic inclusion
61  boost::shared_ptr<ma_domain_expr> expr;
62 
63 };
64 
65 typedef std::list<ma_domain_cond> domain_conds_t;
66 
67 } // end of namespace errorhandler
68 } // end of namespace novadaq
69 
70 #endif