GammaLib
2.1.0.dev
|
Photon container class. More...
#include <GPhotons.hpp>
Public Member Functions | |
GPhotons (void) | |
Void constructor. More... | |
GPhotons (const GPhotons &photons) | |
Copy constructor. More... | |
virtual | ~GPhotons (void) |
Destructor. More... | |
GPhotons & | operator= (const GPhotons &photons) |
Assignment operator. More... | |
GPhoton & | operator[] (const int &index) |
Return reference to photon. More... | |
const GPhoton & | operator[] (const int &index) const |
Return reference to photon (const version) More... | |
void | clear (void) |
Clear container. More... | |
GPhotons * | clone (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< GPhoton > | m_photons |
List of photons. More... | |
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.
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.
photons | Photon container. |
Definition at line 71 of file GPhotons.cpp.
References copy_members(), and init_members().
|
virtual |
void GPhotons::append | ( | const GPhoton & | photon | ) |
Append photon to container.
[in] | photon | Observation. |
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().
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 88 of file GPhotons.hpp.
|
virtual |
Clear container.
Implements GBase.
Definition at line 187 of file GPhotons.cpp.
References free_members(), and init_members().
|
virtual |
Clone object.
Implements GBase.
Definition at line 205 of file GPhotons.cpp.
References GPhotons().
|
protected |
Copy class members.
[in] | photons | Photon 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.
[in] | photons | Photon container. |
Append photon container to the container.
Definition at line 302 of file GPhotons.cpp.
References is_empty(), m_photons, reserve(), and size().
|
protected |
Delete class members.
Definition at line 417 of file GPhotons.cpp.
Referenced by clear(), operator=(), and ~GPhotons().
|
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.
[in] | index | Photon index [0,...,size()[. |
[in] | photon | Photon. |
GException::out_of_range | Photon 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().
|
inlinevirtual |
Signal if there are no photons.
Implements GContainer.
Definition at line 112 of file GPhotons.hpp.
References m_photons.
Assignment operator.
[in] | photons | 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.
[in] | index | Photon index [0,...,size()[. |
GException::out_of_range | Photon 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)
[in] | index | Photon index [0,...,size()[. |
GException::out_of_range | Photon index is out of range. |
Definition at line 163 of file GPhotons.cpp.
References G_OP_ACCESS, m_photons, and size().
Print photon container information.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 350 of file GPhotons.cpp.
References EXPLICIT, m_photons, gammalib::parformat(), SILENT, size(), and gammalib::str().
|
virtual |
Remove photon from container.
[in] | index | Photon index [0,...,size()[. |
GException::out_of_range | Photon index is out of range. |
Remove photon of specified index
from container.
Implements GContainer.
Definition at line 277 of file GPhotons.cpp.
|
virtual |
Reserve memory for photons in container.
[in] | num | Number 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().
|
inlinevirtual |
Return number of photons.
Implements GContainer.
Definition at line 100 of file GPhotons.hpp.
References m_photons.
Referenced by extend(), insert(), operator[](), print(), and remove().
|
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().