GCC Code Coverage Report


Directory: ./
File: Sequence.cpp
Date: 2026-10-14 22:12:52
Exec Total Coverage
Lines: 40 46 87.0%
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 1 bool recoverable = false;
51 1 this->m_allocatorId = identifier;
52 // Allocation may change bytes. Finish it before using the granted capacity.
53
1/1
✓ Branch 1 taken 1 times.
1 U8* const buffer = static_cast<U8*>(allocator.allocate(identifier, bytes, recoverable));
54 1 FW_ASSERT(buffer != nullptr);
55 1 FW_ASSERT(bytes >= Sequence::Header::SERIALIZED_SIZE, static_cast<FwAssertArgType>(bytes));
56
1/1
✓ Branch 1 taken 1 times.
1 this->m_buffer.setExtBuffer(buffer, bytes);
57 1 }
58
59 1 void CmdSequencerComponentImpl::Sequence ::deallocateBuffer(Fw::MemAllocator& allocator) {
60 1 allocator.deallocate(this->m_allocatorId, this->m_buffer.getBuffAddr());
61 1 this->m_buffer.clear();
62 1 }
63
64 5 const CmdSequencerComponentImpl::Sequence::Header& CmdSequencerComponentImpl::Sequence ::getHeader() const {
65 5 return this->m_header;
66 }
67
68 2 void CmdSequencerComponentImpl::Sequence ::setFileName(const Fw::ConstStringBase& fileName) {
69 2 this->m_fileName = fileName;
70 2 this->m_logFileName = fileName;
71 2 this->m_stringFileName = fileName;
72 2 }
73
74 ✗ Fw::CmdStringArg& CmdSequencerComponentImpl::Sequence ::getFileName() {
75 ✗ return this->m_fileName;
76 }
77
78 9 Fw::LogStringArg& CmdSequencerComponentImpl::Sequence ::getLogFileName() {
79 9 return this->m_logFileName;
80 }
81
82 2 Fw::String& CmdSequencerComponentImpl::Sequence ::getStringFileName() {
83 2 return this->m_stringFileName;
84 }
85
86 } // namespace Svc
87