Gyoto
GyotoSpectrometer.h
Go to the documentation of this file.
1 
8 /*
9  Copyright 2011-2015 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 __GyotoSpectrometer_H_
28 #define __GyotoSpectrometer_H_
29 
30 #include <GyotoDefs.h>
31 #include <GyotoSmartPointer.h>
32 #include <GyotoObject.h>
33 #include <GyotoRegister.h>
34 #include <GyotoHooks.h>
35 #include <string>
36 
50 namespace Gyoto{
51  namespace Register { class Entry; }
52  class FactoryMessenger;
53  namespace Spectrometer {
71  class Generic;
72 
85  typedef char const * kind_t;
86 
98 
112  int errmode = 0);
113 
125  SmartPointer<T> spectro = new T();
126 #ifdef GYOTO_USE_XERCES
127  if (fmp) spectro -> setParameters(fmp);
128 #endif
129  return spectro;
130  }
131 
140 
146  void initRegister();
147 
167  void Register(std::string name, Gyoto::Spectrometer::Subcontractor_t* scp);
168 
169  }
170 }
171 
173 : public Gyoto::SmartPointee,
174  public Gyoto::Object,
175  public Gyoto::Hook::Teller
176 {
177  friend class Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>;
178  protected:
187  kind_t kindid_;
188  public:
189  size_t nsamples_;
190  size_t nboundaries_;
191 
207  double* boundaries_;
208 
214  size_t* chanind_;
215 
221  double* midpoints_;
222 
228  double* widths_;
229 
230  public:
231  GYOTO_OBJECT;
232 
238  Generic();
239 
260  Generic(kind_t kindid);
261 
267  Generic(const Generic& ) ;
268 
282  virtual Generic * clone() const =0;
283 
289  virtual ~Generic();
290 
305  virtual kind_t kindid() const ;
306 
327  virtual void kindid(kind_t) ;
328 
329  virtual size_t nSamples() const ;
330  virtual size_t getNBoundaries() const ;
331  virtual double const * getMidpoints() const ;
332 
337  virtual void getMidpoints( double data[], std::string unit);
343  virtual void getChannelBoundaries( double data[], std::string unit);
344  virtual double const * getChannelBoundaries() const ;
345  virtual size_t const * getChannelIndices() const ;
346  virtual double const * getWidths() const ;
347 
357  virtual void getWidths( double data[], std::string unit);
358 
359 };
360 
361 
362 #endif
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:83
Gyoto registers.
Gyoto::Spectrometer::Subcontractor_t * getSubcontractor(std::string name, int errmode=0)
Query the Spectrometer register.
Tellers tell Listeners when they mutate.
Reference-counting pointers.
void Register(std::string name, Gyoto::Spectrometer::Subcontractor_t *scp)
Register a new Spectrometer kind.
#define size_t
If not defined in <sys/types.h>.
Definition: GyotoConfig.h:354
Factory / SmartPointee::Subcontractor_t interface.
Definition: GyotoFactoryMessenger.h:92
char const * kind_t
Type for Spectrometer kind.
Definition: GyotoSpectrometer.h:71
Gyoto ubiquitous macros and typedefs.
Introspectable objects.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
SmartPointer< Spectrometer::Generic > Subcontractor(FactoryMessenger *fmp)
A template for Subcontractor_t functions.
Definition: GyotoSpectrometer.h:124
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:78
void initRegister()
Initialize the Spectrometer register This must be called once. It initializes Register_ and registers...
Gyoto::Register::Entry * Register_
The Spectrometer register.
SmartPointer< Gyoto::Spectrometer::Generic > Subcontractor_t(Gyoto::FactoryMessenger *)
A function to build instances of a specific Astrobj::Generic sub-class.
Definition: GyotoSpectrometer.h:96
Object with properties.
Definition: GyotoObject.h:136
Listen to me and I&#39;ll warn you when I change.
Definition: GyotoHooks.h:82
Base class for spectrometers.
Definition: GyotoSpectrometer.h:172
Entry in a register (or a full register)
Definition: GyotoRegister.h:92