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"
17 #if !FW_DIRECT_PORT_CALLS
19 #endif
20 #if !FW_DIRECT_PORT_CALLS
22 #endif
23 #include "Os/Mutex.hpp"
24 
25 namespace Drv {
26 
31  {
32 
33  // ----------------------------------------------------------------------
34  // Friend classes
35  // ----------------------------------------------------------------------
36 
38  friend class TcpClientTesterBase;
40  friend class TcpClientTester;
41 
42  protected:
43 
44  // ----------------------------------------------------------------------
45  // Constants
46  // ----------------------------------------------------------------------
47 
49  enum {
52  };
53 
55  enum {
60  };
61 
62  public:
63 
64  // ----------------------------------------------------------------------
65  // Component initialization
66  // ----------------------------------------------------------------------
67 
69  void init(
70  FwEnumStoreType instance = 0
71  );
72 
73 #if !FW_DIRECT_PORT_CALLS
74 
75  public:
76 
77  // ----------------------------------------------------------------------
78  // Getters for typed input ports
79  // ----------------------------------------------------------------------
80 
85  FwIndexType portNum
86  );
87 
92  FwIndexType portNum
93  );
94 
95 #endif
96 
97 #if !FW_DIRECT_PORT_CALLS
98 
99  public:
100 
101  // ----------------------------------------------------------------------
102  // Connect typed input ports to typed output ports
103  // ----------------------------------------------------------------------
104 
107  FwIndexType portNum,
109  );
110 
113  FwIndexType portNum,
115  );
116 
119  FwIndexType portNum,
121  );
122 
124  void set_recv_OutputPort(
125  FwIndexType portNum,
127  );
128 
129 #endif
130 
131 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
132 
133  public:
134 
135  // ----------------------------------------------------------------------
136  // Connect serial input ports to typed output ports
137  // ----------------------------------------------------------------------
138 
141  FwIndexType portNum,
142  Fw::InputSerializePort* port
143  );
144 
147  FwIndexType portNum,
148  Fw::InputSerializePort* port
149  );
150 
152  void set_recv_OutputPort(
153  FwIndexType portNum,
154  Fw::InputSerializePort* port
155  );
156 
157 #endif
158 
159  protected:
160 
161  // ----------------------------------------------------------------------
162  // Component construction and destruction
163  // ----------------------------------------------------------------------
164 
167  const char* compName = ""
168  );
169 
171  virtual ~TcpClientComponentBase();
172 
173  protected:
174 
175  // ----------------------------------------------------------------------
176  // Getters for numbers of typed input ports
177  // ----------------------------------------------------------------------
178 
184  }
185 
189  static constexpr FwIndexType getNum_send_InputPorts() {
190  return NUM_SEND_INPUT_PORTS;
191  }
192 
193  protected:
194 
195  // ----------------------------------------------------------------------
196  // Getters for numbers of typed output ports
197  // ----------------------------------------------------------------------
198 
204  }
205 
211  }
212 
217  return NUM_READY_OUTPUT_PORTS;
218  }
219 
224  return NUM_RECV_OUTPUT_PORTS;
225  }
226 
227  protected:
228 
229  // ----------------------------------------------------------------------
230  // Connection status queries for typed output ports
231  // ----------------------------------------------------------------------
232 
237  FwIndexType portNum
238  ) const;
239 
244  FwIndexType portNum
245  ) const;
246 
251  FwIndexType portNum
252  ) const;
253 
258  FwIndexType portNum
259  ) const;
260 
261  protected:
262 
263  // ----------------------------------------------------------------------
264  // Handlers to implement for typed input ports
265  // ----------------------------------------------------------------------
266 
268  virtual void recvReturnIn_handler(
269  FwIndexType portNum,
270  Fw::Buffer& fwBuffer
271  ) = 0;
272 
275  FwIndexType portNum,
276  Fw::Buffer& sendBuffer
277  ) = 0;
278 
279 #if FW_DIRECT_PORT_CALLS
280  public:
281 #else
282  protected:
283 #endif
284 
285  // ----------------------------------------------------------------------
286  // Port handler base-class functions for typed input ports
287  //
288  // Call these functions directly to bypass the corresponding ports
289  // ----------------------------------------------------------------------
290 
293  FwIndexType portNum,
294  Fw::Buffer& fwBuffer
295  );
296 
299  FwIndexType portNum,
300  Fw::Buffer& sendBuffer
301  );
302 
303  protected:
304 
305  // ----------------------------------------------------------------------
306  // Invocation functions for typed output ports
307  // ----------------------------------------------------------------------
308 
311  FwIndexType portNum,
312  FwSizeType size
313  ) const;
314 
316  void deallocate_out(
317  FwIndexType portNum,
318  Fw::Buffer& fwBuffer
319  ) const;
320 
322  void ready_out(
323  FwIndexType portNum
324  ) const;
325 
327  void recv_out(
328  FwIndexType portNum,
329  Fw::Buffer& buffer,
330  const Drv::ByteStreamStatus& status
331  ) const;
332 
333  protected:
334 
335  // ----------------------------------------------------------------------
336  // Mutex operations for guarded ports
337  //
338  // You can override these operations to provide more sophisticated
339  // synchronization
340  // ----------------------------------------------------------------------
341 
343  virtual void lock();
344 
346  virtual void unLock();
347 
348  private:
349 
350  // ----------------------------------------------------------------------
351  // Calls for messages received on typed input ports
352  // ----------------------------------------------------------------------
353 
355  static void m_p_recvReturnIn_in(
356  Fw::PassiveComponentBase* callComp,
357  FwIndexType portNum,
358  Fw::Buffer& fwBuffer
359  );
360 
362  static Drv::ByteStreamStatus m_p_send_in(
363  Fw::PassiveComponentBase* callComp,
364  FwIndexType portNum,
365  Fw::Buffer& sendBuffer
366  );
367 
368 #if !FW_DIRECT_PORT_CALLS
369 
370  private:
371 
372  // ----------------------------------------------------------------------
373  // Typed input ports
374  // ----------------------------------------------------------------------
375 
377  Fw::InputBufferSendPort m_recvReturnIn_InputPort[NUM_RECVRETURNIN_INPUT_PORTS];
378 
381 
382 #endif
383 
384 #if !FW_DIRECT_PORT_CALLS
385 
386  private:
387 
388  // ----------------------------------------------------------------------
389  // Typed output ports
390  // ----------------------------------------------------------------------
391 
393  Fw::OutputBufferGetPort m_allocate_OutputPort[NUM_ALLOCATE_OUTPUT_PORTS];
394 
396  Fw::OutputBufferSendPort m_deallocate_OutputPort[NUM_DEALLOCATE_OUTPUT_PORTS];
397 
400 
403 
404 #endif
405 
406  private:
407 
408  // ----------------------------------------------------------------------
409  // Mutexes
410  // ----------------------------------------------------------------------
411 
413  Os::Mutex m_guardedPortMutex;
414 
415  };
416 
417 }
418 
419 #endif
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()
void deallocate_out(FwIndexType portNum, Fw::Buffer &fwBuffer) const
Invoke output port deallocate.
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].
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.
bool isConnected_recv_OutputPort(FwIndexType portNum) const
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)
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_ready_OutputPort(FwIndexType portNum) const
static constexpr FwIndexType getNum_allocate_OutputPorts()
Fw::Buffer allocate_out(FwIndexType portNum, FwSizeType size) const
Invoke output port allocate.
void ready_out(FwIndexType portNum) const
Invoke output port ready.
PlatformIndexType FwIndexType
static constexpr FwIndexType getNum_deallocate_OutputPorts()
bool isConnected_allocate_OutputPort(FwIndexType portNum) const
void recv_out(FwIndexType portNum, Fw::Buffer &buffer, const Drv::ByteStreamStatus &status) const
Invoke output port recv.
bool isConnected_deallocate_OutputPort(FwIndexType portNum) const
friend class TcpClientTesterBase
Friend class tester to support autocoded test harness.