F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 <cstdio>
8
10#include "Fw/Types/Assert.hpp"
11#if FW_ENABLE_TEXT_LOGGING
12#include "Fw/Types/String.hpp"
13#endif
14
15namespace Svc {
16
17 // ----------------------------------------------------------------------
18 // Component initialization
19 // ----------------------------------------------------------------------
20
21 void LinuxTimerComponentBase ::
22 init(NATIVE_INT_TYPE instance)
23 {
24 // Initialize base class
26
27 // Connect output port CycleOut
28 for (
29 PlatformIntType port = 0;
30 port < static_cast<PlatformIntType>(this->getNum_CycleOut_OutputPorts());
31 port++
32 ) {
33 this->m_CycleOut_OutputPort[port].init();
34
35#if FW_OBJECT_NAMES == 1
36 char portName[120];
37 (void) snprintf(
38 portName,
39 sizeof(portName),
40 "%s_CycleOut_OutputPort[%" PRI_PlatformIntType "]",
41 this->m_objName,
42 port
43 );
44 this->m_CycleOut_OutputPort[port].setObjName(portName);
45#endif
46 }
47 }
48
49 // ----------------------------------------------------------------------
50 // Connect typed input ports to typed output ports
51 // ----------------------------------------------------------------------
52
53 void LinuxTimerComponentBase ::
54 set_CycleOut_OutputPort(
55 NATIVE_INT_TYPE portNum,
57 )
58 {
60 portNum < this->getNum_CycleOut_OutputPorts(),
61 static_cast<FwAssertArgType>(portNum)
62 );
63
64 this->m_CycleOut_OutputPort[portNum].addCallPort(port);
65 }
66
67#if FW_PORT_SERIALIZATION
68
69 // ----------------------------------------------------------------------
70 // Connect serial input ports to typed output ports
71 // ----------------------------------------------------------------------
72
73 void LinuxTimerComponentBase ::
74 set_CycleOut_OutputPort(
75 NATIVE_INT_TYPE portNum,
76 Fw::InputSerializePort* port
77 )
78 {
80 portNum < this->getNum_CycleOut_OutputPorts(),
81 static_cast<FwAssertArgType>(portNum)
82 );
83
84 this->m_CycleOut_OutputPort[portNum].registerSerialPort(port);
85 }
86
87#endif
88
89 // ----------------------------------------------------------------------
90 // Component construction and destruction
91 // ----------------------------------------------------------------------
92
93 LinuxTimerComponentBase ::
94 LinuxTimerComponentBase(const char* compName) :
95 Fw::PassiveComponentBase(compName)
96 {
97
98 }
99
100 LinuxTimerComponentBase ::
101 ~LinuxTimerComponentBase()
102 {
103
104 }
105
106 // ----------------------------------------------------------------------
107 // Getters for numbers of typed output ports
108 // ----------------------------------------------------------------------
109
110 NATIVE_INT_TYPE LinuxTimerComponentBase ::
111 getNum_CycleOut_OutputPorts() const
112 {
113 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_CycleOut_OutputPort));
114 }
115
116 // ----------------------------------------------------------------------
117 // Connection status queries for typed output ports
118 // ----------------------------------------------------------------------
119
120 bool LinuxTimerComponentBase ::
121 isConnected_CycleOut_OutputPort(NATIVE_INT_TYPE portNum)
122 {
123 FW_ASSERT(
124 portNum < this->getNum_CycleOut_OutputPorts(),
125 static_cast<FwAssertArgType>(portNum)
126 );
127
128 return this->m_CycleOut_OutputPort[portNum].isConnected();
129 }
130
131 // ----------------------------------------------------------------------
132 // Invocation functions for typed output ports
133 // ----------------------------------------------------------------------
134
135 void LinuxTimerComponentBase ::
136 CycleOut_out(
137 NATIVE_INT_TYPE portNum,
138 Svc::TimerVal& cycleStart
139 )
140 {
141 FW_ASSERT(
142 portNum < this->getNum_CycleOut_OutputPorts(),
143 static_cast<FwAssertArgType>(portNum)
144 );
145 this->m_CycleOut_OutputPort[portNum].invoke(
146 cycleStart
147 );
148 }
149
150}
#define FW_ASSERT(...)
Definition Assert.hpp:7
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition BasicTypes.h:66
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:21
void init()
Object initializer.
Definition ObjBase.cpp:27
Serializable class for carrying timer values.
Definition TimerVal.hpp:22