F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
LinuxTimerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title LinuxTimerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for LinuxTimer component base class
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
9 #if FW_ENABLE_TEXT_LOGGING
10 #include "Fw/Types/String.hpp"
11 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
22  {
23  // Initialize base class
25 
26 #if !FW_DIRECT_PORT_CALLS
27  // Connect output port CycleOut
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_CycleOut_OutputPorts());
31  port++
32  ) {
33  this->m_CycleOut_OutputPort[port].init();
34 
35 #if FW_OBJECT_NAMES == 1
36  Fw::ObjectName portName;
37  portName.format(
38  "%s_CycleOut_OutputPort[%" PRI_FwIndexType "]",
39  this->m_objName.toChar(),
40  port
41  );
42  this->m_CycleOut_OutputPort[port].setObjName(portName.toChar());
43 #endif
44  }
45 #endif
46  }
47 
48 #if !FW_DIRECT_PORT_CALLS
49 
50  // ----------------------------------------------------------------------
51  // Connect typed input ports to typed output ports
52  // ----------------------------------------------------------------------
53 
56  FwIndexType portNum,
58  )
59  {
60  FW_ASSERT(
61  (0 <= portNum) && (portNum < this->getNum_CycleOut_OutputPorts()),
62  static_cast<FwAssertArgType>(portNum)
63  );
64 
65  this->m_CycleOut_OutputPort[portNum].addCallPort(port);
66  }
67 
68 #endif
69 
70 #if !FW_DIRECT_PORT_CALLS && FW_PORT_SERIALIZATION
71 
72  // ----------------------------------------------------------------------
73  // Connect serial input ports to typed output ports
74  // ----------------------------------------------------------------------
75 
78  FwIndexType portNum,
79  Fw::InputSerializePort* port
80  )
81  {
82  FW_ASSERT(
83  (0 <= portNum) && (portNum < this->getNum_CycleOut_OutputPorts()),
84  static_cast<FwAssertArgType>(portNum)
85  );
86 
87  this->m_CycleOut_OutputPort[portNum].registerSerialPort(port);
88  }
89 
90 #endif
91 
92  // ----------------------------------------------------------------------
93  // Component construction and destruction
94  // ----------------------------------------------------------------------
95 
97  LinuxTimerComponentBase(const char* compName) :
98  Fw::PassiveComponentBase(compName)
99  {
100 
101  }
102 
105  {
106 
107  }
108 
109 #if !FW_DIRECT_PORT_CALLS
110 
111  // ----------------------------------------------------------------------
112  // Connection status queries for typed output ports
113  // ----------------------------------------------------------------------
114 
117  {
118  FW_ASSERT(
119  (0 <= portNum) && (portNum < this->getNum_CycleOut_OutputPorts()),
120  static_cast<FwAssertArgType>(portNum)
121  );
122 
123  return this->m_CycleOut_OutputPort[portNum].isConnected();
124  }
125 
126 #endif
127 
128 #if !FW_DIRECT_PORT_CALLS
129 
130  // ----------------------------------------------------------------------
131  // Invocation functions for typed output ports
132  // ----------------------------------------------------------------------
133 
136  FwIndexType portNum,
137  Os::RawTime& cycleStart
138  ) const
139  {
140  FW_ASSERT(
141  (0 <= portNum) && (portNum < this->getNum_CycleOut_OutputPorts()),
142  static_cast<FwAssertArgType>(portNum)
143  );
144 
145  FW_ASSERT(
146  this->m_CycleOut_OutputPort[portNum].isConnected(),
147  static_cast<FwAssertArgType>(portNum)
148  );
149  this->m_CycleOut_OutputPort[portNum].invoke(
150  cycleStart
151  );
152  }
153 
154 #endif
155 
156 }
I32 FwEnumStoreType
void init()
Object initializer.
Definition: ObjBase.cpp:24
virtual ~LinuxTimerComponentBase()
Destroy LinuxTimerComponentBase object.
void addCallPort(InputCyclePort *callPort)
Register an input port.
LinuxTimerComponentBase(const char *compName="")
Construct LinuxTimerComponentBase object.
const char * toChar() const
Convert to a C-style char*.
bool isConnected() const
Definition: PortBase.cpp:38
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
static constexpr FwIndexType getNum_CycleOut_OutputPorts()
void init()
Initialization function.
PlatformIndexType FwIndexType
RateGroupDivider component implementation.
void set_CycleOut_OutputPort(FwIndexType portNum, Svc::InputCyclePort *port)
Connect port to CycleOut[portNum].
void invoke(Os::RawTime &cycleStart) const
Invoke a port connection.
Implementation of malloc based allocator.
void CycleOut_out(FwIndexType portNum, Os::RawTime &cycleStart) const
Invoke output port CycleOut.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
bool isConnected_CycleOut_OutputPort(FwIndexType portNum) const