GCC Code Coverage Report


Directory: Svc/Ccsds/CfdpManager/
File: Timer.cpp
Date: 2026-10-14 21:17:52
Exec Total Coverage
Lines: 19 19 100.0%
Functions: 6 6 100.0%
Branches: 5 8 62.5%

Line Branch Exec Source
1 // ======================================================================
2 // \title Timer.cpp
3 // \author Brian Campuzano
4 // \brief cpp file for the Timer class implementation
5 // ======================================================================
6
7 #include <Svc/Ccsds/CfdpManager/Timer.hpp>
8
9 #include <Fw/Types/Assert.hpp>
10
11 namespace Svc {
12 namespace Ccsds {
13 namespace Cfdp {
14
15 // ----------------------------------------------------------------------
16 // Class construction and destruction
17 // ----------------------------------------------------------------------
18
19 30240 Timer ::Timer() : timerStatus(UNINITIALIZED), secondsRemaining(0) {}
20
21 30240 Timer ::~Timer() {}
22
23 // ----------------------------------------------------------------------
24 // Class interfaces
25 // ----------------------------------------------------------------------
26
27 285 void Timer ::setTimer(U32 timerDuration) {
28 285 this->timerStatus = RUNNING;
29 285 this->secondsRemaining = timerDuration;
30 285 }
31
32 28852 void Timer ::disableTimer(void) {
33 28852 this->timerStatus = EXPIRED;
34 28852 this->secondsRemaining = 0;
35 28852 }
36
37 358 Timer::Status Timer ::getStatus(void) {
38
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 358 times.
358 return this->timerStatus;
39 }
40
41 197 void Timer ::run(void) {
42
2/4
✗ Branch 1 not taken.
✓ Branch 2 taken 197 times.
✓ Branch 3 taken 197 times.
✗ Branch 4 not taken.
197 if (this->timerStatus == RUNNING) {
43 197 FW_ASSERT(this->secondsRemaining > 0);
44 197 this->secondsRemaining--;
45
46
2/2
✓ Branch 2 taken 43 times.
✓ Branch 3 taken 154 times.
197 if (this->secondsRemaining == 0) {
47 43 this->timerStatus = EXPIRED;
48 }
49 }
50 197 }
51
52 } // namespace Cfdp
53 } // namespace Ccsds
54 } // namespace Svc
55