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

Abstract interface for the sky region class. More...

#include <GSkyRegion.hpp>

Inheritance diagram for GSkyRegion:
GBase GSkyRegionCircle GSkyRegionMap GSkyRegionRectangle

Public Member Functions

 GSkyRegion (void)
 Void constructor. More...
 
 GSkyRegion (const GSkyRegion &region)
 Copy constructor. More...
 
virtual ~GSkyRegion (void)
 Destructor. More...
 
virtual GSkyRegionoperator= (const GSkyRegion &region)
 Assignment operator. More...
 
virtual void clear (void)=0
 Clear object. More...
 
virtual GSkyRegionclone (void) const =0
 Clones object. More...
 
virtual std::string classname (void) const =0
 Return class name. More...
 
virtual void read (const std::string &regstring)=0
 
virtual std::string write (void) const =0
 
virtual bool contains (const GSkyDir &dir) const =0
 
virtual bool overlaps (const GSkyRegion &reg) const =0
 
virtual bool contains (const GSkyRegion &reg) const =0
 
virtual std::string print (const GChatter &chatter=NORMAL) const =0
 Print content of object. More...
 
const std::string & type (void) const
 Return region type. More...
 
const std::string & name (void) const
 Return region name. More...
 
const double & solidangle (void) const
 Return solid angle of region. More...
 
void type (const std::string &type)
 Set region type. More...
 
void name (const std::string &name)
 Set region name. More...
 
void solidangle (const double &solidangle)
 Set solid angle of region. 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 GSkyRegion &region)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

std::string m_type
 Type of the region (circle, rectangle,...) More...
 
std::string m_name
 Name of the region. More...
 
double m_solid
 Solid angle subtended by the region (sr) More...
 

Detailed Description

Abstract interface for the sky region class.

This class provides an abstract interface for a sky region. The sky region is defined by an array of parameters names and values specific to the derived class where the region type or shape is implemented.

Accessible information elements are:

  • Type of the region (circle, rectangle,...)
  • Solid angle subtended by the region

The object can be initialised from a string in the DS9 region file format, and return its description as a string in the DS9 region file format. The input/ouput to/from files is handled in the container class GSkyRegions.

Definition at line 57 of file GSkyRegion.hpp.

Constructor & Destructor Documentation

GSkyRegion::GSkyRegion ( void  )

Void constructor.

Definition at line 53 of file GSkyRegion.cpp.

References init_members().

GSkyRegion::GSkyRegion ( const GSkyRegion region)

Copy constructor.

Parameters
[in]regionsky region.

Definition at line 68 of file GSkyRegion.cpp.

References copy_members(), and init_members().

GSkyRegion::~GSkyRegion ( void  )
virtual

Destructor.

Definition at line 84 of file GSkyRegion.cpp.

References free_members().

Member Function Documentation

virtual std::string GSkyRegion::classname ( void  ) const
pure virtual

Return class name.

Returns
String containing the class name.

Returns the class name for non-abstract classes in a human readable way.

Implements GBase.

Implemented in GSkyRegionRectangle, GSkyRegionCircle, and GSkyRegionMap.

virtual void GSkyRegion::clear ( void  )
pure virtual

Clear object.

Sets the object to a clean initial state. After calling the method the object will be in the same state as it were if an empty instance of the object would have been created.

Implements GBase.

Implemented in GSkyRegionRectangle, GSkyRegionCircle, and GSkyRegionMap.

virtual GSkyRegion* GSkyRegion::clone ( void  ) const
pure virtual

Clones object.

Returns
Pointer to deep copy of object.

Creates a deep copy of the object and returns a pointer to the object.

Implements GBase.

Implemented in GSkyRegionRectangle, GSkyRegionCircle, and GSkyRegionMap.

Referenced by GSkyRegions::append(), GSkyRegions::insert(), and GSkyRegions::set().

