Gyoto
GyotoSpectrometer.h
Go to the documentation of this file.
1 
8 /*
9  Copyright 2011-2016, 2024 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*, std::vector<std::string> const &);
98 
126  std::vector<std::string> &plugins,
127  int errmode = 0);
128 
139  (FactoryMessenger* fmp, std::vector<std::string> const &plugins) {
140  SmartPointer<T> spectro = new T();
141  spectro -> plugins(plugins);
142 #ifdef GYOTO_USE_XERCES
143  if (fmp) spectro -> setParameters(fmp);
144 #endif
145  return spectro;
146  }
147 
156 
163  void initRegister();
164 
184  void Register(std::string name, Gyoto::Spectrometer::Subcontractor_t* scp);
185 
186  }
187 }
188 
190 : public Gyoto::SmartPointee,
191  public Gyoto::Object,
192  public Gyoto::Hook::Teller
193 {
195  protected:
205  public:
208 
224  double* boundaries_;
225 
232 
238  double* midpoints_;
239 
245  double* widths_;
246 
247  public:
248  GYOTO_OBJECT;
249 
255  Generic();
256 
277  Generic(kind_t kindid);
278 
284  Generic(const Generic& ) ;
285 
299  virtual Generic * clone() const =0;
300 
306  virtual ~Generic();
307 
322  virtual kind_t kindid() const ;
323 
344  virtual void kindid(kind_t) ;
345 
346  virtual size_t nSamples() const ;
347  virtual size_t getNBoundaries() const ;
348  virtual double const * getMidpoints() const ;
349 
354  virtual void getMidpoints( double data[], std::string unit);
360  virtual void getChannelBoundaries( double data[], std::string unit);
361  virtual double const * getChannelBoundaries() const ;
362  virtual size_t const * getChannelIndices() const ;
363  virtual double const * getWidths() const ;
364 
374  virtual void getWidths( double data[], std::string unit);
375 
376 };
377 
378 
379 #endif
virtual double const * getWidths() const
Get Generic::widths_.
#define GYOTO_OBJECT
Declare class::properties and class::getProperties()
Definition: GyotoObject.h:84
virtual Generic * clone() const =0
Clone an instance.
double * boundaries_
Frequency (in Hz) at the boundaries of the spectral channels.
Definition: GyotoSpectrometer.h:224
Gyoto registers.
size_t * chanind_
Indices in boundaries_.
Definition: GyotoSpectrometer.h:231
virtual kind_t kindid() const
Get kindid_.
Tellers tell Listeners when they mutate.
virtual double const * getMidpoints() const
Get Generic::midpoints_.
Reference-counting pointers.
void Register(std::string name, Gyoto::Spectrometer::Subcontractor_t *scp)
Register a new Spectrometer kind.
SmartPointer< Gyoto::Spectrometer::Generic > Subcontractor_t(Gyoto::FactoryMessenger *, std::vector< std::string > const &)
A function to build instances of a specific Astrobj::Generic sub-class.
Definition: GyotoSpectrometer.h:96
#define size_t
If not defined in <sys/types.h>.
Definition: GyotoConfig.h:424
Factory / SmartPointee::Subcontractor_t interface.
Definition: GyotoFactoryMessenger.h:92
char const * kind_t
Type for Spectrometer kind.
Definition: GyotoSpectrometer.h:71
Gyoto::Spectrometer::Subcontractor_t * getSubcontractor(std::string name, std::vector< std::string > &plugins, int errmode=0)
Query the Spectrometer register Spectrometer::Register_.
Gyoto ubiquitous macros and typedefs.
size_t nboundaries_
Size of the boundaries_ array.
Definition: GyotoSpectrometer.h:207
kind_t kindid_
Spectrometer kind ID.
Definition: GyotoSpectrometer.h:204
Introspectable objects.
virtual double const * getChannelBoundaries() const
Get Generic::boundaries_.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:46
virtual size_t nSamples() const
Get Generic::nsamples_.
virtual size_t const * getChannelIndices() const
Get Generic::chanind_.
Can be pointed to by a SmartPointer.
Definition: GyotoSmartPointer.h:80
double * widths_
Width of each channel.
Definition: GyotoSpectrometer.h:245
void initRegister()
Initialize the Spectrometer register Spectrometer::Register_.
Gyoto::Register::Entry * Register_
The Spectrometer register.
SmartPointer< Spectrometer::Generic > Subcontractor(FactoryMessenger *fmp, std::vector< std::string > const &plugins)
A template for Subcontractor_t functions.
Definition: GyotoSpectrometer.h:139
double * midpoints_
Effective frequency (in Hz) of each spectral channel.
Definition: GyotoSpectrometer.h:238
Object with properties.
Definition: GyotoObject.h:151
Listen to me and I&#39;ll warn you when I change.
Definition: GyotoHooks.h:82
Base class for spectrometers.
Definition: GyotoSpectrometer.h:189
size_t nsamples_
Number of spectral elements.
Definition: GyotoSpectrometer.h:206
Entry in a register (or a full register)
Definition: GyotoRegister.h:132
virtual size_t getNBoundaries() const
Get Generic::nboundaries_.