LCOV - code coverage report
Current view: top level - /opt/artdaq/srcs/artdaq-mfextensions/ErrorHandler/MessageAnalyzer - ma_boolean_cond.h (source / functions) Coverage Total Hit
Test: artdaq.info.cleaned Lines: 0.0 % 29 0
Test Date: 2025-09-04 00:45:34 Functions: 0.0 % 5 0

            Line data    Source code
       1              : #ifndef ERROR_HANDLER_MA_BOOLEAN_COND_H
       2              : #define ERROR_HANDLER_MA_BOOLEAN_COND_H
       3              : 
       4              : #include "ErrorHandler/MessageAnalyzer/ma_condition.h"
       5              : #include "ErrorHandler/MessageAnalyzer/ma_function.h"
       6              : #include "ErrorHandler/MessageAnalyzer/ma_types.h"
       7              : 
       8              : #include <boost/any.hpp>
       9              : #include <boost/shared_ptr.hpp>
      10              : 
      11              : #include <list>
      12              : 
      13              : namespace novadaq {
      14              : namespace errorhandler {
      15              : 
      16              : class ma_rule;
      17              : class ma_boolean_expr;
      18              : 
      19              : //-------------------------------------------------------------------
      20              : //
      21              : // elementary boolean condition has three possible cases:
      22              : //   1. '(' + boolean_expr + ')'
      23              : //   2. primitive elementary boolean condition Cn
      24              : //   3. non-primitive boolean condition ( COUNT(Cn.$s|t) )
      25              : //
      26              : //-------------------------------------------------------------------
      27              : 
      28              : class ma_boolean_cond
      29              : {
      30              : public:
      31              :         // c'tor
      32            0 :         ma_boolean_cond()
      33            0 :             : cond_type(COND)
      34            0 :             , cond_arg(cond_arg_t(cond_idx_t(NULL, 0), NONE))
      35            0 :             , op(CO_L)
      36            0 :             , rhv_b(false)
      37            0 :             , rhv_d(0.0)
      38            0 :             , rhv_s()
      39            0 :             , ext_func()
      40            0 :             , expr()
      41            0 :         {}
      42              : 
      43              :         // reset boolean cond
      44              :         void reset();
      45              : 
      46              :         // evaluation
      47              :         bool evaluate(ma_domain& value, ma_domain& alarm, ma_domain const& domain) const;
      48              : 
      49              :         // insert a boolean expression
      50              :         void insert_expr(ma_boolean_expr const& expr);
      51              : 
      52              :         // insert a primitive condition
      53            0 :         void insert_cond(cond_idx_t ci)
      54              :         {
      55            0 :                 cond_arg.first = ci;
      56            0 :                 cond_arg.second = NONE;
      57            0 :         }
      58              : 
      59              :         void insert_ext_func(cond_idx_t ci, arg_t arg, std::vector<boost::any> const& func_args, std::string const& function);
      60              : 
      61            0 :         void insert_compare_op_bool(compare_op_t cop, bool v)
      62              :         {
      63            0 :                 op = cop;
      64            0 :                 rhv_b = v;
      65            0 :                 cond_type = FUNCTION_BOOL;
      66            0 :         }
      67              : 
      68            0 :         void insert_compare_op_double(compare_op_t cop, double v)
      69              :         {
      70            0 :                 op = cop;
      71            0 :                 rhv_d = v;
      72            0 :                 cond_type = FUNCTION_DOUBLE;
      73            0 :         }
      74              : 
      75            0 :         void insert_compare_op_string(compare_op_t cop, std::string const& v)
      76              :         {
      77            0 :                 op = cop;
      78            0 :                 rhv_s = v;
      79            0 :                 cond_type = FUNCTION_STRING;
      80            0 :         }
      81              : 
      82              : private:
      83              :         // type of this element condition
      84              :         cond_type_t cond_type;
      85              : 
      86              :         // case COND: this boolean cond is the boolean value of a ma_condition
      87              :         //   a pointer to the condition in the one big condition container
      88              :         //   DOES NOT own the condition
      89              :         cond_arg_t cond_arg;
      90              : 
      91              :         // case EXT_FUNCTION:
      92              :         //   op:       compare operator, <, <=, ==, !=, >=, >
      93              :         //   rhv:      righ-hand value
      94              :         //   ext_func: ptr to a customized evaluation function. use ext_func->evaluate()
      95              :         //             to evaluate
      96              :         compare_op_t op;
      97              :         bool rhv_b;
      98              :         double rhv_d;
      99              :         std::string rhv_s;
     100              :         boost::shared_ptr<ma_function> ext_func;
     101              : 
     102              :         // shared_ptr to an boolean expression
     103              :         //   a smart pointer to an boolean expression object
     104              :         //   DOES own the expression object
     105              :         boost::shared_ptr<ma_boolean_expr> expr;
     106              : };
     107              : 
     108              : typedef std::list<ma_boolean_cond> boolean_conds_t;
     109              : 
     110              : }  // end of namespace errorhandler
     111              : }  // end of namespace novadaq
     112              : 
     113              : #endif
        

Generated by: LCOV version 2.0-1