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