UnaryRule.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2004 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/More/MEAL/MEAL/UnaryRule.h
10 
11 #ifndef __MEAL_UnaryRule_H
12 #define __MEAL_UnaryRule_H
13 
14 #include "MEAL/Projection.h"
15 #include "MEAL/Composite.h"
16 
17 namespace MEAL {
18 
20  template<class T>
21  class UnaryRule : public T
22  {
23 
24  public:
25 
27  UnaryRule () : composite(this) { }
28 
30  UnaryRule (const UnaryRule& rule) : composite(this) { operator = (rule); }
31 
33  UnaryRule& operator = (const UnaryRule& rule);
34 
36  ~UnaryRule () { }
37 
39  void set_model (T* model);
40 
41  protected:
42 
45 
46  private:
47 
49  Composite composite;
50 
51  };
52 
53 }
54 
55 template<class T>
58 {
59  if (this != &rule)
60  set_model (rule.model);
61 
62  return *this;
63 }
64 
65 
66 template<class T>
68 {
69  if (model)
70  composite.unmap (model);
71 
72  model = _model;
73 
74  if (!_model)
75  return;
76 
77  if (T::verbose)
78  std::cerr << "MEAL::UnaryRule::set_model map "
79  << model->get_name() << std::endl;
80 
81  composite.map (model);
82 }
83 
84 
85 #endif
UnaryRule()
Default constructor.
Definition: UnaryRule.h:37
Project< T > model
The Function on which the operation will be performed.
Definition: UnaryRule.h:54
Parameter policy for composite functions.
Definition: Composite.h:25
Namespace in which all modeling and calibration related code is declared.
Definition: ExampleComplex2.h:16
UnaryRule & operator=(const UnaryRule &rule)
Assignment operator.
Definition: UnaryRule.h:57
Abstract base class of unary operators.
Definition: UnaryRule.h:26
void set_model(T *model)
Set the Function on which the operation will be performed.
Definition: UnaryRule.h:67
~UnaryRule()
Destructor.
Definition: UnaryRule.h:46

Generated using doxygen 1.8.17