Commit e1aca9cdbc40d04b1f9265f2ca12dd9b4a91a642
1 parent
7d110f80
Update class documentation.
All files have been screened to clean up the documentation so that the actual files may serve as template for further instrument implementations.
Showing
5 changed files
with
27 additions
and
25 deletions
inst/spi/include/GSPIEventBin.hpp
| ... | ... | @@ -39,12 +39,16 @@ |
| 39 | 39 | * @class GSPIEventBin |
| 40 | 40 | * |
| 41 | 41 | * @brief SPI event bin class |
| 42 | + * | |
| 43 | + * This class defines an event bin of the SPI data space. The class holds | |
| 44 | + * pointers to the bin attributes, and allocates memory so that all bin | |
| 45 | + * attributes have an associated memory space. With this technique, the class | |
| 46 | + * can be used to hold information that is external to GSPIEventBin. The | |
| 47 | + * GSPIEventCube class will use this property to directly manipulate the | |
| 48 | + * pointers of the bin. | |
| 42 | 49 | ***************************************************************************/ |
| 43 | 50 | class GSPIEventBin : public GEventBin { |
| 44 | 51 | |
| 45 | - // Friend classes | |
| 46 | - //friend class GSPIEventCube; | |
| 47 | - | |
| 48 | 52 | public: |
| 49 | 53 | // Constructors and destructors |
| 50 | 54 | GSPIEventBin(void); |
| ... | ... | @@ -73,12 +77,12 @@ protected: |
| 73 | 77 | void free_members(void); |
| 74 | 78 | |
| 75 | 79 | // Protected members |
| 76 | - bool m_alloc; //!< Signals proper memory allocation | |
| 77 | - int m_index; //!< Dataspace index | |
| 78 | - double* m_counts; //!< Pointer to number of counts | |
| 79 | - GSPIInstDir* m_dir; //!< Pointer to bin direction | |
| 80 | - GEnergy* m_energy; //!< Pointer to bin energy | |
| 81 | - GTime* m_time; //!< Pointer to bin time | |
| 80 | + bool m_alloc; //!< Signals memory allocation by object | |
| 81 | + int m_index; //!< Dataspace index (-1 if not used) | |
| 82 | + double* m_counts; //!< Pointer to number of counts | |
| 83 | + GSPIInstDir* m_dir; //!< Pointer to bin direction | |
| 84 | + GEnergy* m_energy; //!< Pointer to bin energy | |
| 85 | + GTime* m_time; //!< Pointer to bin time | |
| 82 | 86 | }; |
| 83 | 87 | |
| 84 | 88 | #endif /* GSPIEVENTBIN_HPP */ | ... | ... |
inst/spi/src/GSPIEventBin.cpp
| ... | ... | @@ -29,7 +29,6 @@ |
| 29 | 29 | #include <config.h> |
| 30 | 30 | #endif |
| 31 | 31 | #include <string> |
| 32 | -#include <cmath> | |
| 33 | 32 | #include "GSPIEventBin.hpp" |
| 34 | 33 | #include "GTools.hpp" |
| 35 | 34 | |
| ... | ... | @@ -53,7 +52,7 @@ |
| 53 | 52 | ***************************************************************************/ |
| 54 | 53 | GSPIEventBin::GSPIEventBin(void) : GEventBin() |
| 55 | 54 | { |
| 56 | - // Initialise class members for clean destruction | |
| 55 | + // Initialise class members | |
| 57 | 56 | init_members(); |
| 58 | 57 | |
| 59 | 58 | // Return |
| ... | ... | @@ -68,7 +67,7 @@ GSPIEventBin::GSPIEventBin(void) : GEventBin() |
| 68 | 67 | ***************************************************************************/ |
| 69 | 68 | GSPIEventBin::GSPIEventBin(const GSPIEventBin& bin) : GEventBin(bin) |
| 70 | 69 | { |
| 71 | - // Initialise class members for clean destruction | |
| 70 | + // Initialise class members | |
| 72 | 71 | init_members(); |
| 73 | 72 | |
| 74 | 73 | // Copy members |
| ... | ... | @@ -171,6 +170,9 @@ GSPIEventBin* GSPIEventBin::clone(void) const |
| 171 | 170 | * @brief Return size of event bin |
| 172 | 171 | * |
| 173 | 172 | * @return Size of event bin (sr MeV s) |
| 173 | + * | |
| 174 | + * @todo We need to thick about the correct unit for the event bin size | |
| 175 | + * for the SPI telescope. Not sure that "sr" applies here ... | |
| 174 | 176 | ***************************************************************************/ |
| 175 | 177 | double GSPIEventBin::size(void) const |
| 176 | 178 | { |
| ... | ... | @@ -232,9 +234,9 @@ std::string GSPIEventBin::print(void) const |
| 232 | 234 | * @brief Initialise class members |
| 233 | 235 | * |
| 234 | 236 | * This method allocates memory for all event bin attributes and intialises |
| 235 | - * the attributes to well defined initial values. | |
| 236 | - * | |
| 237 | - * The method assumes that on entry no memory is hold by the member pointers. | |
| 237 | + * the attributes to well defined initial values. The m_alloc member signals | |
| 238 | + * that memory has been allocated, so that memory will be freed upon object | |
| 239 | + * destruction. | |
| 238 | 240 | ***************************************************************************/ |
| 239 | 241 | void GSPIEventBin::init_members(void) |
| 240 | 242 | { |
| ... | ... | @@ -245,7 +247,7 @@ void GSPIEventBin::init_members(void) |
| 245 | 247 | m_time = new GTime; |
| 246 | 248 | |
| 247 | 249 | // Initialise members |
| 248 | - m_alloc = true; | |
| 250 | + m_alloc = true; // Signals that memory has been allocated | |
| 249 | 251 | m_index = -1; // Signals that event bin does not correspond to cube |
| 250 | 252 | *m_counts = 0.0; |
| 251 | 253 | m_dir->clear(); |
| ... | ... | @@ -286,7 +288,7 @@ void GSPIEventBin::copy_members(const GSPIEventBin& bin) |
| 286 | 288 | * bin), or upon destruction of the object. |
| 287 | 289 | * |
| 288 | 290 | * Note that some logic has been implemented that frees only memory that also |
| 289 | - * has indeed been allocated by the class. Thus if the class only serves as | |
| 291 | + * has indeed been allocated by the object. Thus if the object only serves as | |
| 290 | 292 | * container to hold memory pointer allocated by someone else (for example |
| 291 | 293 | * the GSPIEventCube class), no memory is freed. |
| 292 | 294 | ***************************************************************************/ | ... | ... |
inst/spi/src/GSPIInstDir.cpp
| ... | ... | @@ -176,7 +176,7 @@ std::string GSPIInstDir::print(void) const |
| 176 | 176 | // Append header |
| 177 | 177 | result.append("=== GSPIInstDir ==="); |
| 178 | 178 | |
| 179 | - // TODO: Append any other relevat information | |
| 179 | + // TODO: Append any other relevant information | |
| 180 | 180 | |
| 181 | 181 | // Return result |
| 182 | 182 | return result; | ... | ... |
inst/spi/src/GSPIPointing.cpp
| ... | ... | @@ -223,6 +223,8 @@ std::string GSPIPointing::print(void) const |
| 223 | 223 | |
| 224 | 224 | // Append header |
| 225 | 225 | result.append("=== GSPIPointing ==="); |
| 226 | + | |
| 227 | + // Append pointing information | |
| 226 | 228 | result.append("\n"+parformat("Pointing direction")+this->dir().print()); |
| 227 | 229 | |
| 228 | 230 | // Return result | ... | ... |
inst/spi/src/GSPIResponse.cpp
| ... | ... | @@ -29,13 +29,7 @@ |
| 29 | 29 | #include <config.h> |
| 30 | 30 | #endif |
| 31 | 31 | #include "GTools.hpp" |
| 32 | -#include "GFits.hpp" | |
| 33 | -#include "GCaldb.hpp" | |
| 34 | 32 | #include "GSPIResponse.hpp" |
| 35 | -#include "GSPIObservation.hpp" | |
| 36 | -#include "GSPIEventBin.hpp" | |
| 37 | -#include "GSPIInstDir.hpp" | |
| 38 | -#include "GSPIException.hpp" | |
| 39 | 33 | |
| 40 | 34 | /* __ Method name definitions ____________________________________________ */ |
| 41 | 35 | |
| ... | ... | @@ -236,7 +230,7 @@ double GSPIResponse::npred(const GPhoton& photon, |
| 236 | 230 | |
| 237 | 231 | |
| 238 | 232 | /***********************************************************************//** |
| 239 | - * @brief Print SPIPTEL response information | |
| 233 | + * @brief Print SPI response information | |
| 240 | 234 | * |
| 241 | 235 | * @return String containing SPI response information. |
| 242 | 236 | ***************************************************************************/ | ... | ... |