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
OutputPortBase.cpp
Go to the documentation of this file.
1 #include <FpConfig.hpp>
3 #include <Os/Console.hpp>
4 #include <cstdio>
5 #include <Fw/Types/Assert.hpp>
6 
7 
8 namespace Fw {
9 
11 #if FW_PORT_SERIALIZATION == 1
12  ,m_serPort(nullptr)
13 #endif
14  {
15 
16  }
17 
19  }
20 
23  }
24 #if FW_PORT_SERIALIZATION == 1
25  void OutputPortBase::registerSerialPort(InputPortBase* port) {
26  FW_ASSERT(port);
27  this->m_connObj = port;
28  this->m_serPort = port;
29  }
30 
31  SerializeStatus OutputPortBase::invokeSerial(SerializeBufferBase &buffer) {
32  FW_ASSERT(this->m_serPort);
33  return this->m_serPort->invokeSerial(buffer);
34  }
35 #endif
36 
37 #if FW_OBJECT_TO_STRING == 1
38  void OutputPortBase::toString(char* buffer, NATIVE_INT_TYPE size) {
39 #if FW_OBJECT_NAMES == 1
40  FW_ASSERT(size > 0);
41  if (snprintf(buffer, static_cast<size_t>(size), "OutputPort: %s %s->(%s)", this->m_objName.toChar(), this->isConnected() ? "C" : "NC",
42  this->isConnected() ? this->m_connObj->getObjName() : "None") < 0) {
43  buffer[0] = 0;
44  }
45 #else
46  (void)snprintf(buffer,size,"%s","OutputPort");
47 #endif
48 
49  }
50 #endif
51 
52 
53 }
54 
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:55
#define FW_PORT_SERIALIZATION
for multi-note systems)
Definition: FpConfig.h:204
C++-compatible configuration header for fprime configuration.
virtual void init()
virtual void init()
Definition: PortBase.cpp:36
Fw::ObjBase * m_connObj
Definition: PortBase.hpp:33
SerializeStatus
forward declaration for string