GyotoSpectrometer.h
Go to the documentation of this file.
/*
Copyright 2011-2016 Thibaut Paumard
This file is part of Gyoto.
Gyoto is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gyoto is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GyotoSpectrometer_H_
#define __GyotoSpectrometer_H_
#include <GyotoDefs.h>
#include <GyotoSmartPointer.h>
#include <GyotoObject.h>
#include <GyotoRegister.h>
#include <GyotoHooks.h>
#include <string>
namespace Gyoto{
namespace Register { class Entry; }
class FactoryMessenger;
namespace Spectrometer {
class Generic;
typedef char const * kind_t;
typedef SmartPointer<Gyoto::Spectrometer::Generic>
Subcontractor_t(Gyoto::FactoryMessenger*, std::vector<std::string> const &);
Gyoto::Spectrometer::Subcontractor_t* getSubcontractor(std::string name,
std::vector<std::string> &plugins,
int errmode = 0);
template<typename T> SmartPointer<Spectrometer::Generic> Subcontractor
(FactoryMessenger* fmp, std::vector<std::string> const &plugins) {
SmartPointer<T> spectro = new T();
spectro -> plugins(plugins);
#ifdef GYOTO_USE_XERCES
if (fmp) spectro -> setParameters(fmp);
#endif
return spectro;
}
extern Gyoto::Register::Entry * Register_;
void initRegister();
void Register(std::string name, Gyoto::Spectrometer::Subcontractor_t* scp);
}
}
class Gyoto::Spectrometer::Generic
: public Gyoto::SmartPointee,
public Gyoto::Object,
public Gyoto::Hook::Teller
{
friend class Gyoto::SmartPointer<Gyoto::Spectrometer::Generic>;
protected:
kind_t kindid_;
public:
size_t nsamples_;
size_t nboundaries_;
double* boundaries_;
size_t* chanind_;
double* midpoints_;
double* widths_;
public:
GYOTO_OBJECT;
Generic();
Generic(kind_t kindid);
Generic(const Generic& ) ;
virtual Generic * clone() const =0;
virtual ~Generic();
virtual kind_t kindid() const ;
virtual void kindid(kind_t) ;
virtual size_t nSamples() const ;
virtual size_t getNBoundaries() const ;
virtual double const * getMidpoints() const ;
virtual void getMidpoints( double data[], std::string unit);
virtual void getChannelBoundaries( double data[], std::string unit);
virtual double const * getChannelBoundaries() const ;
virtual size_t const * getChannelIndices() const ;
virtual double const * getWidths() const ;
virtual void getWidths( double data[], std::string unit);
};
#endif
size_t
#define size_t
If not defined in <sys/types.h>.
Definition GyotoConfig.h:390
GyotoDefs.h
Gyoto ubiquitous macros and typedefs.
GyotoHooks.h
Tellers tell Listeners when they mutate.
GyotoObject.h
Introspectable objects.
GYOTO_OBJECT
#define GYOTO_OBJECT
Declare class::properties and class::getProperties().
Definition GyotoObject.h:84
GyotoRegister.h
Gyoto registers.
GyotoSmartPointer.h
Reference-counting pointers.
Gyoto::FactoryMessenger
Factory / SmartPointee::Subcontractor_t interface.
Definition GyotoFactoryMessenger.h:92
Gyoto::Hook::Teller
Listen to me and I'll warn you when I change.
Definition GyotoHooks.h:82
Gyoto::Object
Object with properties.
Definition GyotoObject.h:152
Gyoto::Register::Entry
Entry in a register (or a full register).
Definition GyotoRegister.h:117
Gyoto::SmartPointee
Can be pointed to by a SmartPointer.
Definition GyotoSmartPointer.h:81
Gyoto::SmartPointer
Pointers performing reference counting.
Definition GyotoSmartPointer.h:135
Gyoto::Spectrometer::Generic
Base class for spectrometers.
Definition GyotoSpectrometer.h:186
Gyoto::Spectrometer::Generic::getChannelIndices
virtual size_t const * getChannelIndices() const
Get Generic::chanind_.
Gyoto::Spectrometer::Generic::getMidpoints
virtual double const * getMidpoints() const
Get Generic::midpoints_.
Gyoto::Spectrometer::Generic::Generic
Generic()
Default constructor.
Gyoto::Spectrometer::Generic::getNBoundaries
virtual size_t getNBoundaries() const
Get Generic::nboundaries_.
Gyoto::Spectrometer::Generic::midpoints_
double * midpoints_
Effective frequency (in Hz) of each spectral channel.
Definition GyotoSpectrometer.h:231
Gyoto::Spectrometer::Generic::getChannelBoundaries
virtual void getChannelBoundaries(double data[], std::string unit)
Copy Generic::boundaries_, converting to unit.
Gyoto::Spectrometer::Generic::boundaries_
double * boundaries_
Frequency (in Hz) at the boundaries of the spectral channels.
Definition GyotoSpectrometer.h:217
Gyoto::Spectrometer::Generic::getWidths
virtual double const * getWidths() const
Get Generic::widths_.
Gyoto::Spectrometer::Generic::nSamples
virtual size_t nSamples() const
Get Generic::nsamples_.
Gyoto::Spectrometer::Generic::nsamples_
size_t nsamples_
Number of spectral elements.
Definition GyotoSpectrometer.h:199
Gyoto::Spectrometer::Generic::nboundaries_
size_t nboundaries_
Size of the boundaries_ array.
Definition GyotoSpectrometer.h:200
Gyoto::Spectrometer::Generic::chanind_
size_t * chanind_
Indices in boundaries_.
Definition GyotoSpectrometer.h:224
Gyoto::Spectrometer::Generic::kindid_
kind_t kindid_
Spectrometer kind ID.
Definition GyotoSpectrometer.h:197
Gyoto::Spectrometer::Generic::clone
virtual Generic * clone() const =0
Clone an instance.
Gyoto::Spectrometer::Generic::kindid
virtual kind_t kindid() const
Get kindid_.
Gyoto::Spectrometer::Generic::widths_
double * widths_
Width of each channel.
Definition GyotoSpectrometer.h:238
Gyoto::Register
Gyoto registers.
Definition GyotoAstrobj.h:46
Gyoto::Spectrometer
Access to spectrometers.
Definition GyotoComplexSpectrometer.h:34
Gyoto::Spectrometer::Register_
Gyoto::Register::Entry * Register_
The Spectrometer register.
Gyoto::Spectrometer::Subcontractor_t
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
Gyoto::Spectrometer::kind_t
char const * kind_t
Type for Spectrometer kind.
Definition GyotoSpectrometer.h:85
Gyoto::Spectrometer::getSubcontractor
Gyoto::Spectrometer::Subcontractor_t * getSubcontractor(std::string name, std::vector< std::string > &plugins, int errmode=0)
Query the Spectrometer register.
Gyoto::Spectrometer::Subcontractor
SmartPointer< Spectrometer::Generic > Subcontractor(FactoryMessenger *fmp, std::vector< std::string > const &plugins)
A template for Subcontractor_t functions.
Definition GyotoSpectrometer.h:133
Gyoto::Spectrometer::Register
void Register(std::string name, Gyoto::Spectrometer::Subcontractor_t *scp)
Register a new Spectrometer kind.
Gyoto::Spectrometer::initRegister
void initRegister()
Initialize the Spectrometer register This must be called once. It initializes Register_ and registers...
Gyoto
Namespace for the Gyoto library.
Definition GyotoAstrobj.h:44