32 #ifndef _util_misc_compute_h
33 #define _util_misc_compute_h
37 #include <util/state/state.h>
38 #include <util/state/stateio.h>
46 typedef ResultInfo* ResultInfoP;
60 std::set<ResultInfoP> _results;
92 virtual void update();
96 virtual void save_data_state(
StateOut&);
97 virtual void restore_state(
StateIn&);
102 int& compute() {
return _compute; }
103 const int& compute()
const {
return _compute; }
104 int compute(
int c) {
int r = _compute; _compute = c;
return r; }
105 int& computed() {
return _computed; }
106 const int& computed()
const {
return _computed; }
107 virtual int needed()
const;
115 double _actual_accuracy;
116 double _desired_accuracy;
120 virtual void save_data_state(
StateOut&);
121 virtual void restore_state(
StateIn&);
127 double actual_accuracy()
const;
128 double desired_accuracy()
const;
129 void set_desired_accuracy(
double);
130 void set_actual_accuracy(
double);
131 int computed_to_desired_accuracy()
const
132 {
return computed() && _actual_accuracy <= _desired_accuracy; }
138 #include <util/misc/comptmpl.h>
142 typedef NCResult<int> Resultint;
143 typedef NCResult<double> Resultdouble;
144 typedef NCAccResult<double> AccResultdouble;