F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
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
8#include "Fw/Types/Assert.hpp"
10#if FW_ENABLE_TEXT_LOGGING
11#include "Fw/Types/String.hpp"
12#endif
13
14namespace Svc {
15
16 // ----------------------------------------------------------------------
17 // Component initialization
18 // ----------------------------------------------------------------------
19
20 void PosixTimeComponentBase ::
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
55 Fw::InputTimePort* PosixTimeComponentBase ::
56 get_timeGetPort_InputPort(FwIndexType portNum)
57 {
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
70 PosixTimeComponentBase ::
71 PosixTimeComponentBase(const char* compName) :
72 Fw::PassiveComponentBase(compName)
73 {
74
75 }
76
77 PosixTimeComponentBase ::
78 ~PosixTimeComponentBase()
79 {
80
81 }
82
83 // ----------------------------------------------------------------------
84 // Getters for numbers of typed input ports
85 // ----------------------------------------------------------------------
86
87 FwIndexType PosixTimeComponentBase ::
88 getNum_timeGetPort_InputPorts() const
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
99 void PosixTimeComponentBase ::
100 timeGetPort_handlerBase(
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 PosixTimeComponentBase ::
123 m_p_timeGetPort_in(
124 Fw::PassiveComponentBase* callComp,
125 FwIndexType portNum,
126 Fw::Time& time
127 )
128 {
129 FW_ASSERT(callComp);
130 PosixTimeComponentBase* compPtr = static_cast<PosixTimeComponentBase*>(callComp);
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 init()
Object initializer.
Definition ObjBase.cpp:27
const char * toChar() const
void format(const CHAR *formatString,...)
write formatted string to buffer
Auto-generated base for PosixTime component.
void timeGetPort_handlerBase(FwIndexType portNum, Fw::Time &time)
Handler base-class function for input port timeGetPort.