virtual bool GSkyRegion::contains ( const GSkyDir dir) const
pure virtual
virtual bool GSkyRegion::contains ( const GSkyRegion reg) const
pure virtual
void GSkyRegion::copy_members ( const GSkyRegion region)
protected

Copy class members.

Parameters
[in]regionsky region.

Definition at line 153 of file GSkyRegion.cpp.

References m_name, m_solid, and m_type.

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

void GSkyRegion::free_members ( void  )
protected

Delete class members.

Definition at line 168 of file GSkyRegion.cpp.

Referenced by GSkyRegionMap::clear(), GSkyRegionCircle::clear(), GSkyRegionRectangle::clear(), operator=(), and ~GSkyRegion().

void GSkyRegion::init_members ( void  )
protected

Initialise class members.

Definition at line 136 of file GSkyRegion.cpp.

References m_name, m_solid, and m_type.

Referenced by GSkyRegionMap::clear(), GSkyRegionCircle::clear(), GSkyRegionRectangle::clear(), GSkyRegion(), and operator=().

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

Return region name.

Returns
Region name

Returns the region name.

Definition at line 108 of file GSkyRegion.hpp.

References m_name.

Referenced by name().

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

Set region name.

Parameters
[in]nameRegion name.

Sets the region name.

Definition at line 122 of file GSkyRegion.hpp.

References m_name, and name().

GSkyRegion & GSkyRegion::operator= ( const GSkyRegion region)
virtual

Assignment operator.

Parameters
[in]regionsky region.
Returns
sky region.

Definition at line 106 of file GSkyRegion.cpp.

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

Referenced by GSkyRegionCircle::operator=(), and GSkyRegionRectangle::operator=().

virtual bool GSkyRegion::overlaps ( const GSkyRegion reg) const
pure virtual
virtual std::string GSkyRegion::print ( const GChatter chatter = NORMAL) const
pure virtual

Print content of object.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing the content of the object.

Formats the content in a standard way and puts this content in a C++ string that is returned.

Implements GBase.

Implemented in GSkyRegionRectangle, GSkyRegionCircle, and GSkyRegionMap.

virtual void GSkyRegion::read ( const std::string &  regstring)
pure virtual
const double & GSkyRegion::solidangle ( void  ) const
inline

Return solid angle of region.

Returns
Solid angle of region.

Returns the solid angle subtended by the region (in steradians).

Definition at line 166 of file GSkyRegion.hpp.

References m_solid.

Referenced by GModelSpatialDiffuseConst::flux(), and solidangle().

void GSkyRegion::solidangle ( const double &  solidangle)
inline

Set solid angle of region.

Parameters
[in]solidangleSolid angle of region (in steradians).

Sets the solid angle subtended by the region (in steradians).

Definition at line 180 of file GSkyRegion.hpp.

References m_solid, and solidangle().

const std::string & GSkyRegion::type ( void  ) const
inline

Return region type.

Returns
Region type

Returns the region type.

Definition at line 137 of file GSkyRegion.hpp.

References m_type.

Referenced by GSkyRegionMap::contains(), GSkyRegionCircle::contains(), GSkyRegionRectangle::contains(), GSkyRegionCircle::overlaps(), GSkyRegionRectangle::overlaps(), GSkyMap::overlaps(), and type().

void GSkyRegion::type ( const std::string &  type)
inline

Set region type.

Parameters
[in]typeRegion type.

Sets the region type.

Definition at line 151 of file GSkyRegion.hpp.

References m_type, and type().

virtual std::string GSkyRegion::write ( void  ) const
pure virtual

Member Data Documentation

std::string GSkyRegion::m_name
protected
double GSkyRegion::m_solid
protected
std::string GSkyRegion::m_type
protected

Type of the region (circle, rectangle,...)

Definition at line 94 of file GSkyRegion.hpp.

Referenced by copy_members(), GSkyRegionMap::init_members(), init_members(), GSkyRegionCircle::init_members(), GSkyRegionRectangle::init_members(), and type().


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