Gyoto
GyotoSpectrum.h
Go to the documentation of this file.
1 
8 /*
9  Copyright 2011-2012 Thibaut Paumard
10 
11  This file is part of Gyoto.
12 
13  Gyoto is free software: you can redistribute it and/or modify
14  it under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  Gyoto is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 #ifndef __GyotoSpectrum_H_
28 #define __GyotoSpectrum_H_
29 
30 #include "GyotoRegister.h"
31 #include "GyotoObject.h"
32 
33 namespace Gyoto{
34  namespace Register { class Entry; }
35  class FactoryMessenger;
36 
38  namespace Spectrum {
39  class Generic;
40 
42 
52  Subcontractor_t(Gyoto::FactoryMessenger* fmp);
53 
63  (FactoryMessenger* fmp) {
64  SmartPointer<T> sp = new T();
65 #ifdef GYOTO_USE_XERCES
66  if (fmp) sp -> setParameters(fmp);
67 #endif
68  return sp;
69  }
70 
72 
83  void Register(std::string kind, Gyoto::Spectrum::Subcontractor_t* scp);
84 
86 
98  getSubcontractor(std::string name, int errmode=0);
99 
101 
106  extern Register::Entry* Register_;
107 
109 
113  void initRegister();
114  }
115 }
116 
117 #include <GyotoSmartPointer.h>
118 #include <string>
127 : public Gyoto::SmartPointee,
128  public Gyoto::Object
129 {
130  friend class Gyoto::SmartPointer<Gyoto::Spectrum::Generic>;
131  protected:
132 
133  public:
134  GYOTO_OBJECT;
135 
136  Generic(const std::string kind);
137  Generic(const Spectrum::Generic &);
138  virtual Generic * clone() const;
139 
140  virtual ~Generic() ;
141 
142  const std::string kind() const;
143 
144  virtual double operator()(double nu) const =0;
146 
153  virtual double operator()(double nu, double opacity, double ds) const;
155 
164  virtual double integrate(double nu1, double nu2) ;
165 
177  virtual double integrate(double nu1, double nu2,
178  const Spectrum::Generic * opacity, double ds) ;
179 
180 };
181 
182 
183 #endif
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:83
Gyoto registers.
void Register(std::string kind, Gyoto::Spectrum::Subcontractor_t *scp)
Make a Spectrum kind known to the Factory.
Reference-counting pointers.
Gyoto::SmartPointer< Gyoto::Spectrum::Generic > Subcontractor_t(Gyoto::FactoryMessenger *fmp)
A function to build instances of a specific Spectrum::Generic sub-class.
Definition: GyotoSpectrum.h:52
Introspectable objects.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:78
Register::Entry * Register_
The Spectrum register.
Spectrum emitted by an Astrobj.
Definition: GyotoSpectrum.h:126
void initRegister()
Empty the Spectrum register.
SmartPointer< Spectrum::Generic > Subcontractor(FactoryMessenger *fmp)
Subcontractor template.
Definition: GyotoSpectrum.h:63
Object with properties.
Definition: GyotoObject.h:136
Gyoto::Spectrum::Subcontractor_t * getSubcontractor(std::string name, int errmode=0)
Query the Spectrum register.
Entry in a register (or a full register)
Definition: GyotoRegister.h:92