F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
PingPortAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title PingPortAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for Ping port
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
10 
11 namespace Svc {
12 
13  namespace {
14 
15  // ----------------------------------------------------------------------
16  // Port buffer class
17  // ----------------------------------------------------------------------
18 
19  class PingPortBuffer : public Fw::SerializeBufferBase {
20 
21  public:
22 
23  Fw::Serializable::SizeType getBuffCapacity() const {
25  }
26 
27  U8* getBuffAddr() {
28  return m_buff;
29  }
30 
31  const U8* getBuffAddr() const {
32  return m_buff;
33  }
34 
35  private:
36 
38 
39  };
40 
41  }
42 
43  // ----------------------------------------------------------------------
44  // Input Port Member functions
45  // ----------------------------------------------------------------------
46 
49  Fw::InputPortBase(),
50  m_func(nullptr)
51  {
52 
53  }
54 
56  init()
57  {
59  }
60 
63  Fw::PassiveComponentBase* callComp,
64  CompFuncPtr funcPtr
65  )
66  {
67  FW_ASSERT(callComp != nullptr);
68  FW_ASSERT(funcPtr != nullptr);
69 
70  this->m_comp = callComp;
71  this->m_func = funcPtr;
72  this->m_connObj = callComp;
73  }
74 
76  invoke(U32 key)
77  {
78 #if FW_PORT_TRACING == 1
79  this->trace();
80 #endif
81 
82  FW_ASSERT(this->m_comp != nullptr);
83  FW_ASSERT(this->m_func != nullptr);
84 
85  return this->m_func(this->m_comp, this->m_portNum, key);
86  }
87 
88 #if FW_PORT_SERIALIZATION == 1
89 
90  Fw::SerializeStatus InputPingPort ::
91  invokeSerial(Fw::SerializeBufferBase& _buffer)
92  {
93  Fw::SerializeStatus _status;
94 
95 #if FW_PORT_TRACING == 1
96  this->trace();
97 #endif
98 
99  FW_ASSERT(this->m_comp != nullptr);
100  FW_ASSERT(this->m_func != nullptr);
101 
102  U32 key;
103  _status = _buffer.deserialize(key);
104  if (_status != Fw::FW_SERIALIZE_OK) {
105  return _status;
106  }
107 
108  this->m_func(this->m_comp, this->m_portNum, key);
109 
110  return Fw::FW_SERIALIZE_OK;
111  }
112 
113 #endif
114 
115  // ----------------------------------------------------------------------
116  // Output Port Member functions
117  // ----------------------------------------------------------------------
118 
120  OutputPingPort() :
121  Fw::OutputPortBase(),
122  m_port(nullptr)
123  {
124 
125  }
126 
128  init()
129  {
131  }
132 
134  addCallPort(InputPingPort* callPort)
135  {
136  FW_ASSERT(callPort != nullptr);
137 
138  this->m_port = callPort;
139  this->m_connObj = callPort;
140 
141 #if FW_PORT_SERIALIZATION == 1
142  this->m_serPort = nullptr;
143 #endif
144  }
145 
147  invoke(U32 key)
148  {
149 #if FW_PORT_TRACING == 1
150  this->trace();
151 #endif
152 
153 #if FW_PORT_SERIALIZATION
154  FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));
155 
156  if (this->m_port != nullptr) {
157  this->m_port->invoke(key);
158  }
159  else {
160  Fw::SerializeStatus _status;
161  PingPortBuffer _buffer;
162 
163  _status = _buffer.serialize(key);
164  FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
165 
166  _status = this->m_serPort->invokeSerial(_buffer);
167  FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
168  }
169 #else
170  FW_ASSERT(this->m_port != nullptr);
171  this->m_port->invoke(key);
172 #endif
173  }
174 
175 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:30
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:39
NATIVE_INT_TYPE m_portNum
virtual void init()
PassiveComponentBase * m_comp
virtual void init()
Fw::ObjBase * m_connObj
Definition: PortBase.hpp:33
NATIVE_UINT_TYPE SizeType
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
InputPingPort()
Constructor.
Definition: PingPortAc.cpp:48
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: PingPortAc.cpp:62
void init()
Initialization function.
Definition: PingPortAc.cpp:56
void invoke(U32 key)
Invoke a port interface.
Definition: PingPortAc.cpp:76
@ SERIALIZED_SIZE
The size of the serial representations of the port arguments.
Definition: PingPortAc.hpp:36
void invoke(U32 key)
Invoke a port interface.
Definition: PingPortAc.cpp:147
void init()
Initialization function.
Definition: PingPortAc.cpp:128
void addCallPort(InputPingPort *callPort)
Register an input port.
Definition: PingPortAc.cpp:134
OutputPingPort()
Constructor.
Definition: PingPortAc.cpp:120
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.