2#include <cgv/signal/bool_combiner.h>
3#include "bool_signal.h"
8void connect(bool_signal<>& s,
bool(*fp)())
10 s.connect(bool_function_functor<0>(fp));
13void disconnect(bool_signal<>& s,
bool(*fp)())
15 s.disconnect(bool_function_functor<0>(fp));
21 if (combine_with_and) {
23 return short_circuit && !value;
26 return short_circuit && value;
32 combine_with_and =
true;
39 return combine_with_and;
47 for (
int i=0; i<(int)s.size(); ++i) {
49 case '*' : short_circuit =
true;
break;
50 case '+' : short_circuit =
false;
break;
51 case '&' : combine_with_and =
true;
break;
52 case '|' : combine_with_and =
false;
break;
53 default: std::cerr <<
"unkown option character '" << s[i] <<
"' in constructor of cgv::signal::bool_combiner" << std::endl;
61 return combine_with_and;
bool combine_result(bool new_value, bool &value) const
base class for signals that combine the boolean result of the attached functors with boolean and/or o...
bool get_neutral_value() const
return the neutral bool value with which one can initialize the result variable
bool_combiner(const char *opt)
construct from option string.
void set_options(const char *opt)
set a different option string
bool is_evaluation_short_circuit() const
return whether to perform short-circuit evaluation
bool is_combination_with_and() const
return whether combination is done with the boolean and operation