GCC Code Coverage Report


Directory: ./
File: Sequence.cpp
Date: 2026-09-03 22:13:31
Exec Total Coverage
Lines: 36 42 85.7%
Functions: 10 11 90.9%
Branches: 15 24 62.5%

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 1 CmdSequencerComponentImpl::Sequence ::Sequence(CmdSequencerComponentImpl& component)
17
4/4
✓ Branch 3 taken 1 times.
✓ Branch 6 taken 1 times.
✓ Branch 9 taken 1 times.
✓ Branch 12 taken 1 times.
1 : m_component(component), m_events(*this), m_allocatorId(0) {}
18
19 2 CmdSequencerComponentImpl::Sequence ::~Sequence() {}
20
21 1 CmdSequencerComponentImpl::Sequence::Header ::Header()
22 1 : m_fileSize(0), m_numRecords(0), m_timeBase(TimeBase::TB_DONT_CARE), m_timeContext(FW_CONTEXT_DONT_CARE) {}
23
24 2 bool CmdSequencerComponentImpl::Sequence::Header ::validateTime(CmdSequencerComponentImpl& component) {
25
1/1
✓ Branch 1 taken 2 times.
2 Fw::Time validTime = component.getTime();
26 2 Events& events = component.m_sequence->m_events;
27 // Time base
28
1/1
✓ Branch 1 taken 2 times.
2 const TimeBase validTimeBase = validTime.getTimeBase();
29
3/6
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
2 if ((this->m_timeBase != validTimeBase) and (this->m_timeBase != TimeBase::TB_DONT_CARE)) {
30 events.timeBaseMismatch(validTimeBase, this->m_timeBase);
31 return false;
32 }
33 // Time context
34
1/1
✓ Branch 1 taken 2 times.
2 const FwTimeContextStoreType validContext = validTime.getContext();
35
2/4
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
2 if ((this->m_timeContext != validContext) and (this->m_timeContext != FW_CONTEXT_DONT_CARE)) {
36 events.timeContextMismatch(validContext, this->m_timeContext);
37 return false;
38 }
39 // Canonicalize time
40
1/1
✓ Branch 1 taken 2 times.
2 this->m_timeBase = validTimeBase;
41 2 this->m_timeContext = validContext;
42 2 return true;
43 2 }
44
45 1 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 1 FW_ASSERT(bytes >= Sequence::Header::SERIALIZED_SIZE);
50 bool recoverable;
51 1 this->m_allocatorId = identifier;
52
2/2
✓ Branch 1 taken 1 times.
✓ Branch 4 taken 1 times.
1 this->m_buffer.setExtBuffer(static_cast<U8*>(allocator.allocate(identifier, bytes, recoverable)), bytes);
53 1 }
54
55 1 void CmdSequencerComponentImpl::Sequence ::deallocateBuffer(Fw::MemAllocator& allocator) {
56 1 allocator.deallocate(this->m_allocatorId, this->m_buffer.getBuffAddr());
57 1 this->m_buffer.clear();
58 1 }
59
60 5 const CmdSequencerComponentImpl::Sequence::Header& CmdSequencerComponentImpl::Sequence ::getHeader() const {
61 5 return this->m_header;
62 }
63
64 2 void CmdSequencerComponentImpl::Sequence ::setFileName(const Fw::ConstStringBase& fileName) {
65 2 this->m_fileName = fileName;
66 2 this->m_logFileName = fileName;
67 2 this->m_stringFileName = fileName;
68 2 }
69
70 Fw::CmdStringArg& CmdSequencerComponentImpl::Sequence ::getFileName() {
71 return this->m_fileName;
72 }
73
74 9 Fw::LogStringArg& CmdSequencerComponentImpl::Sequence ::getLogFileName() {
75 9 return this->m_logFileName;
76 }
77
78 2 Fw::String& CmdSequencerComponentImpl::Sequence ::getStringFileName() {
79 2 return this->m_stringFileName;
80 }
81
82 } // namespace Svc
83