Projection.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/Projection.h
10 
11 #ifndef __Projection_H
12 #define __Projection_H
13 
14 #include "Reference.h"
15 
16 namespace MEAL {
17 
18  class Function;
19  class Composite;
20 
22  class Projection : public Reference::Able {
23 
24  friend class Composite;
25 
26  public:
28  Projection (Function* model=0, Composite* meta=0);
29 
31  ~Projection ();
32 
34  unsigned get_imap (unsigned index) const;
35 
37  void get_imap (std::vector<unsigned>& get) const { get = imap; }
38 
40  Function* get_Function();
41 
43  void set_Function (Function* _model);
44 
45  protected:
46 
49 
51  std::vector<unsigned> imap;
52 
55  };
56 
57 
59  template<class Component>
60  class Project : public Reference::To<Component> {
61 
62  public:
63 
65  Project (Component* model = 0)
66  {
68  projection = new Projection (model);
69  }
70 
72  const Project& operator = (Component* model)
73  {
75  projection->set_Function (model);
76  return *this;
77  }
78 
81  {
82  return projection;
83  }
84 
86  const Projection* get_map () const
87  {
88  return projection;
89  }
90 
92  unsigned get_imap (unsigned index) const
93  {
94  return projection->get_imap (index);
95  }
96 
97  protected:
98 
101 
102  };
103 
104 }
105 
106 
107 #endif
108 
unsigned get_imap(unsigned index) const
Return the mapped index.
Definition: Projection.C:25
Reference::To< Function > model
The Function that is mapped into a Composite.
Definition: Projection.h:53
Projection(Function *model=0, Composite *meta=0)
Default constructor.
Definition: Projection.C:12
const Project & operator=(Component *model)
Assignment operator.
Definition: Projection.h:77
unsigned get_imap(unsigned index) const
Return the mapped index.
Definition: Projection.h:97
Parameter policy for composite functions.
Definition: Composite.h:25
Function * get_Function()
Return the model.
Definition: Projection.C:50
Reference::To< Projection > projection
The Projection.
Definition: Projection.h:105
Namespace in which all modeling and calibration related code is declared.
Definition: ExampleComplex2.h:16
Manages a Function and the mapping of its parameters into a Composite.
Definition: Projection.h:27
std::vector< unsigned > imap
The parameter index mapping into Composite.
Definition: Projection.h:56
Reference::To< Composite, false > meta
The Composite into which the model is mapped.
Definition: Projection.h:59
~Projection()
Destructor.
Definition: Projection.C:20
Pure virtual base class of all functions.
Definition: Function.h:49
void set_Function(Function *_model)
Set the model.
Definition: Projection.C:55
Project(Component *model=0)
Default constructor.
Definition: Projection.h:70
void map(Project< Type > &model)
Convenience interface to map (Projection*)
Definition: Composite.h:90
Template combines a reference to a Component and its Projection.
Definition: Projection.h:65
To & operator=(const To &)
Projection * get_map()
Return the Projection.
Definition: Projection.h:85

Generated using doxygen 1.8.17