Wrap.h
1//-*-C++-*-
2/***************************************************************************
3 *
4 * Copyright (C) 2011 by Willem van Straten
5 * Licensed under the Academic Free License version 2.1
6 *
7 ***************************************************************************/
8
9// psrchive/More/MEAL/MEAL/Wrap.h
10
11#ifndef __MEAL_Wrap_H
12#define __MEAL_Wrap_H
13
14#include "MEAL/Evaluable.h"
15#include "Error.h"
16
17namespace MEAL {
18
20
22 template<typename Base>
23 class Wrap : public Base
24 {
25
26 public:
27
29 typedef typename Base::Result Result;
30
32 void wrap (Evaluable<Result>* _model)
33 {
34 model = _model;
35 this->copy_parameter_policy (model);
36 this->copy_evaluation_policy (model);
37 }
38
39 protected:
40
42 void calculate (Result& result, std::vector<Result>*)
43 {
44 throw Error (InvalidState,
45 "Wrap<" + std::string(Base::Name) + ">::calculate",
46 "not implemented - please use wrap method");
47 }
48
51 };
52
53}
54
55#endif
Template base class of functions with an evaluate method.
Definition Evaluable.h:37
Wrap another function.
Definition Wrap.h:24
void calculate(Result &result, std::vector< Result > *)
The calculate method should never be called.
Definition Wrap.h:42
Base::Result Result
The return type of the evaluate method.
Definition Wrap.h:29
Reference::To< Evaluable< Result > > model
The wrapped function.
Definition Wrap.h:50
void wrap(Evaluable< Result > *_model)
Set the function to wrap.
Definition Wrap.h:32
Namespace in which all modeling and calibration related code is declared.
Definition ExampleComplex2.h:16

Generated using doxygen 1.14.0