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 
16 namespace MEAL {
17 
19 
20  template<typename T>
21  class Transformation : public T
22  {
23 
24  public:
25 
27  Transformation ();
28 
30  ~Transformation () { }
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 
44  protected:
45 
48 
51 
52  };
53 
54 }
55 
56 template<typename T>
58 {
59  composite = new Composite(this);
60  this->set_parameter_policy_context = false;
61 }
62 
64 template<typename T>
66 {
67  if (!_input)
68  return;
69 
70  if (input)
71  {
72  if (T::verbose)
73  std::cerr << "MEAL::Transformation::set_input unmap old input"
74  << std::endl;
75 
76  composite->unmap (input);
77  }
78 
79  input = _input;
80 
81  if (T::verbose)
82  std::cerr << "MEAL::Transformation::set_input map new input"
83  << std::endl;
84 
85  composite->map (input);
86 }
87 catch (Error& error)
88 {
89  throw error += "MEAL::Transformation[" + this->get_name() + "]::set_input";
90 }
91 
92 template<typename T>
94 {
95  composite = c;
96  this->set_parameter_policy (c);
97 }
98 
99 #endif
100 
virtual T * get_input()
Get the input, .
Definition: Transformation.h:46
virtual void set_composite(Composite *c)
Optimization: set composite that contains this transformation.
Definition: Transformation.h:93
virtual void set_input(T *input)
Set the input, .
Definition: Transformation.h:65
Parameter policy for composite functions.
Definition: Composite.h:25
Reference::To< Composite > composite
Composite parameter policy.
Definition: Transformation.h:60
Namespace in which all modeling and calibration related code is declared.
Definition: ExampleComplex2.h:16
~Transformation()
Destructor.
Definition: Transformation.h:40
Project< T > input
The input, .
Definition: Transformation.h:57
Transformation()
Default constructor.
Definition: Transformation.h:57

Generated using doxygen 1.8.17