F´ Flight Software - C/C++ Documentation  NASA-v2.0.1
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InputSerializePort.cpp
Go to the documentation of this file.
2 #include <Fw/Types/Assert.hpp>
3 #include <stdio.h>
4 
5 #if FW_PORT_SERIALIZATION == 1
6 
7 namespace Fw {
8 
9  // SerializePort has no call interface. It is to pass through serialized data
10  InputSerializePort::InputSerializePort() : InputPortBase(), m_func(0) {
11  }
12  InputSerializePort::~InputSerializePort() {
13  }
14 
15  void InputSerializePort::init(void) {
17 
18  }
19 
20  SerializeStatus InputSerializePort::invokeSerial(SerializeBufferBase &buffer) {
21  FW_ASSERT(this->m_comp);
22  FW_ASSERT(this->m_func);
23 
24  this->m_func(this->m_comp,this->m_portNum,buffer);
25 
26  // The normal input ports perform deserialize() on the passed buffer,
27  // which is what this status is based on. This is not the case for the
28  // InputSerializePort, so just return a okay status
29  return FW_SERIALIZE_OK;
30  }
31 
32  void InputSerializePort::addCallComp(Fw::PassiveComponentBase* callComp, CompFuncPtr funcPtr) {
33  FW_ASSERT(callComp);
34  FW_ASSERT(funcPtr);
35  this->m_comp = callComp;
36  this->m_func = funcPtr;
37  }
38 
39 #if FW_OBJECT_TO_STRING == 1
40  void InputSerializePort::toString(char* buffer, NATIVE_INT_TYPE size) {
41 #if FW_OBJECT_NAMES == 1
42  (void)snprintf(buffer, size, "Input Serial Port: %s %s->(%s)", this->m_objName, this->isConnected() ? "C" : "NC",
43  this->isConnected() ? this->m_connObj->getObjName() : "None");
44  buffer[size-1] = 0;
45 #else
46  (void)snprintf(buffer,size,"%s","InputSerializePort");
47 #endif
48  }
49 #endif
50 
51 }
52 #endif
Fw::SerializeStatus
SerializeStatus
forward declaration for string
Definition: Serializable.hpp:14
InputSerializePort.hpp
Assert.hpp
Fw::FW_SERIALIZE_OK
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.
Definition: Serializable.hpp:15
Fw::PassiveComponentBase
Definition: PassiveComponentBase.hpp:10
FW_ASSERT
#define FW_ASSERT(...)
Definition: Assert.hpp:9
Fw::InputPortBase::init
virtual void init(void)
Definition: InputPortBase.cpp:20
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:29
Fw
Definition: Buffer.cpp:21