GCC Code Coverage Report


Directory: Svc/CmdSequencer/
File: Sequence.cpp
Date: 2026-11-03 21:18:07
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 186 CmdSequencerComponentImpl::Sequence ::Sequence(CmdSequencerComponentImpl& component)
17
4/4
✓ Branch 19 taken 186 times.
✓ Branch 25 taken 186 times.
✓ Branch 31 taken 186 times.
✓ Branch 41 taken 186 times.
186 : m_component(component), m_events(*this), m_allocatorId(0) {}
18
19 372 CmdSequencerComponentImpl::Sequence ::~Sequence() {}
20
21 186 CmdSequencerComponentImpl::Sequence::Header ::Header()
22 186 : m_fileSize(0), m_numRecords(0), m_timeBase(TimeBase::TB_DONT_CARE), m_timeContext(FW_CONTEXT_DONT_CARE) {}
23
24 108 bool CmdSequencerComponentImpl::Sequence::Header ::validateTime(CmdSequencerComponentImpl& component) {
25
1/1
✓ Branch 3 taken 108 times.
108 Fw::Time validTime = component.getTime();
26 108 Events& events = component.m_sequence->m_events;
27 // Time base
28
1/1
✓ Branch 2 taken 108 times.
108 const TimeBase validTimeBase = validTime.getTimeBase();
29
6/6
✓ Branch 8 taken 36 times.
✓ Branch 9 taken 72 times.
✓ Branch 16 taken 1 times.
✓ Branch 17 taken 35 times.
✓ Branch 18 taken 1 times.
✓ Branch 19 taken 107 times.
108 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 107 times.
107 const FwTimeContextStoreType validContext = validTime.getContext();
35
4/4
✓ Branch 2 taken 36 times.
✓ Branch 3 taken 71 times.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 35 times.
107 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 106 times.
106 this->m_timeBase = validTimeBase;
41 106 this->m_timeContext = validContext;
42 106 return true;
43 108 }
44
45 92 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 92 FW_ASSERT(bytes >= Sequence::Header::SERIALIZED_SIZE);
50 92 bool recoverable = false;
51 92 this->m_allocatorId = identifier;
52 // Allocation may change bytes. Finish it before using the granted capacity.
53
1/1
✓ Branch 6 taken 92 times.
92 U8* const buffer = static_cast<U8*>(allocator.allocate(identifier, bytes, recoverable));
54 92 FW_ASSERT(buffer != nullptr);
55 92 FW_ASSERT(bytes >= Sequence::Header::SERIALIZED_SIZE, static_cast<FwAssertArgType>(bytes));
56
1/1
✓ Branch 6 taken 92 times.
92 this->m_buffer.setExtBuffer(buffer, bytes);
57 92 }
58
59 92 void CmdSequencerComponentImpl::Sequence ::deallocateBuffer(Fw::MemAllocator& allocator) {
60 92 allocator.deallocate(this->m_allocatorId, this->m_buffer.getBuffAddr());
61 92 this->m_buffer.clear();
62 92 }
63
64 154 const CmdSequencerComponentImpl::Sequence::Header& CmdSequencerComponentImpl::Sequence ::getHeader() const {
65 154 return this->m_header;
66 }
67
68 220 void CmdSequencerComponentImpl::Sequence ::setFileName(const Fw::ConstStringBase& fileName) {
69 220 this->m_fileName = fileName;
70 220 this->m_logFileName = fileName;
71 220 this->m_stringFileName = fileName;
72 220 }
73
74 ✗ Fw::FileNameString& CmdSequencerComponentImpl::Sequence ::getFileName() {
75 ✗ return this->m_fileName;
76 }
77
78 386 Fw::LogStringArg& CmdSequencerComponentImpl::Sequence ::getLogFileName() {
79 386 return this->m_logFileName;
80 }
81
82 42 Fw::String& CmdSequencerComponentImpl::Sequence ::getStringFileName() {
83 42 return this->m_stringFileName;
84 }
85
86 } // namespace Svc
87