F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ComAggregatorComponentAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ComAggregatorComponentAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for ComAggregator component base class
5 // ======================================================================
6 
7 #ifndef Svc_ComAggregatorComponentAc_HPP
8 #define Svc_ComAggregatorComponentAc_HPP
9 
11 #include "Fw/FPrimeBasicTypes.hpp"
12 #if !FW_DIRECT_PORT_CALLS
14 #endif
15 #if !FW_DIRECT_PORT_CALLS
17 #endif
22 
23 namespace Svc {
24 
31  {
32 
33  // ----------------------------------------------------------------------
34  // Friend classes
35  // ----------------------------------------------------------------------
36 
40  friend class ComAggregatorTester;
41 
42  protected:
43 
44  // ----------------------------------------------------------------------
45  // Constants
46  // ----------------------------------------------------------------------
47 
49  enum {
54  };
55 
57  enum {
61  };
62 
64  enum class SmId : FwEnumStoreType {
66  };
67 
68  protected:
69 
70  // ----------------------------------------------------------------------
71  // Types for internal state machines
72  // ----------------------------------------------------------------------
73 
77  {
78 
79  // ----------------------------------------------------------------------
80  // Friend classes
81  // ----------------------------------------------------------------------
82 
86  friend class ComAggregatorTester;
87 
88  public:
89 
92  ComAggregatorComponentBase& component
93  );
94 
95  public:
96 
98  void init(
100  );
101 
102  public:
103 
106 
107  private:
108 
110  void action_doClear(
111  Signal signal
112  );
113 
115  void action_doFill(
116  Signal signal,
117  const Svc::ComDataContextPair& value
118  );
119 
121  void action_doSend(
122  Signal signal
123  );
124 
126  void action_doHold(
127  Signal signal,
128  const Svc::ComDataContextPair& value
129  );
130 
132  void action_assertNoStatus(
133  Signal signal
134  );
135 
136  private:
137 
139  bool guard_isFull(
140  Signal signal,
141  const Svc::ComDataContextPair& value
142  ) const;
143 
145  bool guard_willFill(
146  Signal signal,
147  const Svc::ComDataContextPair& value
148  ) const;
149 
151  bool guard_isNotEmpty(
152  Signal signal
153  ) const;
154 
156  bool guard_isGood(
157  Signal signal,
158  const Fw::Success& value
159  ) const;
160 
161  private:
162 
164  ComAggregatorComponentBase& m_component;
165 
166  };
167 
168  public:
169 
170  // ----------------------------------------------------------------------
171  // Component initialization
172  // ----------------------------------------------------------------------
173 
175  void init(
176  FwSizeType queueDepth,
177  FwEnumStoreType instance = 0
178  );
179 
180 #if !FW_DIRECT_PORT_CALLS
181 
182  public:
183 
184  // ----------------------------------------------------------------------
185  // Getters for typed input ports
186  // ----------------------------------------------------------------------
187 
192  FwIndexType portNum
193  );
194 
199  FwIndexType portNum
200  );
201 
206  FwIndexType portNum
207  );
208 
213  FwIndexType portNum
214  );
215 
216 #endif
217 
218 #if !FW_DIRECT_PORT_CALLS
219 
220  public:
221 
222  // ----------------------------------------------------------------------
223  // Connect typed input ports to typed output ports
224  // ----------------------------------------------------------------------
225 
228  FwIndexType portNum,
230  );
231 
234  FwIndexType portNum,
236  );
237 
240  FwIndexType portNum,
242  );
243 
244 #endif
245 
246 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
247 
248  public:
249 
250  // ----------------------------------------------------------------------
251  // Connect serial input ports to typed output ports
252  // ----------------------------------------------------------------------
253 
256  FwIndexType portNum,
257  Fw::InputSerializePort* port
258  );
259 
262  FwIndexType portNum,
263  Fw::InputSerializePort* port
264  );
265 
268  FwIndexType portNum,
269  Fw::InputSerializePort* port
270  );
271 
272 #endif
273 
274  protected:
275 
276  // ----------------------------------------------------------------------
277  // Component construction and destruction
278  // ----------------------------------------------------------------------
279 
282  const char* compName = ""
283  );
284 
286  virtual ~ComAggregatorComponentBase();
287 
288  protected:
289 
290  // ----------------------------------------------------------------------
291  // Getters for numbers of typed input ports
292  // ----------------------------------------------------------------------
293 
299  }
300 
305  return NUM_DATAIN_INPUT_PORTS;
306  }
307 
313  }
314 
320  }
321 
322  protected:
323 
324  // ----------------------------------------------------------------------
325  // Getters for numbers of typed output ports
326  // ----------------------------------------------------------------------
327 
333  }
334 
340  }
341 
347  }
348 
349  protected:
350 
351  // ----------------------------------------------------------------------
352  // Connection status queries for typed output ports
353  // ----------------------------------------------------------------------
354 
359  FwIndexType portNum
360  ) const;
361 
366  FwIndexType portNum
367  ) const;
368 
373  FwIndexType portNum
374  ) const;
375 
376  protected:
377 
378  // ----------------------------------------------------------------------
379  // Handlers to implement for typed input ports
380  // ----------------------------------------------------------------------
381 
383  virtual void comStatusIn_handler(
384  FwIndexType portNum,
385  Fw::Success& condition
386  ) = 0;
387 
389  virtual void dataIn_handler(
390  FwIndexType portNum,
391  Fw::Buffer& data,
392  const ComCfg::FrameContext& context
393  ) = 0;
394 
396  virtual void dataReturnIn_handler(
397  FwIndexType portNum,
398  Fw::Buffer& data,
399  const ComCfg::FrameContext& context
400  ) = 0;
401 
403  virtual void timeout_handler(
404  FwIndexType portNum,
405  U32 context
406  ) = 0;
407 
408 #if FW_DIRECT_PORT_CALLS
409  public:
410 #else
411  protected:
412 #endif
413 
414  // ----------------------------------------------------------------------
415  // Port handler base-class functions for typed input ports
416  //
417  // Call these functions directly to bypass the corresponding ports
418  // ----------------------------------------------------------------------
419 
422  FwIndexType portNum,
423  Fw::Success& condition
424  );
425 
427  void dataIn_handlerBase(
428  FwIndexType portNum,
429  Fw::Buffer& data,
430  const ComCfg::FrameContext& context
431  );
432 
435  FwIndexType portNum,
436  Fw::Buffer& data,
437  const ComCfg::FrameContext& context
438  );
439 
441  void timeout_handlerBase(
442  FwIndexType portNum,
443  U32 context
444  );
445 
446  protected:
447 
448  // ----------------------------------------------------------------------
449  // Invocation functions for typed output ports
450  // ----------------------------------------------------------------------
451 
453  void comStatusOut_out(
454  FwIndexType portNum,
455  Fw::Success& condition
456  ) const;
457 
459  void dataOut_out(
460  FwIndexType portNum,
461  Fw::Buffer& data,
462  const ComCfg::FrameContext& context
463  ) const;
464 
466  void dataReturnOut_out(
467  FwIndexType portNum,
468  Fw::Buffer& data,
469  const ComCfg::FrameContext& context
470  ) const;
471 
472  protected:
473 
474  // ----------------------------------------------------------------------
475  // State getter functions
476  // ----------------------------------------------------------------------
477 
480 
481  protected:
482 
483  // ----------------------------------------------------------------------
484  // Signal send functions
485  // ----------------------------------------------------------------------
486 
489 
492  const Svc::ComDataContextPair& value
493  );
494 
497  const Fw::Success& value
498  );
499 
500  protected:
501 
502  // ----------------------------------------------------------------------
503  // Functions to implement for internal state machine actions
504  // ----------------------------------------------------------------------
505 
510  SmId smId,
512  ) = 0;
513 
518  SmId smId,
520  const Svc::ComDataContextPair& value
521  ) = 0;
522 
527  SmId smId,
529  ) = 0;
530 
535  SmId smId,
537  const Svc::ComDataContextPair& value
538  ) = 0;
539 
544  SmId smId,
546  ) = 0;
547 
548  protected:
549 
550  // ----------------------------------------------------------------------
551  // Functions to implement for internal state machine guards
552  // ----------------------------------------------------------------------
553 
558  SmId smId,
560  const Svc::ComDataContextPair& value
561  ) const = 0;
562 
567  SmId smId,
569  const Svc::ComDataContextPair& value
570  ) const = 0;
571 
576  SmId smId,
578  ) const = 0;
579 
584  SmId smId,
586  const Fw::Success& value
587  ) const = 0;
588 
589  private:
590 
591  // ----------------------------------------------------------------------
592  // Message dispatch functions
593  // ----------------------------------------------------------------------
594 
596  virtual MsgDispatchStatus doDispatch();
597 
598  private:
599 
600  // ----------------------------------------------------------------------
601  // Calls for messages received on typed input ports
602  // ----------------------------------------------------------------------
603 
605  static void m_p_comStatusIn_in(
606  Fw::PassiveComponentBase* callComp,
607  FwIndexType portNum,
608  Fw::Success& condition
609  );
610 
612  static void m_p_dataIn_in(
613  Fw::PassiveComponentBase* callComp,
614  FwIndexType portNum,
615  Fw::Buffer& data,
616  const ComCfg::FrameContext& context
617  );
618 
620  static void m_p_dataReturnIn_in(
621  Fw::PassiveComponentBase* callComp,
622  FwIndexType portNum,
623  Fw::Buffer& data,
624  const ComCfg::FrameContext& context
625  );
626 
628  static void m_p_timeout_in(
629  Fw::PassiveComponentBase* callComp,
630  FwIndexType portNum,
631  U32 context
632  );
633 
634  private:
635 
636  // ----------------------------------------------------------------------
637  // Send signal helper functions
638  // ----------------------------------------------------------------------
639 
641  void sendSignalStart(
642  SmId smId,
643  FwEnumStoreType signal,
644  Fw::SerialBufferBase& buffer
645  );
646 
648  void aggregationMachine_sendSignalFinish(
649  Fw::LinearBufferBase& buffer
650  );
651 
652  private:
653 
654  // ----------------------------------------------------------------------
655  // Helper functions for state machine dispatch
656  // ----------------------------------------------------------------------
657 
659  void smDispatch(
660  Fw::SerialBufferBase& buffer
661  );
662 
664  static void deserializeSmIdAndSignal(
665  Fw::SerialBufferBase& buffer,
666  FwEnumStoreType& smId,
667  FwEnumStoreType& signal
668  );
669 
671  void Svc_AggregationMachine_smDispatch(
672  Fw::SerialBufferBase& buffer,
673  Svc_AggregationMachine& sm,
675  );
676 
677 #if !FW_DIRECT_PORT_CALLS
678 
679  private:
680 
681  // ----------------------------------------------------------------------
682  // Typed input ports
683  // ----------------------------------------------------------------------
684 
687 
690 
693 
695  Svc::InputSchedPort m_timeout_InputPort[NUM_TIMEOUT_INPUT_PORTS];
696 
697 #endif
698 
699 #if !FW_DIRECT_PORT_CALLS
700 
701  private:
702 
703  // ----------------------------------------------------------------------
704  // Typed output ports
705  // ----------------------------------------------------------------------
706 
709 
712 
715 
716 #endif
717 
718  private:
719 
720  // ----------------------------------------------------------------------
721  // State machine instances
722  // ----------------------------------------------------------------------
723 
725  Svc_AggregationMachine m_stateMachine_aggregationMachine;
726 
727  };
728 
729 }
730 
731 #endif
static constexpr FwIndexType getNum_comStatusOut_OutputPorts()
static constexpr FwIndexType getNum_dataOut_OutputPorts()
PlatformSizeType FwSizeType
static constexpr FwIndexType getNum_dataIn_InputPorts()
virtual void Svc_AggregationMachine_action_doClear(SmId smId, Svc_AggregationMachine::Signal signal)=0
I32 FwEnumStoreType
bool isConnected_comStatusOut_OutputPort(FwIndexType portNum) const
virtual void Svc_AggregationMachine_action_doFill(SmId smId, Svc_AggregationMachine::Signal signal, const Svc::ComDataContextPair &value)=0
void set_dataReturnOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataReturnOut[portNum].
virtual bool Svc_AggregationMachine_guard_isFull(SmId smId, Svc_AggregationMachine::Signal signal, const Svc::ComDataContextPair &value) const =0
void init(ComAggregatorComponentBase::SmId smId)
Initialize the state machine.
void dataReturnOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataReturnOut.
void aggregationMachine_sendSignal_status(const Fw::Success &value)
Send signal status to state machine aggregationMachine.
static constexpr FwIndexType getNum_timeout_InputPorts()
void timeout_handlerBase(FwIndexType portNum, U32 context)
Handler base-class function for input port timeout.
static constexpr FwIndexType getNum_comStatusIn_InputPorts()
Fw::InputSuccessConditionPort * get_comStatusIn_InputPort(FwIndexType portNum)
virtual ~ComAggregatorComponentBase()
Destroy ComAggregatorComponentBase object.
Svc_AggregationMachine::State aggregationMachine_getState() const
Get the state of state machine instance aggregationMachine.
static constexpr FwIndexType getNum_dataReturnIn_InputPorts()
void dataIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataIn.
void set_comStatusOut_OutputPort(FwIndexType portNum, Fw::InputSuccessConditionPort *port)
Connect port to comStatusOut[portNum].
void init()
Object initializer.
Definition: ObjBase.cpp:24
void dataReturnIn_handlerBase(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)
Handler base-class function for input port dataReturnIn.
bool isConnected_dataOut_OutputPort(FwIndexType portNum) const
virtual void Svc_AggregationMachine_action_assertNoStatus(SmId smId, Svc_AggregationMachine::Signal signal)=0
Svc_AggregationMachine(ComAggregatorComponentBase &component)
Constructor.
virtual void dataIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataIn.
friend class ComAggregatorTester
Test implementation for the enclosing component.
void comStatusIn_handlerBase(FwIndexType portNum, Fw::Success &condition)
Handler base-class function for input port comStatusIn.
Svc::InputComDataWithContextPort * get_dataReturnIn_InputPort(FwIndexType portNum)
virtual void Svc_AggregationMachine_action_doHold(SmId smId, Svc_AggregationMachine::Signal signal, const Svc::ComDataContextPair &value)=0
ComAggregatorComponentBase::SmId getId() const
Get the state machine id.
virtual void timeout_handler(FwIndexType portNum, U32 context)=0
Handler for input port timeout.
bool isConnected_dataReturnOut_OutputPort(FwIndexType portNum) const
ComAggregatorComponentBase(const char *compName="")
Construct ComAggregatorComponentBase object.
friend class ComAggregatorTesterBase
Autocoded test harness for the enclosing component.
virtual bool Svc_AggregationMachine_guard_willFill(SmId smId, Svc_AggregationMachine::Signal signal, const Svc::ComDataContextPair &value) const =0
friend class ComAggregatorTesterBase
Friend class tester to support autocoded test harness.
Implementation of state machine Svc_AggregationMachine.
Auto-generated base for ComAggregator component.
virtual bool Svc_AggregationMachine_guard_isGood(SmId smId, Svc_AggregationMachine::Signal signal, const Fw::Success &value) const =0
void aggregationMachine_sendSignal_timeout()
Send signal timeout to state machine aggregationMachine.
virtual bool Svc_AggregationMachine_guard_isNotEmpty(SmId smId, Svc_AggregationMachine::Signal signal) const =0
static constexpr FwIndexType getNum_dataReturnOut_OutputPorts()
PlatformIndexType FwIndexType
Svc::AggregationMachine_State State
The state type.
void comStatusOut_out(FwIndexType portNum, Fw::Success &condition) const
Invoke output port comStatusOut.
virtual void comStatusIn_handler(FwIndexType portNum, Fw::Success &condition)=0
Handler for input port comStatusIn.
Svc::InputComDataWithContextPort * get_dataIn_InputPort(FwIndexType portNum)
Type used to pass context info between components during framing/deframing.
Svc::InputSchedPort * get_timeout_InputPort(FwIndexType portNum)
RateGroupDivider component implementation.
virtual void Svc_AggregationMachine_action_doSend(SmId smId, Svc_AggregationMachine::Signal signal)=0
void dataOut_out(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context) const
Invoke output port dataOut.
void aggregationMachine_sendSignal_fill(const Svc::ComDataContextPair &value)
Send signal fill to state machine aggregationMachine.
Success/Failure.
void set_dataOut_OutputPort(FwIndexType portNum, Svc::InputComDataWithContextPort *port)
Connect port to dataOut[portNum].
virtual void dataReturnIn_handler(FwIndexType portNum, Fw::Buffer &data, const ComCfg::FrameContext &context)=0
Handler for input port dataReturnIn.
friend class ComAggregatorTester
Friend class tester implementation to support white-box testing.