F´ Flight Software - C/C++ Documentation  devel
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 
8 #include "Fw/Types/Assert.hpp"
10 #if FW_ENABLE_TEXT_LOGGING
11 #include "Fw/Types/String.hpp"
12 #endif
13 
14 namespace Svc {
15 
16  // ----------------------------------------------------------------------
17  // Component initialization
18  // ----------------------------------------------------------------------
19 
21  init(FwEnumStoreType instance)
22  {
23  // Initialize base class
25 
26  // Connect output port CycleOut
27  for (
28  FwIndexType port = 0;
29  port < static_cast<FwIndexType>(this->getNum_CycleOut_OutputPorts());
30  port++
31  ) {
32  this->m_CycleOut_OutputPort[port].init();
33 
34 #if FW_OBJECT_NAMES == 1
35  Fw::ObjectName portName;
36  portName.format(
37  "%s_CycleOut_OutputPort[%" PRI_PlatformIntType "]",
38  this->m_objName.toChar(),
39  port
40  );
41  this->m_CycleOut_OutputPort[port].setObjName(portName.toChar());
42 #endif
43  }
44  }
45 
46  // ----------------------------------------------------------------------
47  // Connect typed input ports to typed output ports
48  // ----------------------------------------------------------------------
49 
52  FwIndexType portNum,
54  )
55  {
56  FW_ASSERT(
57  portNum < this->getNum_CycleOut_OutputPorts(),
58  static_cast<FwAssertArgType>(portNum)
59  );
60 
61  this->m_CycleOut_OutputPort[portNum].addCallPort(port);
62  }
63 
64 #if FW_PORT_SERIALIZATION
65 
66  // ----------------------------------------------------------------------
67  // Connect serial input ports to typed output ports
68  // ----------------------------------------------------------------------
69 
72  FwIndexType portNum,
73  Fw::InputSerializePort* port
74  )
75  {
76  FW_ASSERT(
77  portNum < this->getNum_CycleOut_OutputPorts(),
78  static_cast<FwAssertArgType>(portNum)
79  );
80 
81  this->m_CycleOut_OutputPort[portNum].registerSerialPort(port);
82  }
83 
84 #endif
85 
86  // ----------------------------------------------------------------------
87  // Component construction and destruction
88  // ----------------------------------------------------------------------
89 
91  LinuxTimerComponentBase(const char* compName) :
92  Fw::PassiveComponentBase(compName)
93  {
94 
95  }
96 
99  {
100 
101  }
102 
103  // ----------------------------------------------------------------------
104  // Getters for numbers of typed output ports
105  // ----------------------------------------------------------------------
106 
109  {
110  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_CycleOut_OutputPort));
111  }
112 
113  // ----------------------------------------------------------------------
114  // Connection status queries for typed output ports
115  // ----------------------------------------------------------------------
116 
119  {
120  FW_ASSERT(
121  portNum < this->getNum_CycleOut_OutputPorts(),
122  static_cast<FwAssertArgType>(portNum)
123  );
124 
125  return this->m_CycleOut_OutputPort[portNum].isConnected();
126  }
127 
128  // ----------------------------------------------------------------------
129  // Invocation functions for typed output ports
130  // ----------------------------------------------------------------------
131 
134  FwIndexType portNum,
135  Os::RawTime& cycleStart
136  )
137  {
138  FW_ASSERT(
139  portNum < this->getNum_CycleOut_OutputPorts(),
140  static_cast<FwAssertArgType>(portNum)
141  );
142  this->m_CycleOut_OutputPort[portNum].invoke(
143  cycleStart
144  );
145  }
146 
147 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
#define PRI_PlatformIntType
I32 FwEnumStoreType
Definition: FpConfig.h:64
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:39
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
void init()
Object initializer.
Definition: ObjBase.cpp:27
const char * toChar() const
Definition: ObjectName.hpp:50
bool isConnected()
Definition: PortBase.cpp:41
void format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:56
FwIndexType getNum_CycleOut_OutputPorts() const
void CycleOut_out(FwIndexType portNum, Os::RawTime &cycleStart)
Invoke output port CycleOut.
void set_CycleOut_OutputPort(FwIndexType portNum, Svc::InputCyclePort *port)
Connect port to CycleOut[portNum].
bool isConnected_CycleOut_OutputPort(FwIndexType portNum)
virtual ~LinuxTimerComponentBase()
Destroy LinuxTimerComponentBase object.
LinuxTimerComponentBase(const char *compName="")
Construct LinuxTimerComponentBase object.
void init()
Initialization function.
void invoke(Os::RawTime &cycleStart)
Invoke a port interface.
void addCallPort(InputCyclePort *callPort)
Register an input port.