F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
OsTimeComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title OsTimeComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for OsTime 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 
22  {
23  // Initialize base class
25 
26  // Connect input port setEpoch
27  for (
28  FwIndexType port = 0;
29  port < static_cast<FwIndexType>(this->getNum_setEpoch_InputPorts());
30  port++
31  ) {
32  this->m_setEpoch_InputPort[port].init();
33  this->m_setEpoch_InputPort[port].addCallComp(
34  this,
35  m_p_setEpoch_in
36  );
37  this->m_setEpoch_InputPort[port].setPortNum(port);
38 
39 #if FW_OBJECT_NAMES == 1
40  Fw::ObjectName portName;
41  portName.format(
42  "%s_setEpoch_InputPort[%" PRI_FwIndexType "]",
43  this->m_objName.toChar(),
44  port
45  );
46  this->m_setEpoch_InputPort[port].setObjName(portName.toChar());
47 #endif
48  }
49 
50  // Connect input port timeGetPort
51  for (
52  FwIndexType port = 0;
53  port < static_cast<FwIndexType>(this->getNum_timeGetPort_InputPorts());
54  port++
55  ) {
56  this->m_timeGetPort_InputPort[port].init();
57  this->m_timeGetPort_InputPort[port].addCallComp(
58  this,
59  m_p_timeGetPort_in
60  );
61  this->m_timeGetPort_InputPort[port].setPortNum(port);
62 
63 #if FW_OBJECT_NAMES == 1
64  Fw::ObjectName portName;
65  portName.format(
66  "%s_timeGetPort_InputPort[%" PRI_FwIndexType "]",
67  this->m_objName.toChar(),
68  port
69  );
70  this->m_timeGetPort_InputPort[port].setObjName(portName.toChar());
71 #endif
72  }
73  }
74 
75  // ----------------------------------------------------------------------
76  // Getters for typed input ports
77  // ----------------------------------------------------------------------
78 
81  {
82  FW_ASSERT(
83  (0 <= portNum) && (portNum < this->getNum_setEpoch_InputPorts()),
84  static_cast<FwAssertArgType>(portNum)
85  );
86 
87  return &this->m_setEpoch_InputPort[portNum];
88  }
89 
92  {
93  FW_ASSERT(
94  (0 <= portNum) && (portNum < this->getNum_timeGetPort_InputPorts()),
95  static_cast<FwAssertArgType>(portNum)
96  );
97 
98  return &this->m_timeGetPort_InputPort[portNum];
99  }
100 
101  // ----------------------------------------------------------------------
102  // Component construction and destruction
103  // ----------------------------------------------------------------------
104 
106  OsTimeComponentBase(const char* compName) :
107  Fw::PassiveComponentBase(compName)
108  {
109 
110  }
111 
114  {
115 
116  }
117 
118  // ----------------------------------------------------------------------
119  // Getters for numbers of typed input ports
120  // ----------------------------------------------------------------------
121 
124  {
125  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_setEpoch_InputPort));
126  }
127 
130  {
131  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetPort_InputPort));
132  }
133 
134  // ----------------------------------------------------------------------
135  // Port handler base-class functions for typed input ports
136  //
137  // Call these functions directly to bypass the corresponding ports
138  // ----------------------------------------------------------------------
139 
142  FwIndexType portNum,
143  const Fw::Time& fw_time,
144  const Os::RawTime& os_time
145  )
146  {
147  // Make sure port number is valid
148  FW_ASSERT(
149  (0 <= portNum) && (portNum < this->getNum_setEpoch_InputPorts()),
150  static_cast<FwAssertArgType>(portNum)
151  );
152 
153  // Call handler function
154  this->setEpoch_handler(
155  portNum,
156  fw_time,
157  os_time
158  );
159  }
160 
163  FwIndexType portNum,
164  Fw::Time& time
165  )
166  {
167  // Make sure port number is valid
168  FW_ASSERT(
169  (0 <= portNum) && (portNum < this->getNum_timeGetPort_InputPorts()),
170  static_cast<FwAssertArgType>(portNum)
171  );
172 
173  // Call handler function
174  this->timeGetPort_handler(
175  portNum,
176  time
177  );
178  }
179 
180  // ----------------------------------------------------------------------
181  // Calls for messages received on typed input ports
182  // ----------------------------------------------------------------------
183 
184  void OsTimeComponentBase ::
185  m_p_setEpoch_in(
186  Fw::PassiveComponentBase* callComp,
187  FwIndexType portNum,
188  const Fw::Time& fw_time,
189  const Os::RawTime& os_time
190  )
191  {
192  FW_ASSERT(callComp);
193  OsTimeComponentBase* compPtr = static_cast<OsTimeComponentBase*>(callComp);
194  compPtr->setEpoch_handlerBase(
195  portNum,
196  fw_time,
197  os_time
198  );
199  }
200 
201  void OsTimeComponentBase ::
202  m_p_timeGetPort_in(
203  Fw::PassiveComponentBase* callComp,
204  FwIndexType portNum,
205  Fw::Time& time
206  )
207  {
208  FW_ASSERT(callComp);
209  OsTimeComponentBase* compPtr = static_cast<OsTimeComponentBase*>(callComp);
210  compPtr->timeGetPort_handlerBase(
211  portNum,
212  time
213  );
214  }
215 
216 }
Definition: Time.hpp:9
Svc::InputOsTimeEpochPort * get_setEpoch_InputPort(FwIndexType portNum)
void init()
Initialization function.
Definition: TimePortAc.cpp:56
I32 FwEnumStoreType
virtual void setEpoch_handler(FwIndexType portNum, const Fw::Time &fw_time, const Os::RawTime &os_time)=0
Handler for input port setEpoch.
void init()
Object initializer.
Definition: ObjBase.cpp:26
void setEpoch_handlerBase(FwIndexType portNum, const Fw::Time &fw_time, const Os::RawTime &os_time)
Handler base-class function for input port setEpoch.
void init()
Initialization function.
const char * toChar() const
Definition: ObjectName.hpp:50
FwIndexType getNum_setEpoch_InputPorts() const
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:55
void timeGetPort_handlerBase(FwIndexType portNum, Fw::Time &time)
Handler base-class function for input port timeGetPort.
void setPortNum(FwIndexType portNum)
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Auto-generated base for OsTime component.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: TimePortAc.cpp:62
PlatformIndexType FwIndexType
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:93
virtual ~OsTimeComponentBase()
Destroy OsTimeComponentBase object.
RateGroupDivider component implementation.
virtual void timeGetPort_handler(FwIndexType portNum, Fw::Time &time)=0
Handler for input port timeGetPort.
FwIndexType getNum_timeGetPort_InputPorts() const
Fw::InputTimePort * get_timeGetPort_InputPort(FwIndexType portNum)
OsTimeComponentBase(const char *compName="")
Construct OsTimeComponentBase object.
#define FW_ASSERT(...)
Definition: Assert.hpp:14