F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
PassiveComponentBase.cpp
Go to the documentation of this file.
3 #include <Fw/Types/Assert.hpp>
4 
6 
7 namespace Fw {
8 
9 PassiveComponentBase::PassiveComponentBase(const char* name) : Fw::ObjBase(name), m_idBase(0), m_instance(0) {}
10 
11 #if FW_OBJECT_TO_STRING == 1
12 const char* PassiveComponentBase::getToStringFormatString() {
13  return "Comp: %s";
14 }
15 
16 void PassiveComponentBase::toString(char* buffer, FwSizeType size) {
17  FW_ASSERT(size > 0);
18  FW_ASSERT(buffer != nullptr);
19  Fw::FormatStatus status = Fw::ExternalString(buffer, static_cast<Fw::ExternalString::SizeType>(size))
20  .format(this->getToStringFormatString(),
21 #if FW_OBJECT_NAMES == 1
22  this->m_objName.toChar()
23 #else
24  "UNKNOWN"
25 #endif
26  );
27  if (status != Fw::FormatStatus::SUCCESS) {
28  buffer[0] = 0;
29  }
30 }
31 #endif
32 
34 
36  ObjBase::init();
37  this->m_instance = instance;
38 }
39 
41  return this->m_instance;
42 }
43 
45  this->m_idBase = idBase;
46 }
47 
49  return this->m_idBase;
50 }
51 
52 } // namespace Fw
void setIdBase(const FwIdType)
Set the ID base.
PlatformSizeType FwSizeType
I32 FwEnumStoreType
FwEnumStoreType getInstance() const
PassiveComponentBase(const char *name)
Named constructor.
void init()
Object initializer.
Definition: ObjBase.cpp:24
#define FW_OBJECT_NAMES
Indicates whether or not object names are stored (more memory, can be used for tracking objects) ...
Definition: FpConfig.h:41
Brief class description.
Definition: ObjBase.hpp:35
virtual ~PassiveComponentBase()
Destructor.
A string backed by an external buffer.
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
#define FW_ASSERT(...)
Definition: Assert.hpp:14
U32 FwIdType
The id type.
FormatStatus
status of string format calls
Definition: format.hpp:18