GCC Code Coverage Report


Directory: Svc/CmdSequencer/
File: Sequence.cpp
Date: 2026-10-14 21:18:12
Exec Total Coverage
Lines: 44 46 95.7%
Functions: 10 11 90.9%
Branches: 24 24 100.0%

Line Branch Exec Source
1 // ======================================================================
2 // \title Sequence.cpp
3 // \author Bocchino/Canham
4 // \brief Implementation file for CmdSequencer::Sequence
5 //
6 // Copyright (C) 2009-2018 California Institute of Technology.
7 // ALL RIGHTS RESERVED. United States Government Sponsorship
8 // acknowledged.
9 // ======================================================================
10
11 #include <Fw/Types/Assert.hpp>
12 #include <Svc/CmdSequencer/CmdSequencerImpl.hpp>
13
14 namespace Svc {
15
16 167 CmdSequencerComponentImpl::Sequence ::Sequence(CmdSequencerComponentImpl& component)
17
4/4
✓ Branch 19 taken 167 times.
✓ Branch 25 taken 167 times.
✓ Branch 31 taken 167 times.
✓ Branch 41 taken 167 times.
167 : m_component(component), m_events(*this), m_allocatorId(0) {}
18
19 334 CmdSequencerComponentImpl::Sequence ::~Sequence() {}
20
21 167 CmdSequencerComponentImpl::Sequence::Header ::Header()
22 167 : m_fileSize(0), m_numRecords(0), m_timeBase(TimeBase::TB_DONT_CARE), m_timeContext(FW_CONTEXT_DONT_CARE) {}
23
24 99 bool CmdSequencerComponentImpl::Sequence::Header ::validateTime(CmdSequencerComponentImpl& component) {
25
1/1
✓ Branch 3 taken 99 times.
99 Fw::Time validTime = component.getTime();
26 99 Events& events = component.m_sequence->m_events;
27 // Time base
28
1/1
✓ Branch 2 taken 99 times.
99 const TimeBase validTimeBase = validTime.getTimeBase();
29
6/6
✓ Branch 8 taken 31 times.
✓ Branch 9 taken 68 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 30 times.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 98 times.
99 if ((this->m_timeBase != validTimeBase) and (this->m_timeBase != TimeBase::TB_DONT_CARE)) {
30
3/3
✓ Branch 6 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 13 taken 1 times.
1 events.timeBaseMismatch(validTimeBase, this->m_timeBase);
31 1 return false;
32 }
33 // Time context
34
1/1
✓ Branch 2 taken 98 times.
98 const FwTimeContextStoreType validContext = validTime.getContext();
35
4/4
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 67 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 30 times.
98 if ((this->m_timeContext != validContext) and (this->m_timeContext != FW_CONTEXT_DONT_CARE)) {
36
1/1
✓ Branch 4 taken 1 times.
1 events.timeContextMismatch(validContext, this->m_timeContext);
37 1 return false;
38 }
39 // Canonicalize time
40
1/1
✓ Branch 6 taken 97 times.
97 this->m_timeBase = validTimeBase;
41 97 this->m_timeContext = validContext;
42 97 return true;
43 99 }
44
45 82 void CmdSequencerComponentImpl::Sequence ::allocateBuffer(FwEnumStoreType identifier,
46 Fw::MemAllocator& allocator,
47 FwSizeType bytes) {
48 // has to be at least as big as a header
49 82 FW_ASSERT(bytes >= Sequence::Header::SERIALIZED_SIZE);
50 82 bool recoverable = false;
51 82 this->m_allocatorId = identifier;
52 // Allocation may change bytes. Finish it before using the granted capacity.
53
1/1
✓ Branch 6 taken 82 times.
82 U8* const buffer = static_cast<U8*>(allocator.allocate(identifier, bytes, recoverable));
54 82 FW_ASSERT(buffer != nullptr);
55 82 FW_ASSERT(bytes >= Sequence::Header::SERIALIZED_SIZE, static_cast<FwAssertArgType>(bytes));
56
1/1
✓ Branch 6 taken 82 times.
82 this->m_buffer.setExtBuffer(buffer, bytes);
57 82 }
58
59 82 void CmdSequencerComponentImpl::Sequence ::deallocateBuffer(Fw::MemAllocator& allocator) {
60 82 allocator.deallocate(this->m_allocatorId, this->m_buffer.getBuffAddr());
61 82 this->m_buffer.clear();
62 82 }
63
64 136 const CmdSequencerComponentImpl::Sequence::Header& CmdSequencerComponentImpl::Sequence ::getHeader() const {
65 136 return this->m_header;
66 }
67
68 199 void CmdSequencerComponentImpl::Sequence ::setFileName(const Fw::ConstStringBase& fileName) {
69 199 this->m_fileName = fileName;
70 199 this->m_logFileName = fileName;
71 199 this->m_stringFileName = fileName;
72 199 }
73
74 ✗ Fw::CmdStringArg& CmdSequencerComponentImpl::Sequence ::getFileName() {
75 ✗ return this->m_fileName;
76 }
77
78 348 Fw::LogStringArg& CmdSequencerComponentImpl::Sequence ::getLogFileName() {
79 348 return this->m_logFileName;
80 }
81
82 37 Fw::String& CmdSequencerComponentImpl::Sequence ::getStringFileName() {
83 37 return this->m_stringFileName;
84 }
85
86 } // namespace Svc
87