Commit fec7d23d3be2ae1809c616c55dd38cd6718a8fbc
1 parent
70d3ef0e
add isin() method
Showing
2 changed files
with
24 additions
and
0 deletions
include/GGti.hpp
src/obs/GGti.cpp
| ... | ... | @@ -422,6 +422,29 @@ GTime GGti::tstop(int inx) const |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | |
| 425 | +/***********************************************************************//** | |
| 426 | + * @brief Tests whether time is within GTI intervals | |
| 427 | + * | |
| 428 | + * @param[in] t Time to be tested. | |
| 429 | + ***************************************************************************/ | |
| 430 | +bool GGti::isin(const GTime& t) const | |
| 431 | +{ | |
| 432 | + // Initialise test | |
| 433 | + bool found = false; | |
| 434 | + | |
| 435 | + // Test all GTIs | |
| 436 | + for (int i = 0; i < m_num; ++i) { | |
| 437 | + if (t >= m_start[i] && t <= m_stop[i]) { | |
| 438 | + found = true; | |
| 439 | + break; | |
| 440 | + } | |
| 441 | + } | |
| 442 | + | |
| 443 | + // Return result | |
| 444 | + return found; | |
| 445 | +} | |
| 446 | + | |
| 447 | + | |
| 425 | 448 | /*========================================================================== |
| 426 | 449 | = = |
| 427 | 450 | = Private methods = | ... | ... |