F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
UdpComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title UdpComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for Udp component base class
5 // ======================================================================
6 
7 #ifndef Drv_UdpComponentAc_HPP
8 #define Drv_UdpComponentAc_HPP
9 
16 #include "Fw/FPrimeBasicTypes.hpp"
19 #include "Os/Mutex.hpp"
20 
21 namespace Drv {
22 
27  {
28 
29  // ----------------------------------------------------------------------
30  // Friend classes
31  // ----------------------------------------------------------------------
32 
34  friend class UdpTesterBase;
36  friend class UdpTester;
37 
38  protected:
39 
40  // ----------------------------------------------------------------------
41  // Constants
42  // ----------------------------------------------------------------------
43 
45  enum {
48  };
49 
51  enum {
56  };
57 
58  public:
59 
60  // ----------------------------------------------------------------------
61  // Component initialization
62  // ----------------------------------------------------------------------
63 
65  void init(
66  FwEnumStoreType instance = 0
67  );
68 
69  public:
70 
71  // ----------------------------------------------------------------------
72  // Getters for typed input ports
73  // ----------------------------------------------------------------------
74 
79  FwIndexType portNum
80  );
81 
86  FwIndexType portNum
87  );
88 
89  public:
90 
91  // ----------------------------------------------------------------------
92  // Connect typed input ports to typed output ports
93  // ----------------------------------------------------------------------
94 
97  FwIndexType portNum,
99  );
100 
103  FwIndexType portNum,
105  );
106 
109  FwIndexType portNum,
111  );
112 
114  void set_recv_OutputPort(
115  FwIndexType portNum,
117  );
118 
119 #if FW_PORT_SERIALIZATION
120 
121  public:
122 
123  // ----------------------------------------------------------------------
124  // Connect serial input ports to typed output ports
125  // ----------------------------------------------------------------------
126 
129  FwIndexType portNum,
130  Fw::InputSerializePort* port
131  );
132 
135  FwIndexType portNum,
136  Fw::InputSerializePort* port
137  );
138 
140  void set_recv_OutputPort(
141  FwIndexType portNum,
142  Fw::InputSerializePort* port
143  );
144 
145 #endif
146 
147  protected:
148 
149  // ----------------------------------------------------------------------
150  // Component construction and destruction
151  // ----------------------------------------------------------------------
152 
155  const char* compName = ""
156  );
157 
159  virtual ~UdpComponentBase();
160 
161  protected:
162 
163  // ----------------------------------------------------------------------
164  // Getters for numbers of typed input ports
165  // ----------------------------------------------------------------------
166 
171 
176 
177  protected:
178 
179  // ----------------------------------------------------------------------
180  // Getters for numbers of typed output ports
181  // ----------------------------------------------------------------------
182 
187 
192 
197 
202 
203  protected:
204 
205  // ----------------------------------------------------------------------
206  // Connection status queries for typed output ports
207  // ----------------------------------------------------------------------
208 
213  FwIndexType portNum
214  );
215 
220  FwIndexType portNum
221  );
222 
227  FwIndexType portNum
228  );
229 
234  FwIndexType portNum
235  );
236 
237  protected:
238 
239  // ----------------------------------------------------------------------
240  // Handlers to implement for typed input ports
241  // ----------------------------------------------------------------------
242 
244  virtual void recvReturnIn_handler(
245  FwIndexType portNum,
246  Fw::Buffer& fwBuffer
247  ) = 0;
248 
251  FwIndexType portNum,
252  Fw::Buffer& sendBuffer
253  ) = 0;
254 
255  protected:
256 
257  // ----------------------------------------------------------------------
258  // Port handler base-class functions for typed input ports
259  //
260  // Call these functions directly to bypass the corresponding ports
261  // ----------------------------------------------------------------------
262 
265  FwIndexType portNum,
266  Fw::Buffer& fwBuffer
267  );
268 
271  FwIndexType portNum,
272  Fw::Buffer& sendBuffer
273  );
274 
275  protected:
276 
277  // ----------------------------------------------------------------------
278  // Invocation functions for typed output ports
279  // ----------------------------------------------------------------------
280 
283  FwIndexType portNum,
284  FwSizeType size
285  );
286 
288  void deallocate_out(
289  FwIndexType portNum,
290  Fw::Buffer& fwBuffer
291  );
292 
294  void ready_out(
295  FwIndexType portNum
296  );
297 
299  void recv_out(
300  FwIndexType portNum,
301  Fw::Buffer& buffer,
302  const Drv::ByteStreamStatus& status
303  );
304 
305  protected:
306 
307  // ----------------------------------------------------------------------
308  // Mutex operations for guarded ports
309  //
310  // You can override these operations to provide more sophisticated
311  // synchronization
312  // ----------------------------------------------------------------------
313 
315  virtual void lock();
316 
318  virtual void unLock();
319 
320  private:
321 
322  // ----------------------------------------------------------------------
323  // Calls for messages received on typed input ports
324  // ----------------------------------------------------------------------
325 
327  static void m_p_recvReturnIn_in(
328  Fw::PassiveComponentBase* callComp,
329  FwIndexType portNum,
330  Fw::Buffer& fwBuffer
331  );
332 
334  static Drv::ByteStreamStatus m_p_send_in(
335  Fw::PassiveComponentBase* callComp,
336  FwIndexType portNum,
337  Fw::Buffer& sendBuffer
338  );
339 
340  private:
341 
342  // ----------------------------------------------------------------------
343  // Typed input ports
344  // ----------------------------------------------------------------------
345 
347  Fw::InputBufferSendPort m_recvReturnIn_InputPort[NUM_RECVRETURNIN_INPUT_PORTS];
348 
351 
352  private:
353 
354  // ----------------------------------------------------------------------
355  // Typed output ports
356  // ----------------------------------------------------------------------
357 
359  Fw::OutputBufferGetPort m_allocate_OutputPort[NUM_ALLOCATE_OUTPUT_PORTS];
360 
362  Fw::OutputBufferSendPort m_deallocate_OutputPort[NUM_DEALLOCATE_OUTPUT_PORTS];
363 
366 
369 
370  private:
371 
372  // ----------------------------------------------------------------------
373  // Mutexes
374  // ----------------------------------------------------------------------
375 
377  Os::Mutex m_guardedPortMutex;
378 
379  };
380 
381 }
382 
383 #endif
virtual ~UdpComponentBase()
Destroy UdpComponentBase object.
void recv_out(FwIndexType portNum, Fw::Buffer &buffer, const Drv::ByteStreamStatus &status)
Invoke output port recv.
FwIndexType getNum_allocate_OutputPorts() const
PlatformSizeType FwSizeType
I32 FwEnumStoreType
friend class UdpTester
Friend class tester implementation to support white-box testing.
friend class UdpTesterBase
Friend class tester to support autocoded test harness.
bool isConnected_recv_OutputPort(FwIndexType portNum)
virtual Drv::ByteStreamStatus send_handler(FwIndexType portNum, Fw::Buffer &sendBuffer)=0
Handler for input port send.
void set_recv_OutputPort(FwIndexType portNum, Drv::InputByteStreamDataPort *port)
Connect port to recv[portNum].
virtual void unLock()
Unlock the guarded mutex.
void init()
Object initializer.
Definition: ObjBase.cpp:24
FwIndexType getNum_ready_OutputPorts() const
Fw::Buffer allocate_out(FwIndexType portNum, FwSizeType size)
Invoke output port allocate.
bool isConnected_deallocate_OutputPort(FwIndexType portNum)
Status returned by the send call.
void deallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port deallocate.
bool isConnected_ready_OutputPort(FwIndexType portNum)
UdpComponentBase(const char *compName="")
Construct UdpComponentBase object.
void set_deallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to deallocate[portNum].
Drv::ByteStreamStatus send_handlerBase(FwIndexType portNum, Fw::Buffer &sendBuffer)
Handler base-class function for input port send.
virtual void recvReturnIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port recvReturnIn.
void set_allocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to allocate[portNum].
bool isConnected_allocate_OutputPort(FwIndexType portNum)
FwIndexType getNum_recv_OutputPorts() const
Drv::InputByteStreamSendPort * get_send_InputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
void set_ready_OutputPort(FwIndexType portNum, Drv::InputByteStreamReadyPort *port)
Connect port to ready[portNum].
Auto-generated base for Udp component.
Fw::InputBufferSendPort * get_recvReturnIn_InputPort(FwIndexType portNum)
void recvReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port recvReturnIn.
void ready_out(FwIndexType portNum)
Invoke output port ready.
FwIndexType getNum_deallocate_OutputPorts() const
virtual void lock()
Lock the guarded mutex.
FwIndexType getNum_send_InputPorts() const
FwIndexType getNum_recvReturnIn_InputPorts() const