|
Gyoto
|
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::Generic > | Subcontractor_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_t * | getSubcontractor (std::string name, std::vector< std::string > &plugins, int errmode=0) |
| Query the Spectrometer register Spectrometer::Register_. More... | |
| template<typename T > | |
| SmartPointer< Spectrometer::Generic > | Subcontractor (FactoryMessenger *fmp, std::vector< std::string > const &plugins) |
| A template for Subcontractor_t functions. More... | |
| void | initRegister () |
| Initialize the Spectrometer register Spectrometer::Register_. More... | |
| void | Register (std::string name, Gyoto::Spectrometer::Subcontractor_t *scp) |
| Register a new Spectrometer kind. More... | |
Variables | |
| Gyoto::Register::Entry * | Register_ |
| The Spectrometer register. More... | |
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 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.
| 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.
| Gyoto::Spectrometer::Subcontractor_t* Gyoto::Spectrometer::getSubcontractor | ( | std::string | name, |
| std::vector< std::string > & | plugins, | ||
| int | errmode = 0 |
||
| ) |
Query the Spectrometer register Spectrometer::Register_.
Query the Spectrometer register to get the Metric::Subcontractor_t correspondig to a given kind name. This function is normally called only from the Factory. If plugin is not empty, all the plug-ins listed there will be first loaded using Gyoto::requirePlugin(), then a subcontractor matching both name and and one element of plugin will be searched for. If plugin is an empty vector, 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.
This function is defined using the GYOTO_GETSUBCONTRACTOR macro.
| [in] | name | Name of the subclass to build, e.g. "Complex" or "wave". |
| [in,out] | plugin | vector of strings listing plug-ins to look for name in. |
| errmode[in] | If name is not registered, getSubcontractor() returns NULL if errmode==1 and throws a Gyoto::Error if errmode==0. |
| void Gyoto::Spectrometer::initRegister | ( | ) |
Initialize the Spectrometer register Spectrometer::Register_.
This must be called once. It initializes Register_ and registers the standard kinds (Uniform and Complex).
| 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.
| name | The 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. |
| scp | A 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>) |
| 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().
| T | A Spectrometer::Generic sub-class. |
| 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.
1.8.14