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

Spectrum of a simple object (e.g. a Gyoto::Astrobj::Star) More...

Classes

class  BlackBody
 Black Body. More...
 
class  Generic
 Spectrum emitted by an Astrobj. More...
 
class  PowerLaw
 I_nu=constant_*nu^exponent_. More...
 
class  ThermalBremsstrahlung
 Thermal brems spectrum. More...
 

Typedefs

typedef Gyoto::SmartPointer< Gyoto::Spectrum::GenericSubcontractor_t(Gyoto::FactoryMessenger *fmp)
 A function to build instances of a specific Spectrum::Generic sub-class. More...
 

Functions

template<typename T >
SmartPointer< Spectrum::GenericSubcontractor (FactoryMessenger *fmp)
 Subcontractor template. More...
 
void Register (std::string kind, Gyoto::Spectrum::Subcontractor_t *scp)
 Make a Spectrum kind known to the Factory. More...
 
Gyoto::Spectrum::Subcontractor_tgetSubcontractor (std::string name, int errmode=0)
 Query the Spectrum register. More...
 
void initRegister ()
 Empty the Spectrum register. More...
 

Variables

Register::EntryRegister_
 The Spectrum register. More...
 

Detailed Description

Spectrum of a simple object (e.g. a Gyoto::Astrobj::Star)

Typedef Documentation

typedef Gyoto::SmartPointer<Gyoto::Spectrum::Generic> Gyoto::Spectrum::Subcontractor_t(Gyoto::FactoryMessenger *fmp)

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

This is a more specific version of the SmartPointee::Subcontractor_t type. A Spectrum::Subcontrator_t is called by the Gyoto::Factory to build an instance of the kind of spectrum specified in an XML file (see Register()). The Factory and Subcontractor_t function communicate through a Gyoto::FactoryMessenger. A template is provided so that you may not have to code anything.

Function Documentation

Gyoto::Spectrum::Subcontractor_t* Gyoto::Spectrum::getSubcontractor ( std::string  name,
int  errmode = 0 
)

Query the Spectrum register.

Query the Spectrum register to get the Metric::Subcontractor_t correspondig to a given kind name. This function is normally called only from the Factory.

Parameters
namee.g. "PowerLaw"
errmodeint=0. If errmode==0, failure to find a registered Spectrum by that name is an error. Else, simply return NULL pointer in that case.
Returns
pointer to the corresponding subcontractor.
void Gyoto::Spectrum::initRegister ( )

Empty the Spectrum register.

This must be called once. It is called by Gyoto::Register::init().

void Gyoto::Spectrum::Register ( std::string  kind,
Gyoto::Spectrum::Subcontractor_t scp 
)

Make a Spectrum kind known to the Factory.

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

Parameters
kindThe kind name which identifies this object type in an XML file, as in <Spectrum kind="name">
scpA pointer to the subcontractor, which will communicate whith the Gyoto::Factory to build an instance of the class from its XML description
template<typename T >
SmartPointer<Spectrum::Generic> Gyoto::Spectrum::Subcontractor ( FactoryMessenger *  fmp)

Subcontractor template.

Instead of reimplementing the wheel, your subcontractor can simply be Gyoto::Spectrum::Subcontractor<MyKind>

Template Parameters
TSub-class of Spectrum::Generic

Variable Documentation

Register::Entry* Gyoto::Spectrum::Register_

The Spectrum register.

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