F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ReadyPortAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ReadyPortAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for Ready port
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
9 
10 namespace Fw {
11 
12 #if !FW_DIRECT_PORT_CALLS
13 
14  // ----------------------------------------------------------------------
15  // Public constructors for InputReadyPort
16  // ----------------------------------------------------------------------
17 
20  Fw::InputPortBase(),
21  m_func(nullptr)
22  {
23 
24  }
25 
26  // ----------------------------------------------------------------------
27  // Public member functions for InputReadyPort
28  // ----------------------------------------------------------------------
29 
32  {
34  }
35 
38  Fw::PassiveComponentBase* callComp,
39  CompFuncPtr funcPtr
40  )
41  {
42  FW_ASSERT(callComp != nullptr);
43  FW_ASSERT(funcPtr != nullptr);
44 
45  this->m_comp = callComp;
46  this->m_func = funcPtr;
47  this->m_connObj = callComp;
48  }
49 
52  {
53 #if FW_PORT_TRACING == 1
54  this->trace();
55 #endif
56 
57  FW_ASSERT(this->m_comp != nullptr);
58  FW_ASSERT(this->m_func != nullptr);
59 
60  return this->m_func(this->m_comp, this->m_portNum);
61  }
62 
63  // ----------------------------------------------------------------------
64  // Private member functions for InputReadyPort
65  // ----------------------------------------------------------------------
66 
67 #if FW_PORT_SERIALIZATION == 1
68 
69  Fw::SerializeStatus InputReadyPort ::
70  invokeSerial(Fw::LinearBufferBase& _buffer)
71  {
72 #if FW_PORT_TRACING == 1
73  this->trace();
74 #endif
75 
76  FW_ASSERT(this->m_comp != nullptr);
77  FW_ASSERT(this->m_func != nullptr);
78 
79  (void) _buffer;
80 
81  this->m_func(this->m_comp, this->m_portNum);
82 
83  return Fw::FW_SERIALIZE_OK;
84  }
85 
86 #endif
87 
88  // ----------------------------------------------------------------------
89  // Public constructors for OutputReadyPort
90  // ----------------------------------------------------------------------
91 
94  Fw::OutputPortBase(),
95  m_port(nullptr)
96  {
97 
98  }
99 
100  // ----------------------------------------------------------------------
101  // Public member functions for OutputReadyPort
102  // ----------------------------------------------------------------------
103 
104  void OutputReadyPort ::
106  {
108  }
109 
110  void OutputReadyPort ::
112  {
113  FW_ASSERT(callPort != nullptr);
114 
115  this->m_port = callPort;
116  this->m_connObj = callPort;
117 
118 #if FW_PORT_SERIALIZATION == 1
119  this->m_serPort = nullptr;
120 #endif
121  }
122 
123  void OutputReadyPort ::
124  invoke() const
125  {
126 #if FW_PORT_TRACING == 1
127  this->trace();
128 #endif
129 
130 #if FW_PORT_SERIALIZATION
131  FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));
132 
133  if (this->m_port != nullptr) {
134  this->m_port->invoke();
135  }
136  else {
137  Fw::SerializeStatus _status;
138  ReadyPortBuffer _buffer;
139 
140  _status = this->m_serPort->invokeSerial(_buffer);
141  FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
142  }
143 #else
144  FW_ASSERT(this->m_port != nullptr);
145  this->m_port->invoke();
146 #endif
147  }
148 
149 #endif
150 
151 }
void init()
Initialization function.
Serialization/Deserialization operation was successful.
FwIndexType m_portNum
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: ReadyPortAc.cpp:37
void init()
Initialization function.
Definition: ReadyPortAc.cpp:31
SerializeStatus
forward declaration for string
void invoke()
Invoke a port interface.
Definition: ReadyPortAc.cpp:51
void init() override
InputReadyPort()
Constructor.
Definition: ReadyPortAc.cpp:19
PassiveComponentBase * m_comp
OutputReadyPort()
Constructor.
Definition: ReadyPortAc.cpp:93
void init() override
void addCallPort(InputReadyPort *callPort)
Register an input port.
Implementation of malloc based allocator.
void invoke() const
Invoke a port connection.
Fw::ObjBase * m_connObj
Definition: PortBase.hpp:34
#define FW_ASSERT(...)
Definition: Assert.hpp:14