GCC Code Coverage Report


Directory: ./
File: Fw/Obj/ObjBase.cpp
Date: 2026-09-03 21:13:48
Exec Total Coverage
Lines: 17 27 63.0%
Functions: 6 8 75.0%
Branches: 6 10 60.0%

Line Branch Exec Source
1 #include <Fw/FPrimeBasicTypes.hpp>
2 #include <Fw/Obj/ObjBase.hpp>
3 #include <Fw/Types/Assert.hpp>
4 #include <Fw/Types/ExternalString.hpp>
5
6 namespace Fw {
7
8 #if FW_OBJECT_REGISTRATION == 1
9 ObjRegistry* ObjBase::s_objRegistry = nullptr;
10 #endif
11
12 #if FW_OBJECT_NAMES == 1
13 57828 ObjBase::ObjBase(const char* objName) {
14
2/2
✓ Branch 0 taken 54741 times.
✓ Branch 1 taken 3087 times.
57828 if (nullptr == objName) {
15
1/1
✓ Branch 4 taken 54741 times.
54741 this->setObjName("NoName");
16 } else {
17
1/1
✓ Branch 4 taken 3087 times.
3087 this->setObjName(objName);
18 }
19 57828 }
20 #else
21 ObjBase::ObjBase(const char* objName) {}
22 #endif
23
24 57488 void ObjBase::init() {
25 #if FW_OBJECT_REGISTRATION
26
2/2
✓ Branch 0 taken 776 times.
✓ Branch 1 taken 56712 times.
57488 if (ObjBase::s_objRegistry) {
27 776 ObjBase::s_objRegistry->regObject(this);
28 }
29 #endif
30 57488 }
31
32 115656 ObjBase::~ObjBase() {}
33
34 #if FW_OBJECT_NAMES == 1
35 const char* ObjBase::getObjName() {
36 return this->m_objName.toChar();
37 }
38
39 112230 void ObjBase::setObjName(const char* name) {
40 112230 this->m_objName = name;
41 112230 }
42 #if FW_OBJECT_TO_STRING == 1
43 void ObjBase::toString(char* str, FwSizeType size) {
44 FW_ASSERT(size > 0);
45 FW_ASSERT(str != nullptr);
46 Fw::FormatStatus formatStatus = Fw::ExternalString(str, static_cast<Fw::ExternalString::SizeType>(size))
47 .format("Obj: %s", this->m_objName.toChar());
48 if (formatStatus != Fw::FormatStatus::SUCCESS) {
49 str[0] = 0;
50 }
51 }
52 #endif
53 #endif
54
55 #if FW_OBJECT_REGISTRATION == 1
56 8 void ObjBase::setObjRegistry(ObjRegistry* reg) {
57 8 ObjBase::s_objRegistry = reg;
58 8 }
59
60 8 ObjRegistry::~ObjRegistry() {}
61
62 #endif
63 } // namespace Fw
64