GammaLib
2.0.0
|
Response vector cache class. More...
#include <GResponseVectorCache.hpp>
Public Member Functions | |
GResponseVectorCache (void) | |
Void constructor. More... | |
GResponseVectorCache (const GResponseVectorCache &cache) | |
Copy constructor. More... | |
virtual | ~GResponseVectorCache (void) |
Destructor. More... | |
GResponseVectorCache & | operator= (const GResponseVectorCache &cache) |
Assignment operator. More... | |
void | clear (void) |
Clear response vector cache. More... | |
GResponseVectorCache * | clone (void) const |
Clone response cache. More... | |
std::string | classname (void) const |
Return class name. More... | |
bool | is_empty (void) const |
Checks whether the cache is empty. More... | |
int | size (void) const |
Returns size of vector chache. More... | |
void | set (const std::string &cache_id, const GVector &vector) |
Set cache value. More... | |
void | remove (const std::string &cache_id) |
Remove cache. More... | |
bool | contains (const std::string &cache_id, GVector *irfs=NULL) const |
Check if cache contains a value for specific parameters. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print response cache. 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 GResponseVectorCache &cache) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
int | find_cache (const std::string &cache_id) const |
Find cache. More... | |
Protected Attributes | |
std::vector< std::string > | m_cache_ids |
std::vector< int > | m_cache_entries |
std::vector< double * > | m_cache_values |
std::vector< int * > | m_cache_indices |
Response vector cache class.
The class implements a vector cache for the Instrument Response Function values so that the values do not need to be recomputed each time but can be fetched from the cache.
Definition at line 52 of file GResponseVectorCache.hpp.
GResponseVectorCache::GResponseVectorCache | ( | void | ) |
Void constructor.
Definition at line 54 of file GResponseVectorCache.cpp.
References init_members().
Referenced by clone().
GResponseVectorCache::GResponseVectorCache | ( | const GResponseVectorCache & | cache | ) |
Copy constructor.
[in] | cache | Response vector cache. |
Definition at line 69 of file GResponseVectorCache.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 97 of file GResponseVectorCache.hpp.
|
virtual |
Clear response vector cache.
Implements GBase.
Definition at line 137 of file GResponseVectorCache.cpp.
References free_members(), and init_members().
Referenced by GResponse::init_members().
|
virtual |
Clone response cache.
Implements GBase.
Definition at line 155 of file GResponseVectorCache.cpp.
References GResponseVectorCache().
bool GResponseVectorCache::contains | ( | const std::string & | cache_id, |
GVector * | vector = NULL |
||
) | const |
Check if cache contains a value for specific parameters.
[in] | cache_id | Cache identifier. |
[in,out] | vector | Pointer to cached vector (only if found). |
Check if the cache contains a value for a given name
, reconstructed energy ereco
, and true energy etrue
.
If the value
pointer argument is not NULL, the method will return the cached value through this argument in case that the value exists.
Definition at line 295 of file GResponseVectorCache.cpp.
References find_cache(), m_cache_entries, m_cache_indices, m_cache_values, and GVector::size().
Referenced by GResponse::irf_spatial().
|
protected |
Copy class members.
[in] | cache | Response cache. |
Definition at line 409 of file GResponseVectorCache.cpp.
References m_cache_entries, m_cache_ids, m_cache_indices, m_cache_values, and size().
Referenced by GResponseVectorCache(), and operator=().
|
protected |
Find cache.
[in] | cache_id | Cache identifier. |
Find cache for a given cache_id
. If no cache was found the method returns -1.
Definition at line 463 of file GResponseVectorCache.cpp.
References m_cache_ids.
Referenced by contains(), remove(), and set().
|
protected |
Delete class members.
Definition at line 439 of file GResponseVectorCache.cpp.
References m_cache_indices, m_cache_values, and size().
Referenced by clear(), operator=(), and ~GResponseVectorCache().
|
protected |
Initialise class members.
Definition at line 391 of file GResponseVectorCache.cpp.
References m_cache_entries, m_cache_ids, m_cache_indices, and m_cache_values.
Referenced by clear(), GResponseVectorCache(), and operator=().
|
inline |
Checks whether the cache is empty.
Checks whether the response cache is empty.
Definition at line 111 of file GResponseVectorCache.hpp.
References m_cache_ids.
GResponseVectorCache & GResponseVectorCache::operator= | ( | const GResponseVectorCache & | cache | ) |
Assignment operator.
[in] | cache | Response vector cache. |
Definition at line 107 of file GResponseVectorCache.cpp.
References copy_members(), free_members(), and init_members().
Print response cache.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 353 of file GResponseVectorCache.cpp.
References m_cache_entries, m_cache_ids, gammalib::parformat(), SILENT, size(), and gammalib::str().
void GResponseVectorCache::remove | ( | const std::string & | cache_id | ) |
Remove cache.
[in] | cache_id | Cache identifier. |
Remove cache for a given cache_id
.
Definition at line 257 of file GResponseVectorCache.cpp.
References find_cache(), m_cache_entries, m_cache_ids, m_cache_indices, and m_cache_values.
Referenced by GResponse::remove_response_cache().
void GResponseVectorCache::set | ( | const std::string & | cache_id, |
const GVector & | vector | ||
) |
Set cache value.
[in] | cache_id | Cache identifier. |
[in] | vector | Cache vector. |
Set cache vector for a given cache_id
.
Definition at line 169 of file GResponseVectorCache.cpp.
References find_cache(), m_cache_entries, m_cache_ids, m_cache_indices, m_cache_values, GVector::non_zeros(), and GVector::size().
Referenced by GResponse::irf_spatial().
|
inline |
Returns size of vector chache.
Returns the number of vectors that are stored in the vector cache.
Definition at line 125 of file GResponseVectorCache.hpp.
References m_cache_ids.
Referenced by copy_members(), free_members(), and print().
|
protected |
Definition at line 85 of file GResponseVectorCache.hpp.
Referenced by contains(), copy_members(), init_members(), print(), remove(), and set().
|
protected |
Definition at line 84 of file GResponseVectorCache.hpp.
Referenced by copy_members(), find_cache(), init_members(), is_empty(), print(), remove(), set(), and size().
|
protected |
Definition at line 87 of file GResponseVectorCache.hpp.
Referenced by contains(), copy_members(), free_members(), init_members(), remove(), and set().
|
protected |
Definition at line 86 of file GResponseVectorCache.hpp.
Referenced by contains(), copy_members(), free_members(), init_members(), remove(), and set().