F´ Flight Software - C/C++ Documentation  devel
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 
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 
21  init(FwEnumStoreType instance)
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_PlatformIntType "]",
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  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  ChronoTimeComponentBase(const char* compName) :
72  Fw::PassiveComponentBase(compName)
73  {
74 
75  }
76 
79  {
80 
81  }
82 
83  // ----------------------------------------------------------------------
84  // Getters for numbers of typed input ports
85  // ----------------------------------------------------------------------
86 
89  {
90  return static_cast<FwIndexType>(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetPort_InputPort));
91  }
92 
93  // ----------------------------------------------------------------------
94  // Port handler base-class functions for typed input ports
95  //
96  // Call these functions directly to bypass the corresponding ports
97  // ----------------------------------------------------------------------
98 
101  FwIndexType portNum,
102  Fw::Time& time
103  )
104  {
105  // Make sure port number is valid
106  FW_ASSERT(
107  portNum < this->getNum_timeGetPort_InputPorts(),
108  static_cast<FwAssertArgType>(portNum)
109  );
110 
111  // Call handler function
112  this->timeGetPort_handler(
113  portNum,
114  time
115  );
116  }
117 
118  // ----------------------------------------------------------------------
119  // Calls for messages received on typed input ports
120  // ----------------------------------------------------------------------
121 
122  void ChronoTimeComponentBase ::
123  m_p_timeGetPort_in(
124  Fw::PassiveComponentBase* callComp,
125  FwIndexType portNum,
126  Fw::Time& time
127  )
128  {
129  FW_ASSERT(callComp);
130  ChronoTimeComponentBase* compPtr = static_cast<ChronoTimeComponentBase*>(callComp);
131  compPtr->timeGetPort_handlerBase(
132  portNum,
133  time
134  );
135  }
136 
137 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition: BasicTypes.h:70
#define PRI_PlatformIntType
I32 FwEnumStoreType
Definition: FpConfig.h:64
PlatformAssertArgType FwAssertArgType
Definition: FpConfig.h:39
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
void setPortNum(NATIVE_INT_TYPE portNum)
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Definition: TimePortAc.cpp:62
void init()
Initialization function.
Definition: TimePortAc.cpp:56
void init()
Object initializer.
Definition: ObjBase.cpp:27
const char * toChar() const
Definition: ObjectName.hpp:50
void format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:56
Definition: Time.hpp:9
Auto-generated base for ChronoTime component.
virtual ~ChronoTimeComponentBase()
Destroy ChronoTimeComponentBase object.
FwIndexType getNum_timeGetPort_InputPorts() const
ChronoTimeComponentBase(const char *compName="")
Construct ChronoTimeComponentBase object.
Fw::InputTimePort * get_timeGetPort_InputPort(FwIndexType portNum)
virtual void timeGetPort_handler(FwIndexType portNum, Fw::Time &time)=0
Handler for input port timeGetPort.
void timeGetPort_handlerBase(FwIndexType portNum, Fw::Time &time)
Handler base-class function for input port timeGetPort.