GammaLib 2.0.0
Loading...
Searching...
No Matches
GPhotons Class Reference

Photon container class. More...

#include <GPhotons.hpp>

Inheritance diagram for GPhotons:
GContainer GBase

Public Member Functions

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

Protected Member Functions

void init_members (void)
 Initialise class members.
 
void copy_members (const GPhotons &photons)
 Copy class members.
 
void free_members (void)
 Delete class members.
 

Protected Attributes

std::vector< GPhotonm_photons
 List of photons.
 

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() [1/2]

GPhotons::GPhotons ( void )

Void constructor.

Definition at line 56 of file GPhotons.cpp.

References init_members().

Referenced by clone().

◆ GPhotons() [2/2]

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::~GPhotons ( void )
virtual

Destructor.

Definition at line 87 of file GPhotons.cpp.

References free_members().

Member Function Documentation

◆ append()

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().

◆ classname()

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.

◆ clear()

void GPhotons::clear ( void )
virtual

Clear container.

Implements GBase.

Definition at line 187 of file GPhotons.cpp.

References free_members(), and init_members().

◆ clone()

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().

◆ copy_members()

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=().

◆ extend()

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().

◆ free_members()

void GPhotons::free_members ( void )
protected

Delete class members.

Definition at line 417 of file GPhotons.cpp.

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

◆ init_members()

void GPhotons::init_members ( void )
protected

Initialise class members.

Definition at line 389 of file GPhotons.cpp.

References m_photons.

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

◆ insert()

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().

◆ is_empty()

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().

◆ operator=()

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().

◆ operator[]() [1/2]

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().

◆ operator[]() [2/2]

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().

◆ print()

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(), print(), SILENT, size(), and gammalib::str().

Referenced by print().

◆ remove()

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().

◆ reserve()

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().

◆ size()

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[](), operator[](), print(), and remove().

Member Data Documentation

◆ m_photons

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[](), operator[](), print(), remove(), reserve(), and size().


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