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"
10 
11 namespace Fw {
12 
13  namespace {
14 
15  // ----------------------------------------------------------------------
16  // Port buffer class
17  // ----------------------------------------------------------------------
18 
19  class ReadyPortBuffer : public Fw::SerializeBufferBase {
20 
21  public:
22 
23  Fw::Serializable::SizeType getBuffCapacity() const {
25  }
26 
27  U8* getBuffAddr() {
28  return nullptr;
29  }
30 
31  const U8* getBuffAddr() const {
32  return nullptr;
33  }
34 
35  };
36 
37  }
38 
39  // ----------------------------------------------------------------------
40  // Input Port Member functions
41  // ----------------------------------------------------------------------
42 
45  Fw::InputPortBase(),
46  m_func(nullptr)
47  {
48 
49  }
50 
53  {
55  }
56 
59  Fw::PassiveComponentBase* callComp,
60  CompFuncPtr funcPtr
61  )
62  {
63  FW_ASSERT(callComp != nullptr);
64  FW_ASSERT(funcPtr != nullptr);
65 
66  this->m_comp = callComp;
67  this->m_func = funcPtr;
68  this->m_connObj = callComp;
69  }
70 
73  {
74 #if FW_PORT_TRACING == 1
75  this->trace();
76 #endif
77 
78  FW_ASSERT(this->m_comp != nullptr);
79  FW_ASSERT(this->m_func != nullptr);
80 
81  return this->m_func(this->m_comp, this->m_portNum);
82  }
83 
84 #if FW_PORT_SERIALIZATION == 1
85 
86  Fw::SerializeStatus InputReadyPort ::
87  invokeSerial(Fw::SerializeBufferBase& _buffer)
88  {
89  (void) _buffer;
90 
91 #if FW_PORT_TRACING == 1
92  this->trace();
93 #endif
94 
95  FW_ASSERT(this->m_comp != nullptr);
96  FW_ASSERT(this->m_func != nullptr);
97 
98  this->m_func(this->m_comp, this->m_portNum);
99 
100  return Fw::FW_SERIALIZE_OK;
101  }
102 
103 #endif
104 
105  // ----------------------------------------------------------------------
106  // Output Port Member functions
107  // ----------------------------------------------------------------------
108 
111  Fw::OutputPortBase(),
112  m_port(nullptr)
113  {
114 
115  }
116 
117  void OutputReadyPort ::
119  {
121  }
122 
123  void OutputReadyPort ::
125  {
126  FW_ASSERT(callPort != nullptr);
127 
128  this->m_port = callPort;
129  this->m_connObj = callPort;
130 
131 #if FW_PORT_SERIALIZATION == 1
132  this->m_serPort = nullptr;
133 #endif
134  }
135 
136  void OutputReadyPort ::
137  invoke() const
138  {
139 #if FW_PORT_TRACING == 1
140  this->trace();
141 #endif
142 
143 #if FW_PORT_SERIALIZATION
144  FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));
145 
146  if (this->m_port != nullptr) {
147  this->m_port->invoke();
148  }
149  else {
150  Fw::SerializeStatus _status;
151  ReadyPortBuffer _buffer;
152 
153  _status = this->m_serPort->invokeSerial(_buffer);
154  FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
155  }
156 #else
157  FW_ASSERT(this->m_port != nullptr);
158  this->m_port->invoke();
159 #endif
160  }
161 
162 }
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:58
void init()
Initialization function.
Definition: ReadyPortAc.cpp:52
The size of the serial representations of the port arguments.
Definition: ReadyPortAc.hpp:49
SerializeStatus
forward declaration for string
void invoke()
Invoke a port interface.
Definition: ReadyPortAc.cpp:72
void init() override
FwSizeType SizeType
InputReadyPort()
Constructor.
Definition: ReadyPortAc.cpp:44
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:32
PassiveComponentBase * m_comp
OutputReadyPort()
Constructor.
void init() override
void addCallPort(InputReadyPort *callPort)
Register an input port.
void invoke() const
Invoke a port interface.
Fw::ObjBase * m_connObj
Definition: PortBase.hpp:33
#define FW_ASSERT(...)
Definition: Assert.hpp:14