F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
InputPortBase.cpp
Go to the documentation of this file.
1 #include <FpConfig.hpp>
3 #include <Fw/Types/Assert.hpp>
4 #include <cstdio>
5 
6 namespace Fw {
7 
9  PortBase(),
10  m_comp(nullptr),
11  m_portNum(-1) {
12  }
13 
15 
16  }
17 
20 
21  }
22 
24  FW_ASSERT(portNum >= 0,portNum);
25  this->m_portNum = portNum;
26  }
27 
28 #if FW_OBJECT_TO_STRING == 1
29  void InputPortBase::toString(char* buffer, NATIVE_INT_TYPE size) {
30 #if FW_OBJECT_NAMES == 1
31  FW_ASSERT(size > 0);
32  FW_ASSERT(buffer != nullptr);
33  PlatformIntType status = snprintf(buffer, static_cast<size_t>(size), "InputPort: %s->%s", this->m_objName.toChar(),
34  this->isConnected() ? this->m_connObj->getObjName() : "None");
35  if (status < 0) {
36  buffer[0] = 0;
37  }
38 #else
39  (void)snprintf(buffer,size,"%s","Unnamed Input port");
40 #endif
41  }
42 #endif
43 
44 
45 }
46 
#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.
virtual ~InputPortBase()
NATIVE_INT_TYPE m_portNum
virtual void init()
void setPortNum(NATIVE_INT_TYPE portNum)
virtual void init()
Definition: PortBase.cpp:36