F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
ChronoTimeComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title ChronoTimeComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for ChronoTime 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 input port timeGetPort
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_timeGetPort_InputPorts());
31  port++
32  ) {
33  this->m_timeGetPort_InputPort[port].init();
34  this->m_timeGetPort_InputPort[port].addCallComp(
35  this,
36  m_p_timeGetPort_in
37  );
38  this->m_timeGetPort_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_timeGetPort_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_timeGetPort_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51  }
52 
53 #if !FW_DIRECT_PORT_CALLS
54 
55  // ----------------------------------------------------------------------
56  // Getters for typed input ports
57  // ----------------------------------------------------------------------
58 
61  {
62  FW_ASSERT(
63  (0 <= portNum) && (portNum < this->getNum_timeGetPort_InputPorts()),
64  static_cast<FwAssertArgType>(portNum)
65  );
66 
67  return &this->m_timeGetPort_InputPort[portNum];
68  }
69 
70 #endif
71 
72  // ----------------------------------------------------------------------
73  // Component construction and destruction
74  // ----------------------------------------------------------------------
75 
77  ChronoTimeComponentBase(const char* compName) :
78  Fw::PassiveComponentBase(compName)
79  {
80 
81  }
82 
85  {
86 
87  }
88 
89  // ----------------------------------------------------------------------
90  // Port handler base-class functions for typed input ports
91  //
92  // Call these functions directly to bypass the corresponding ports
93  // ----------------------------------------------------------------------
94 
97  FwIndexType portNum,
98  Fw::Time& time
99  )
100  {
101  // Make sure port number is valid
102  FW_ASSERT(
103  (0 <= portNum) && (portNum < this->getNum_timeGetPort_InputPorts()),
104  static_cast<FwAssertArgType>(portNum)
105  );
106 
107  // Call handler function
108  this->timeGetPort_handler(
109  portNum,
110  time
111  );
112  }
113 
114  // ----------------------------------------------------------------------
115  // Calls for messages received on typed input ports
116  // ----------------------------------------------------------------------
117 
118  void ChronoTimeComponentBase ::
119  m_p_timeGetPort_in(
120  Fw::PassiveComponentBase* callComp,
121  FwIndexType portNum,
122  Fw::Time& time
123  )
124  {
125  FW_ASSERT(callComp);
126  ChronoTimeComponentBase* compPtr = static_cast<ChronoTimeComponentBase*>(callComp);
127  compPtr->timeGetPort_handlerBase(
128  portNum,
129  time
130  );
131  }
132 
133 }
Auto-generated base for ChronoTime component.
void init()
Initialization function.
Definition: TimePortAc.cpp:73
I32 FwEnumStoreType
ChronoTimeComponentBase(const char *compName="")
Construct ChronoTimeComponentBase object.
virtual ~ChronoTimeComponentBase()
Destroy ChronoTimeComponentBase object.
void init()
Object initializer.
Definition: ObjBase.cpp:24
static constexpr FwIndexType getNum_timeGetPort_InputPorts()
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void setPortNum(FwIndexType portNum)
void timeGetPort_handlerBase(FwIndexType portNum, Fw::Time &time)
Handler base-class function for input port timeGetPort.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: TimePortAc.cpp:79
virtual void timeGetPort_handler(FwIndexType portNum, Fw::Time &time)=0
Handler for input port timeGetPort.
PlatformIndexType FwIndexType
RateGroupDivider component implementation.
Implementation of malloc based allocator.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
Fw::InputTimePort * get_timeGetPort_InputPort(FwIndexType portNum)