Gyoto
Classes | Typedefs | Functions | Variables
Gyoto::Spectrometer Namespace Reference

Access to spectrometers. More...

Classes

class  Complex
 Complex spectrometer object. More...
 
class  Generic
 Base class for spectrometers. More...
 
class  Uniform
 Uniformly spaced spectrometers. More...
 

Typedefs

typedef char const * kind_t
 Type for Spectrometer kind. More...
 
typedef SmartPointer< Gyoto::Spectrometer::GenericSubcontractor_t(Gyoto::FactoryMessenger *, std::vector< std::string > const &)
 A function to build instances of a specific Astrobj::Generic sub-class. More...
 

Functions

Gyoto::Spectrometer::Subcontractor_tgetSubcontractor (std::string name, std::vector< std::string > &plugins, int errmode=0)
 Query the Spectrometer register. More...
 
template<typename T >
SmartPointer< Spectrometer::GenericSubcontractor (FactoryMessenger *fmp, std::vector< std::string > const &plugins)
 A template for Subcontractor_t functions. More...
 
void initRegister ()
 Initialize the Spectrometer register This must be called once. It initializes Register_ and registers the standard kinds (Uniform and Complex).
 
void Register (std::string name, Gyoto::Spectrometer::Subcontractor_t *scp)
 Register a new Spectrometer kind. More...
 

Variables

Gyoto::Register::EntryRegister_
 The Spectrometer register. More...
 

Detailed Description

Access to spectrometers.

Objects which describe spectrometers (including one-channel devices, a.k.a cameras) must inherit from the Gyoto::Spectrometer::Generic class.

To be usable, a Spectrometer::Generic sub-class should register a Spectrometer::Subcontractor_t function using the Spectrometer::Register() function. See also Writing plug-ins for Gyoto .

Typedef Documentation

◆ kind_t

typedef char const* Gyoto::Spectrometer::kind_t

Type for Spectrometer kind.

Spectrometer kindid is a unique numerical identifier for that kind, produced as the address to a static C string variable holding the kind's name. Most of the time, the address is the only significant part as this is more reliable and allows for direct numerical comparison instead of slower string comparison. The value of the string variable can be used for printing and as anchor name for Register(), although the anchor name could be different.

◆ Subcontractor_t

typedef SmartPointer<Gyoto::Spectrometer::Generic> Gyoto::Spectrometer::Subcontractor_t(Gyoto::FactoryMessenger *, std::vector< std::string > const &)

A function to build instances of a specific Astrobj::Generic sub-class.

This is a more specific version of the SmartPointee::Subcontractor_t type. A Spectrometer::Subcontrator_t is called by the Gyoto::Factory to build an instance of the kind of spectrometer specified in an XML file (see Register()). The Factory and Subcontractor_t function communicate through a Gyoto::FactoryMessenger.

Function Documentation

◆ getSubcontractor()

Gyoto::Spectrometer::Subcontractor_t* Gyoto::Spectrometer::getSubcontractor ( std::string  name,
std::vector< std::string > &  plugins,
int  errmode = 0 
)

Query the Spectrometer register.

Get the Spectrometer::Subcontractor_t correspondig to a given kind name. This function is normally called only from the Gyoto::Factory. If plugin is specified, only a subcontractor matching both name and plugin will be returned, loading the plug-in if necessary. If plugin is the empty string, then the first subcontractor matching name will be returned, and the name of the plug-in it belongs to will be returned in plugin upon output.

Parameters
[in]nameName of the subclass to build, e.g. "Complex" or "wave".
[in,out]plugine.g. "stdplug".
errmode[in]If name is not registered, getSubcontractor() return NULL errmode==1, throws a Gyoto::Error if errmode==0.
Returns
pointer to the corresponding subcontractor.

◆ Register()

void Gyoto::Spectrometer::Register ( std::string  name,
Gyoto::Spectrometer::Subcontractor_t scp 
)

Register a new Spectrometer kind.

Register a new Spectrometer::Generic sub-class so that the Gyoto::Factory knows it.

Parameters
nameThe kind name which identifies this object type in an XML file, as in <Spectrometer kind="name">. For clarity, this should be the same as the value of kindid_ for this object, but it is not mandatory.
scpA pointer to the subcontractor, which will communicate with the Gyoto::Factory to build an instance of the class from its XML description. If all parameters can be set using setParameter(), this can be:
&(Gyoto::Spectrometer::Subcontractor<Myind>)

◆ Subcontractor()

template<typename T >
SmartPointer<Spectrometer::Generic> Gyoto::Spectrometer::Subcontractor ( FactoryMessenger fmp,
std::vector< std::string > const &  plugins 
)

A template for Subcontractor_t functions.

Instead of reimplementing the wheel, your subcontractor can simply be Gyoto::Spectrometer::Subcontractor<MyKind>. It must however implement setParameters().

Template Parameters
TA Spectrometer::Generic sub-class.

Variable Documentation

◆ Register_

Gyoto::Register::Entry* Gyoto::Spectrometer::Register_

The Spectrometer register.

Use the Spectrometer::initRegister() once in your program to initiliaze it, the Spectrometer::Register() function to fill it, and the Spectrometer::getSubcontractor() function to query it.