F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TcpClientComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title TcpClientComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for TcpClient component base class
5 // ======================================================================
6 
7 #ifndef Drv_TcpClientComponentAc_HPP
8 #define Drv_TcpClientComponentAc_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 TcpClientTesterBase;
36  friend class TcpClientTester;
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 ~TcpClientComponentBase();
160 
161  protected:
162 
163  // ----------------------------------------------------------------------
164  // Getters for numbers of typed input ports
165  // ----------------------------------------------------------------------
166 
172  }
173 
177  static constexpr FwIndexType getNum_send_InputPorts() {
178  return NUM_SEND_INPUT_PORTS;
179  }
180 
181  protected:
182 
183  // ----------------------------------------------------------------------
184  // Getters for numbers of typed output ports
185  // ----------------------------------------------------------------------
186 
192  }
193 
199  }
200 
205  return NUM_READY_OUTPUT_PORTS;
206  }
207 
212  return NUM_RECV_OUTPUT_PORTS;
213  }
214 
215  protected:
216 
217  // ----------------------------------------------------------------------
218  // Connection status queries for typed output ports
219  // ----------------------------------------------------------------------
220 
225  FwIndexType portNum
226  );
227 
232  FwIndexType portNum
233  );
234 
239  FwIndexType portNum
240  );
241 
246  FwIndexType portNum
247  );
248 
249  protected:
250 
251  // ----------------------------------------------------------------------
252  // Handlers to implement for typed input ports
253  // ----------------------------------------------------------------------
254 
256  virtual void recvReturnIn_handler(
257  FwIndexType portNum,
258  Fw::Buffer& fwBuffer
259  ) = 0;
260 
263  FwIndexType portNum,
264  Fw::Buffer& sendBuffer
265  ) = 0;
266 
267  protected:
268 
269  // ----------------------------------------------------------------------
270  // Port handler base-class functions for typed input ports
271  //
272  // Call these functions directly to bypass the corresponding ports
273  // ----------------------------------------------------------------------
274 
277  FwIndexType portNum,
278  Fw::Buffer& fwBuffer
279  );
280 
283  FwIndexType portNum,
284  Fw::Buffer& sendBuffer
285  );
286 
287  protected:
288 
289  // ----------------------------------------------------------------------
290  // Invocation functions for typed output ports
291  // ----------------------------------------------------------------------
292 
295  FwIndexType portNum,
296  FwSizeType size
297  );
298 
300  void deallocate_out(
301  FwIndexType portNum,
302  Fw::Buffer& fwBuffer
303  );
304 
306  void ready_out(
307  FwIndexType portNum
308  );
309 
311  void recv_out(
312  FwIndexType portNum,
313  Fw::Buffer& buffer,
314  const Drv::ByteStreamStatus& status
315  );
316 
317  protected:
318 
319  // ----------------------------------------------------------------------
320  // Mutex operations for guarded ports
321  //
322  // You can override these operations to provide more sophisticated
323  // synchronization
324  // ----------------------------------------------------------------------
325 
327  virtual void lock();
328 
330  virtual void unLock();
331 
332  private:
333 
334  // ----------------------------------------------------------------------
335  // Calls for messages received on typed input ports
336  // ----------------------------------------------------------------------
337 
339  static void m_p_recvReturnIn_in(
340  Fw::PassiveComponentBase* callComp,
341  FwIndexType portNum,
342  Fw::Buffer& fwBuffer
343  );
344 
346  static Drv::ByteStreamStatus m_p_send_in(
347  Fw::PassiveComponentBase* callComp,
348  FwIndexType portNum,
349  Fw::Buffer& sendBuffer
350  );
351 
352  private:
353 
354  // ----------------------------------------------------------------------
355  // Typed input ports
356  // ----------------------------------------------------------------------
357 
359  Fw::InputBufferSendPort m_recvReturnIn_InputPort[NUM_RECVRETURNIN_INPUT_PORTS];
360 
363 
364  private:
365 
366  // ----------------------------------------------------------------------
367  // Typed output ports
368  // ----------------------------------------------------------------------
369 
371  Fw::OutputBufferGetPort m_allocate_OutputPort[NUM_ALLOCATE_OUTPUT_PORTS];
372 
374  Fw::OutputBufferSendPort m_deallocate_OutputPort[NUM_DEALLOCATE_OUTPUT_PORTS];
375 
378 
381 
382  private:
383 
384  // ----------------------------------------------------------------------
385  // Mutexes
386  // ----------------------------------------------------------------------
387 
389  Os::Mutex m_guardedPortMutex;
390 
391  };
392 
393 }
394 
395 #endif
bool isConnected_deallocate_OutputPort(FwIndexType portNum)
virtual void lock()
Lock the guarded mutex.
void set_allocate_OutputPort(FwIndexType portNum, Fw::InputBufferGetPort *port)
Connect port to allocate[portNum].
static constexpr FwIndexType getNum_recv_OutputPorts()
PlatformSizeType FwSizeType
static constexpr FwIndexType getNum_send_InputPorts()
I32 FwEnumStoreType
virtual Drv::ByteStreamStatus send_handler(FwIndexType portNum, Fw::Buffer &sendBuffer)=0
Handler for input port send.
Auto-generated base for TcpClient component.
static constexpr FwIndexType getNum_ready_OutputPorts()
void set_ready_OutputPort(FwIndexType portNum, Drv::InputByteStreamReadyPort *port)
Connect port to ready[portNum].
void recv_out(FwIndexType portNum, Fw::Buffer &buffer, const Drv::ByteStreamStatus &status)
Invoke output port recv.
friend class TcpClientTester
Friend class tester implementation to support white-box testing.
void init()
Object initializer.
Definition: ObjBase.cpp:24
void recvReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &fwBuffer)
Handler base-class function for input port recvReturnIn.
TcpClientComponentBase(const char *compName="")
Construct TcpClientComponentBase object.
virtual ~TcpClientComponentBase()
Destroy TcpClientComponentBase object.
Status returned by the send call.
Drv::ByteStreamStatus send_handlerBase(FwIndexType portNum, Fw::Buffer &sendBuffer)
Handler base-class function for input port send.
Drv::InputByteStreamSendPort * get_send_InputPort(FwIndexType portNum)
Fw::Buffer allocate_out(FwIndexType portNum, FwSizeType size)
Invoke output port allocate.
static constexpr FwIndexType getNum_recvReturnIn_InputPorts()
Fw::InputBufferSendPort * get_recvReturnIn_InputPort(FwIndexType portNum)
virtual void recvReturnIn_handler(FwIndexType portNum, Fw::Buffer &fwBuffer)=0
Handler for input port recvReturnIn.
virtual void unLock()
Unlock the guarded mutex.
void set_recv_OutputPort(FwIndexType portNum, Drv::InputByteStreamDataPort *port)
Connect port to recv[portNum].
void set_deallocate_OutputPort(FwIndexType portNum, Fw::InputBufferSendPort *port)
Connect port to deallocate[portNum].
bool isConnected_recv_OutputPort(FwIndexType portNum)
void deallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer)
Invoke output port deallocate.
static constexpr FwIndexType getNum_allocate_OutputPorts()
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_deallocate_OutputPorts()
bool isConnected_ready_OutputPort(FwIndexType portNum)
friend class TcpClientTesterBase
Friend class tester to support autocoded test harness.
void ready_out(FwIndexType portNum)
Invoke output port ready.
bool isConnected_allocate_OutputPort(FwIndexType portNum)