F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
PolyDbComponentAc.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title PolyDbComponentAc.cpp
3// \author Generated by fpp-to-cpp
4// \brief cpp file for PolyDb 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 PolyDbComponentBase ::
22 init(NATIVE_INT_TYPE instance)
23 {
24 // Initialize base class
26
27 // Connect input port getValue
28 for (
29 PlatformIntType port = 0;
30 port < static_cast<PlatformIntType>(this->getNum_getValue_InputPorts());
31 port++
32 ) {
33 this->m_getValue_InputPort[port].init();
34 this->m_getValue_InputPort[port].addCallComp(
35 this,
36 m_p_getValue_in
37 );
38 this->m_getValue_InputPort[port].setPortNum(port);
39
40#if FW_OBJECT_NAMES == 1
41 char portName[120];
42 (void) snprintf(
43 portName,
44 sizeof(portName),
45 "%s_getValue_InputPort[%" PRI_PlatformIntType "]",
46 this->m_objName,
47 port
48 );
49 this->m_getValue_InputPort[port].setObjName(portName);
50#endif
51 }
52
53 // Connect input port setValue
54 for (
55 PlatformIntType port = 0;
56 port < static_cast<PlatformIntType>(this->getNum_setValue_InputPorts());
57 port++
58 ) {
59 this->m_setValue_InputPort[port].init();
60 this->m_setValue_InputPort[port].addCallComp(
61 this,
62 m_p_setValue_in
63 );
64 this->m_setValue_InputPort[port].setPortNum(port);
65
66#if FW_OBJECT_NAMES == 1
67 char portName[120];
68 (void) snprintf(
69 portName,
70 sizeof(portName),
71 "%s_setValue_InputPort[%" PRI_PlatformIntType "]",
72 this->m_objName,
73 port
74 );
75 this->m_setValue_InputPort[port].setObjName(portName);
76#endif
77 }
78 }
79
80 // ----------------------------------------------------------------------
81 // Getters for typed input ports
82 // ----------------------------------------------------------------------
83
84 Svc::InputPolyPort* PolyDbComponentBase ::
85 get_getValue_InputPort(NATIVE_INT_TYPE portNum)
86 {
88 portNum < this->getNum_getValue_InputPorts(),
89 static_cast<FwAssertArgType>(portNum)
90 );
91
92 return &this->m_getValue_InputPort[portNum];
93 }
94
95 Svc::InputPolyPort* PolyDbComponentBase ::
96 get_setValue_InputPort(NATIVE_INT_TYPE portNum)
97 {
99 portNum < this->getNum_setValue_InputPorts(),
100 static_cast<FwAssertArgType>(portNum)
101 );
102
103 return &this->m_setValue_InputPort[portNum];
104 }
105
106 // ----------------------------------------------------------------------
107 // Component construction and destruction
108 // ----------------------------------------------------------------------
109
110 PolyDbComponentBase ::
111 PolyDbComponentBase(const char* compName) :
112 Fw::PassiveComponentBase(compName)
113 {
114
115 }
116
117 PolyDbComponentBase ::
118 ~PolyDbComponentBase()
119 {
120
121 }
122
123 // ----------------------------------------------------------------------
124 // Getters for numbers of typed input ports
125 // ----------------------------------------------------------------------
126
127 NATIVE_INT_TYPE PolyDbComponentBase ::
128 getNum_getValue_InputPorts() const
129 {
130 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_getValue_InputPort));
131 }
132
133 NATIVE_INT_TYPE PolyDbComponentBase ::
134 getNum_setValue_InputPorts() const
135 {
136 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_setValue_InputPort));
137 }
138
139 // ----------------------------------------------------------------------
140 // Port handler base-class functions for typed input ports
141 //
142 // Call these functions directly to bypass the corresponding ports
143 // ----------------------------------------------------------------------
144
145 void PolyDbComponentBase ::
146 getValue_handlerBase(
147 NATIVE_INT_TYPE portNum,
148 U32 entry,
150 Fw::Time& time,
151 Fw::PolyType& val
152 )
153 {
154 // Make sure port number is valid
155 FW_ASSERT(
156 portNum < this->getNum_getValue_InputPorts(),
157 static_cast<FwAssertArgType>(portNum)
158 );
159
160 // Lock guard mutex before calling
161 this->lock();
162
163 // Down call to pure virtual handler method implemented in Impl class
164 this->getValue_handler(
165 portNum,
166 entry,
167 status,
168 time,
169 val
170 );
171
172 // Unlock guard mutex
173 this->unLock();
174 }
175
176 void PolyDbComponentBase ::
177 setValue_handlerBase(
178 NATIVE_INT_TYPE portNum,
179 U32 entry,
181 Fw::Time& time,
182 Fw::PolyType& val
183 )
184 {
185 // Make sure port number is valid
186 FW_ASSERT(
187 portNum < this->getNum_setValue_InputPorts(),
188 static_cast<FwAssertArgType>(portNum)
189 );
190
191 // Lock guard mutex before calling
192 this->lock();
193
194 // Down call to pure virtual handler method implemented in Impl class
195 this->setValue_handler(
196 portNum,
197 entry,
198 status,
199 time,
200 val
201 );
202
203 // Unlock guard mutex
204 this->unLock();
205 }
206
207 // ----------------------------------------------------------------------
208 // Mutex operations for guarded ports
209 //
210 // You can override these operations to provide more sophisticated
211 // synchronization
212 // ----------------------------------------------------------------------
213
214 void PolyDbComponentBase ::
215 lock()
216 {
217 this->m_guardedPortMutex.lock();
218 }
219
220 void PolyDbComponentBase ::
221 unLock()
222 {
223 this->m_guardedPortMutex.unLock();
224 }
225
226 // ----------------------------------------------------------------------
227 // Calls for messages received on typed input ports
228 // ----------------------------------------------------------------------
229
230 void PolyDbComponentBase ::
231 m_p_getValue_in(
232 Fw::PassiveComponentBase* callComp,
233 NATIVE_INT_TYPE portNum,
234 U32 entry,
236 Fw::Time& time,
237 Fw::PolyType& val
238 )
239 {
240 FW_ASSERT(callComp);
241 PolyDbComponentBase* compPtr = static_cast<PolyDbComponentBase*>(callComp);
242 compPtr->getValue_handlerBase(
243 portNum,
244 entry,
245 status,
246 time,
247 val
248 );
249 }
250
251 void PolyDbComponentBase ::
252 m_p_setValue_in(
253 Fw::PassiveComponentBase* callComp,
254 NATIVE_INT_TYPE portNum,
255 U32 entry,
257 Fw::Time& time,
258 Fw::PolyType& val
259 )
260 {
261 FW_ASSERT(callComp);
262 PolyDbComponentBase* compPtr = static_cast<PolyDbComponentBase*>(callComp);
263 compPtr->setValue_handlerBase(
264 portNum,
265 entry,
266 status,
267 time,
268 val
269 );
270 }
271
272}
#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
An enumeration for measurement status.
Auto-generated base for PolyDb component.
void getValue_handlerBase(NATIVE_INT_TYPE portNum, U32 entry, Svc::MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val)
Handler base-class function for input port getValue.
void setValue_handlerBase(NATIVE_INT_TYPE portNum, U32 entry, Svc::MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val)
Handler base-class function for input port setValue.