F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PassiveComponentBase.cpp
Go to the documentation of this file.
2 #include <Fw/Types/Assert.hpp>
3 #include <FpConfig.hpp>
4 
5 #include <cstdio>
6 
7 namespace Fw {
8 
9  PassiveComponentBase::PassiveComponentBase(const char* name) : Fw::ObjBase(name), m_idBase(0), m_instance(0) {
10  }
11 
12 #if FW_OBJECT_TO_STRING == 1 && FW_OBJECT_NAMES == 1
13  void PassiveComponentBase::toString(char* buffer, NATIVE_INT_TYPE size) {
14  FW_ASSERT(size > 0);
15  FW_ASSERT(buffer != nullptr);
16  PlatformIntType status = snprintf(buffer, static_cast<size_t>(size), "Comp: %s", this->m_objName.toChar());
17  if (status < 0) {
18  buffer[0] = 0;
19  }
20  }
21 #endif
22 
24  }
25 
27  ObjBase::init();
28  this->m_instance = instance;
29  }
30 
32  return this->m_instance;
33  }
34 
36  setIdBase(const U32 idBase)
37  {
38  this->m_idBase = idBase;
39  }
40 
42  getIdBase() const
43  {
44  return this->m_idBase;
45  }
46 
47 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:55
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
C++-compatible configuration header for fprime configuration.
Brief class description.
Definition: ObjBase.hpp:35
void init()
Object initializer.
Definition: ObjBase.cpp:27
NATIVE_INT_TYPE getInstance() const
PassiveComponentBase(const char *name)
Named constructor.
virtual ~PassiveComponentBase()
Destructor.
void setIdBase(const U32)
Set the ID base.