EvaluationTracer.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2008 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/More/MEAL/MEAL/EvaluationTracer.h
10
11#ifndef __MEAL_EvaluationTracer_H
12#define __MEAL_EvaluationTracer_H
13
14#include "MEAL/Tracer.h"
15
16namespace MEAL
17{
18
20 template<class T>
21 class EvaluationTracer : public Tracer
22 {
23
24 public:
25
26 typedef typename T::Result Result;
27
29 EvaluationTracer (T* _model = 0) { if (_model) watch (_model); }
30
32 virtual void watch (T* _model) { Tmodel=_model; Tracer::watch(_model); }
33
34 protected:
35
38
41
43 void report ()
44 {
45 Result val=Tmodel->evaluate();
46 if (val == current_value)
47 return;
48 current_value = val;
49 std::cerr << "EvaluationTracer::report " << model->get_name() << " "
50 << current_value << std::endl;
51 }
52
53 };
54
55}
56
57#endif
58
void report()
Method called to report parameter value.
Definition EvaluationTracer.h:43
Reference::To< T > Tmodel
The model to watch.
Definition EvaluationTracer.h:37
EvaluationTracer(T *_model=0)
Default constructor.
Definition EvaluationTracer.h:29
virtual void watch(T *_model)
Trace the specified model.
Definition EvaluationTracer.h:32
Result current_value
The current value of the result.
Definition EvaluationTracer.h:40
virtual void watch(Function *)
Trace changes in the specified function.
Definition Tracer.C:26
Reference::To< Function > model
The function to watch.
Definition Tracer.h:36
Tracer()
Default constructor.
Definition Tracer.C:13
Namespace in which all modeling and calibration related code is declared.
Definition ExampleComplex2.h:16

Generated using doxygen 1.14.0