GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GSource Class Reference

Class that handles gamma-ray sources. More...

#include <GSource.hpp>

Inheritance diagram for GSource:
GBase

Public Member Functions

 GSource (void)
 Void constructor. More...
 
 GSource (const std::string &name, GModelSpatial *model, const GEnergy &energy, const GTime &time)
 Source constructor. More...
 
 GSource (const GSource &src)
 Copy constructor. More...
 
virtual ~GSource (void)
 Destructor. More...
 
GSourceoperator= (const GSource &src)
 Assignment operator. More...
 
void clear (void)
 Clear instance. More...
 
GSourceclone (void) const
 Clone object. More...
 
std::string classname (void) const
 Return class name. More...
 
const std::string & name (void) const
 Return model name. More...
 
const GModelSpatialmodel (void) const
 Return spatial model component. More...
 
const GEnergyenergy (void) const
 Return photon energy. More...
 
const GTimetime (void) const
 Return photon arrival time. More...
 
void name (const std::string &name)
 Set model name. More...
 
void model (GModelSpatial *model)
 Set spatial model component. More...
 
void energy (const GEnergy &energy)
 Set photon energy. More...
 
void time (const GTime &time)
 Set photon arrival time. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print source. More...
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor. More...
 

Protected Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GSource &src)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

std::string m_name
 Source name. More...
 
GModelSpatialm_model
 Spatial model. More...
 
GEnergy m_energy
 Photon energy. More...
 
GTime m_time
 Photon arrival time. More...
 

Detailed Description

Class that handles gamma-ray sources.

The GSource class stores the physical attributes of a gamma-ray source, which is the distribution of photon arrival directions in form of a spatial source model, the photon energy, and the photon arrival time. The class is very similar to the GPhoton class, yet instead of a given photon arrival direction it contains a spatial model pointer. Note that the class does not allocate or deallocate the spatial model pointer, it just is a carrier of a pointer which is handled outside the class.

Each source also has a name so that it can be identified.

Definition at line 53 of file GSource.hpp.

Constructor & Destructor Documentation

GSource::GSource ( void  )

Void constructor.

Definition at line 54 of file GSource.cpp.

References init_members().

Referenced by clone().

GSource::GSource ( const std::string &  name,
GModelSpatial model,
const GEnergy energy,
const GTime time 
)

Source constructor.

Parameters
[in]nameSource name.
[in]modelSpatial model pointer.
[in]energyEnergy.
[in]timeTime.

Definition at line 72 of file GSource.cpp.

References energy(), init_members(), m_energy, m_model, m_name, m_time, model(), name(), and time().

GSource::GSource ( const GSource src)

Copy constructor.

Parameters
[in]srcSource.

Definition at line 96 of file GSource.cpp.

References copy_members(), and init_members().

GSource::~GSource ( void  )
virtual

Destructor.

Definition at line 112 of file GSource.cpp.

References free_members().

Member Function Documentation

std::string GSource::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GSource").

Implements GBase.

Definition at line 100 of file GSource.hpp.

void GSource::clear ( void  )
virtual

Clear instance.

Implements GBase.

Definition at line 164 of file GSource.cpp.

References free_members(), and init_members().

GSource * GSource::clone ( void  ) const
virtual

Clone object.

Returns
Pointer to deep copy of source.

Implements GBase.

Definition at line 182 of file GSource.cpp.

References GSource().

void GSource::copy_members ( const GSource src)
protected

Copy class members.

Parameters
[in]srcSource.

Definition at line 250 of file GSource.cpp.

References m_energy, m_model, m_name, and m_time.

Referenced by GSource(), and operator=().

void GSource::energy ( const GEnergy energy)
inline

Set photon energy.

Parameters
[in]energyPhoton energy.

Sets the photon energy.

Definition at line 200 of file GSource.hpp.

References energy(), and m_energy.

void GSource::free_members ( void  )
protected

Delete class members.

Definition at line 266 of file GSource.cpp.

Referenced by clear(), operator=(), and ~GSource().

void GSource::init_members ( void  )
protected

Initialise class members.

Definition at line 232 of file GSource.cpp.

References GEnergy::clear(), GTime::clear(), m_energy, m_model, m_name, and m_time.

Referenced by clear(), GSource(), and operator=().

void GSource::model ( GModelSpatial model)
inline

Set spatial model component.

Parameters
[in]modelSpatial model component.

Sets the spatial model component.

Definition at line 185 of file GSource.hpp.

References m_model, and model().

const std::string & GSource::name ( void  ) const
inline

Return model name.

Returns
Model name.

Returns the model name.

Definition at line 114 of file GSource.hpp.

References m_name.

Referenced by GSource(), GResponse::irf_composite(), GCTAResponseCube::irf_spatial(), GResponse::irf_spatial(), GLATResponse::irf_spatial_bin(), and name().

void GSource::name ( const std::string &  name)
inline

Set model name.

Parameters
[in]nameModel name.

Sets the model name.

Definition at line 170 of file GSource.hpp.

References m_name, and name().

GSource & GSource::operator= ( const GSource src)

Assignment operator.

Parameters
[in]srcSource.
Returns
Source.

Definition at line 134 of file GSource.cpp.

References copy_members(), free_members(), and init_members().

std::string GSource::print ( const GChatter chatter = NORMAL) const
virtual

Print source.

Parameters
[in]chatterChattiness.
Returns
String containing source information

Implements GBase.

Definition at line 195 of file GSource.cpp.

References m_energy, m_model, m_name, m_time, GEnergy::print(), GTime::print(), SILENT, and GModelSpatial::type().

const GTime & GSource::time ( void  ) const
inline
void GSource::time ( const GTime time)
inline

Set photon arrival time.

Parameters
[in]timePhoton arrival time.

Sets the photon arrival time.

Definition at line 215 of file GSource.hpp.

References m_time, and time().

Member Data Documentation

GEnergy GSource::m_energy
protected

Photon energy.

Definition at line 89 of file GSource.hpp.

Referenced by copy_members(), energy(), GSource(), init_members(), and print().

GModelSpatial* GSource::m_model
protected

Spatial model.

Definition at line 88 of file GSource.hpp.

Referenced by copy_members(), GSource(), init_members(), model(), and print().

std::string GSource::m_name
protected

Source name.

Definition at line 87 of file GSource.hpp.

Referenced by copy_members(), GSource(), init_members(), name(), and print().

GTime GSource::m_time
protected

Photon arrival time.

Definition at line 90 of file GSource.hpp.

Referenced by copy_members(), GSource(), init_members(), print(), and time().


The documentation for this class was generated from the following files: