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
17namespace 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
34
37
39 void set_model (T* model);
40
41 protected:
42
45
46 private:
47
49 Composite composite;
50
51 };
52
53}
54
55template<class T>
58{
59 if (this != &rule)
60 set_model (rule.model);
61
62 return *this;
63}
64
65
66template<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
Parameter policy for composite functions.
Definition Composite.h:20
Template combines a reference to a Component and its Projection.
Definition Projection.h:60
Abstract base class of unary operators.
Definition UnaryRule.h:22
void set_model(T *model)
Set the Function on which the operation will be performed.
Definition UnaryRule.h:67
UnaryRule()
Default constructor.
Definition UnaryRule.h:27
Project< Scalar > model
Definition UnaryRule.h:44
UnaryRule(const UnaryRule &rule)
Copy constructor.
Definition UnaryRule.h:30
~UnaryRule()
Destructor.
Definition UnaryRule.h:36
UnaryRule & operator=(const UnaryRule &rule)
Assignment operator.
Definition UnaryRule.h:57
Namespace in which all modeling and calibration related code is declared.
Definition ExampleComplex2.h:16

Generated using doxygen 1.14.0