F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
CmdPortAc.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title CmdPortAc.hpp
3 // \author Generated by fpp-to-cpp
4 // \brief hpp file for Cmd port
5 // ======================================================================
6 
7 #ifndef Fw_CmdPortAc_HPP
8 #define Fw_CmdPortAc_HPP
9 
10 #include <cstdio>
11 #include <cstring>
12 
13 #include "Fw/Cmd/CmdArgBuffer.hpp"
15 #include "Fw/FPrimeBasicTypes.hpp"
19 #include "Fw/Types/String.hpp"
21 
22 namespace Fw {
23 
26  class InputCmdPort :
27  public Fw::InputPortBase
28  {
29 
30  public:
31 
32  // ----------------------------------------------------------------------
33  // Constants
34  // ----------------------------------------------------------------------
35 
36  enum {
39  sizeof(FwOpcodeType) +
40  sizeof(U32) +
42  };
43 
44  public:
45 
46  // ----------------------------------------------------------------------
47  // Types
48  // ----------------------------------------------------------------------
49 
51  typedef void (*CompFuncPtr)(
52  Fw::PassiveComponentBase* callComp,
53  FwIndexType portNum,
54  FwOpcodeType opCode,
55  U32 cmdSeq,
56  Fw::CmdArgBuffer& args
57  );
58 
59  public:
60 
61  // ----------------------------------------------------------------------
62  // Input Port Member functions
63  // ----------------------------------------------------------------------
64 
66  InputCmdPort();
67 
69  void init();
70 
72  void addCallComp(
73  Fw::PassiveComponentBase* callComp,
74  CompFuncPtr funcPtr
75  );
76 
78  void invoke(
79  FwOpcodeType opCode,
80  U32 cmdSeq,
81  Fw::CmdArgBuffer& args
82  );
83 
84  private:
85 
86 #if FW_PORT_SERIALIZATION == 1
87 
89  Fw::SerializeStatus invokeSerial(Fw::SerializeBufferBase& _buffer);
90 
91 #endif
92 
93  private:
94 
95  // ----------------------------------------------------------------------
96  // Member variables
97  // ----------------------------------------------------------------------
98 
100  CompFuncPtr m_func;
101 
102  };
103 
107  public Fw::OutputPortBase
108  {
109 
110  public:
111 
112  // ----------------------------------------------------------------------
113  // Output Port Member functions
114  // ----------------------------------------------------------------------
115 
117  OutputCmdPort();
118 
120  void init();
121 
123  void addCallPort(
124  InputCmdPort* callPort
125  );
126 
128  void invoke(
129  FwOpcodeType opCode,
130  U32 cmdSeq,
131  Fw::CmdArgBuffer& args
132  ) const;
133 
134  private:
135 
136  // ----------------------------------------------------------------------
137  // Member variables
138  // ----------------------------------------------------------------------
139 
141  InputCmdPort* m_port;
142 
143  };
144 
145 }
146 
147 #endif
void invoke(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args) const
Invoke a port interface.
Definition: CmdPortAc.cpp:163
void init()
Initialization function.
Definition: CmdPortAc.cpp:56
The size of the serial representations of the port arguments.
Definition: CmdPortAc.hpp:38
SerializeStatus
forward declaration for string
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: CmdPortAc.cpp:62
U32 FwOpcodeType
The type of a command opcode.
void addCallPort(InputCmdPort *callPort)
Register an input port.
Definition: CmdPortAc.cpp:150
OutputCmdPort()
Constructor.
Definition: CmdPortAc.cpp:136
void init()
Initialization function.
Definition: CmdPortAc.cpp:144
InputCmdPort()
Constructor.
Definition: CmdPortAc.cpp:48
void(* CompFuncPtr)(Fw::PassiveComponentBase *callComp, FwIndexType portNum, FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
The port callback function type.
Definition: CmdPortAc.hpp:51
PlatformIndexType FwIndexType
void invoke(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdArgBuffer &args)
Invoke a port interface.
Definition: CmdPortAc.cpp:76
size when serialized. Buffer + size of buffer