Transformation.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/Transformation.h
10
11#ifndef __MEAL_Transformation_H
12#define __MEAL_Transformation_H
13
14#include "MEAL/Composite.h"
15
16namespace MEAL {
17
19
20 template<typename T>
21 class Transformation : public T
22 {
23
24 public:
25
28
31
33 virtual void set_input (T* input);
34
36 virtual T* get_input () { return input; }
37
39 virtual void set_composite (Composite* c);
40
42 virtual void set_input (Project<T>& _input) { input = _input; }
43
45 virtual Function* get_transformation () { return 0; }
46
47 protected:
48
51
54
55 };
56
57}
58
59template<typename T>
61{
62 composite = new Composite(this);
63 this->set_parameter_policy_context = false;
64}
65
67template<typename T>
69{
70 if (!_input)
71 return;
72
73 if (input)
74 {
75 if (T::verbose)
76 std::cerr << "MEAL::Transformation::set_input unmap old input"
77 << std::endl;
78
79 composite->unmap (input);
80 }
81
82 input = _input;
83
84 if (T::verbose)
85 std::cerr << "MEAL::Transformation::set_input map new input"
86 << std::endl;
87
88 composite->map (input);
89}
90catch (Error& error)
91{
92 throw error += "MEAL::Transformation[" + this->get_name() + "]::set_input";
93}
94
95template<typename T>
97{
98 composite = c;
99 this->set_parameter_policy (c);
100}
101
102#endif
103
Parameter policy for composite functions.
Definition Composite.h:20
Pure virtual base class of all functions.
Definition Function.h:49
Template combines a reference to a Component and its Projection.
Definition Projection.h:60
virtual Function * get_transformation()
Get the transformation.
Definition Transformation.h:45
virtual T * get_input()
Get the input, .
Definition Transformation.h:36
virtual void set_input(Project< T > &_input)
Optimization: set input already mapped into containing composite.
Definition Transformation.h:42
Reference::To< Composite > composite
Composite parameter policy.
Definition Transformation.h:53
virtual void set_input(T *input)
Set the input, .
Definition Transformation.h:68
Project< Complex2 > input
Definition Transformation.h:50
virtual void set_composite(Composite *c)
Optimization: set composite that contains this transformation.
Definition Transformation.h:96
~Transformation()
Destructor.
Definition Transformation.h:30
Transformation()
Default constructor.
Definition Transformation.h:60
Namespace in which all modeling and calibration related code is declared.
Definition ExampleComplex2.h:16

Generated using doxygen 1.14.0