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 
96  Subcontractor_t(Gyoto::FactoryMessenger*);
98 
112  int errmode = 0);
113 
124  (FactoryMessenger* fmp) {
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:
188  public:
191 
207  double* boundaries_;
208 
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
virtual Generic * clone() const =0
Clone an instance.
double * boundaries_
Frequency (in Hz) at the boundaries of the spectral channels.
Definition: GyotoSpectrometer.h:207
virtual size_t const * getChannelIndices() const
Get Generic::chanind_.
virtual double const * getMidpoints() const
Get Generic::midpoints_.
Gyoto registers.
Gyoto::Spectrometer::Subcontractor_t * getSubcontractor(std::string name, int errmode=0)
Query the Spectrometer register.
size_t * chanind_
Indices in boundaries_.
Definition: GyotoSpectrometer.h:214
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 .
Definition: GyotoConfig.h:366
char const * kind_t
Type for Spectrometer kind.
Definition: GyotoSpectrometer.h:71
virtual double const * getWidths() const
Get Generic::widths_.
Gyoto ubiquitous macros and typedefs.
size_t nboundaries_
Size of the boundaries_ array.
Definition: GyotoSpectrometer.h:190
kind_t kindid_
Spectrometer kind ID.
Definition: GyotoSpectrometer.h:187
virtual kind_t kindid() const
Get kindid_.
Introspectable objects.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:43
virtual size_t getNBoundaries() const
Get Generic::nboundaries_.
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
double * widths_
Width of each channel.
Definition: GyotoSpectrometer.h:228
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
virtual double const * getChannelBoundaries() const
Get Generic::boundaries_.
double * midpoints_
Effective frequency (in Hz) of each spectral channel.
Definition: GyotoSpectrometer.h:221
Object with properties.
Definition: GyotoObject.h:136
virtual size_t nSamples() const
Get Generic::nsamples_.
Listen to me and I'll warn you when I change.
Definition: GyotoHooks.h:82
Base class for spectrometers.
Definition: GyotoSpectrometer.h:172
size_t nsamples_
Number of spectral elements.
Definition: GyotoSpectrometer.h:189
Entry in a register (or a full register)
Definition: GyotoRegister.h:92