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

Photon container class. More...

#include <GPhotons.hpp>

Inheritance diagram for GPhotons:
GContainer GBase

Public Member Functions

 GPhotons (void)
 Void constructor. More...
 
 GPhotons (const GPhotons &photons)
 Copy constructor. More...
 
virtual ~GPhotons (void)
 Destructor. More...
 
GPhotonsoperator= (const GPhotons &photons)
 Assignment operator. More...
 
GPhotonoperator[] (const int &index)
 Return reference to photon. More...
 
const GPhotonoperator[] (const int &index) const
 Return reference to photon (const version) More...
 
void clear (void)
 Clear container. More...
 
GPhotonsclone (void) const
 Clone object. More...
 
std::string classname (void) const
 Return class name. More...
 
int size (void) const
 Return number of photons. More...
 
bool is_empty (void) const
 Signal if there are no photons. More...
 
void append (const GPhoton &photon)
 Append photon to container. More...
 
void insert (const int &index, const GPhoton &photon)
 Insert photon into container. More...
 
void remove (const int &index)
 Remove photon from container. More...
 
void reserve (const int &num)
 Reserve memory for photons in container. More...
 
void extend (const GPhotons &photons)
 Append photon container. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print photon container information. More...
 
- Public Member Functions inherited from GContainer
virtual ~GContainer (void)
 Destructor. 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 GPhotons &photons)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

std::vector< GPhotonm_photons
 List of photons. More...
 

Detailed Description

Photon container class.

This class is a container for photons. Photons are implemented by the GPhoton class which stores the physical attributes of a photon such as the photon arrival direction, its energy and its arrival time.

Definition at line 45 of file GPhotons.hpp.

Constructor & Destructor Documentation

GPhotons::GPhotons ( void  )

Void constructor.

Definition at line 56 of file GPhotons.cpp.

References init_members().

Referenced by clone().

GPhotons::GPhotons ( const GPhotons photons)

Copy constructor.

Parameters
photonsPhoton container.

Definition at line 71 of file GPhotons.cpp.

References copy_members(), and init_members().

GPhotons::~GPhotons ( void  )
virtual

Destructor.

Definition at line 87 of file GPhotons.cpp.

References free_members().

Member Function Documentation

void GPhotons::append ( const GPhoton photon)

Append photon to container.

Parameters
[in]photonObservation.

This method appends a photon to the container by copying it.

Definition at line 219 of file GPhotons.cpp.

References m_photons.

Referenced by GModelSky::mc().

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

Return class name.

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

Implements GBase.

Definition at line 88 of file GPhotons.hpp.

void GPhotons::clear ( void  )
virtual

Clear container.

Implements GBase.

Definition at line 187 of file GPhotons.cpp.

References free_members(), and init_members().

GPhotons * GPhotons::clone ( void  ) const
virtual

Clone object.

Returns
Pointer to deep copy of photon container.

Implements GBase.

Definition at line 205 of file GPhotons.cpp.

References GPhotons().

void GPhotons::copy_members ( const GPhotons photons)
protected

Copy class members.

Parameters
[in]photonsPhoton container.

Definition at line 404 of file GPhotons.cpp.

References m_photons.

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

void GPhotons::extend ( const GPhotons photons)

Append photon container.

Parameters
[in]photonsPhoton container.

Append photon container to the container.

Definition at line 302 of file GPhotons.cpp.

References is_empty(), m_photons, reserve(), and size().

void GPhotons::free_members ( void  )
protected

Delete class members.

Definition at line 417 of file GPhotons.cpp.

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

void GPhotons::init_members ( void  )
protected

Initialise class members.

Definition at line 389 of file GPhotons.cpp.

References m_photons.

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

void GPhotons::insert ( const int &  index,
const GPhoton photon 
)

Insert photon into container.

Parameters
[in]indexPhoton index [0,...,size()[.
[in]photonPhoton.
Exceptions
GException::out_of_rangePhoton index is out of range.

Inserts a photon into the container before the photon with the specified index.

Definition at line 241 of file GPhotons.cpp.

References G_INSERT, is_empty(), m_photons, and size().

bool GPhotons::is_empty ( void  ) const
inlinevirtual

Signal if there are no photons.

Returns
True if there are no photons.

Implements GContainer.

Definition at line 112 of file GPhotons.hpp.

References m_photons.

Referenced by extend(), and insert().

GPhotons & GPhotons::operator= ( const GPhotons photons)

Assignment operator.

Parameters
[in]photonsPhoton container.
Returns
Photon container.

Definition at line 109 of file GPhotons.cpp.

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

GPhoton & GPhotons::operator[] ( const int &  index)

Return reference to photon.

Parameters
[in]indexPhoton index [0,...,size()[.
Returns
Photon.
Exceptions
GException::out_of_rangePhoton index is out of range.

Definition at line 139 of file GPhotons.cpp.

References G_OP_ACCESS, m_photons, and size().

const GPhoton & GPhotons::operator[] ( const int &  index) const

Return reference to photon (const version)

Parameters
[in]indexPhoton index [0,...,size()[.
Returns
Photon.
Exceptions
GException::out_of_rangePhoton index is out of range.

Definition at line 163 of file GPhotons.cpp.

References G_OP_ACCESS, m_photons, and size().

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

Print photon container information.

Parameters
[in]chatterChattiness.
Returns
String containing photon container information.

Implements GBase.

Definition at line 350 of file GPhotons.cpp.

References EXPLICIT, m_photons, gammalib::parformat(), SILENT, size(), and gammalib::str().

void GPhotons::remove ( const int &  index)
virtual

Remove photon from container.

Parameters
[in]indexPhoton index [0,...,size()[.
Exceptions
GException::out_of_rangePhoton index is out of range.

Remove photon of specified index from container.

Implements GContainer.

Definition at line 277 of file GPhotons.cpp.

References G_REMOVE, m_photons, and size().

void GPhotons::reserve ( const int &  num)
virtual

Reserve memory for photons in container.

Parameters
[in]numNumber of photons.

This method reserves memory for num photons in the container.

Implements GContainer.

Definition at line 334 of file GPhotons.cpp.

References m_photons.

Referenced by extend(), and GModelSky::mc().

int GPhotons::size ( void  ) const
inlinevirtual

Return number of photons.

Returns
Number of photons.

Implements GContainer.

Definition at line 100 of file GPhotons.hpp.

References m_photons.

Referenced by extend(), insert(), operator[](), print(), and remove().

Member Data Documentation

std::vector<GPhoton> GPhotons::m_photons
protected

List of photons.

Definition at line 78 of file GPhotons.hpp.

Referenced by append(), copy_members(), extend(), init_members(), insert(), is_empty(), operator[](), print(), remove(), reserve(), and size().


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