F´ Flight Software - C/C++ Documentation devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 <cstdio>
8
10#include "Fw/Types/Assert.hpp"
11#if FW_ENABLE_TEXT_LOGGING
12#include "Fw/Types/String.hpp"
13#endif
14
15namespace Svc {
16
17 // ----------------------------------------------------------------------
18 // Component initialization
19 // ----------------------------------------------------------------------
20
21 void PosixTimeComponentBase ::
22 init(NATIVE_INT_TYPE instance)
23 {
24 // Initialize base class
26
27 // Connect input port timeGetPort
28 for (
29 PlatformIntType port = 0;
30 port < static_cast<PlatformIntType>(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 char portName[120];
42 (void) snprintf(
43 portName,
44 sizeof(portName),
45 "%s_timeGetPort_InputPort[%" PRI_PlatformIntType "]",
46 this->m_objName,
47 port
48 );
49 this->m_timeGetPort_InputPort[port].setObjName(portName);
50#endif
51 }
52 }
53
54 // ----------------------------------------------------------------------
55 // Getters for typed input ports
56 // ----------------------------------------------------------------------
57
58 Fw::InputTimePort* PosixTimeComponentBase ::
59 get_timeGetPort_InputPort(NATIVE_INT_TYPE portNum)
60 {
62 portNum < this->getNum_timeGetPort_InputPorts(),
63 static_cast<FwAssertArgType>(portNum)
64 );
65
66 return &this->m_timeGetPort_InputPort[portNum];
67 }
68
69 // ----------------------------------------------------------------------
70 // Component construction and destruction
71 // ----------------------------------------------------------------------
72
73 PosixTimeComponentBase ::
74 PosixTimeComponentBase(const char* compName) :
75 Fw::PassiveComponentBase(compName)
76 {
77
78 }
79
80 PosixTimeComponentBase ::
81 ~PosixTimeComponentBase()
82 {
83
84 }
85
86 // ----------------------------------------------------------------------
87 // Getters for numbers of typed input ports
88 // ----------------------------------------------------------------------
89
90 NATIVE_INT_TYPE PosixTimeComponentBase ::
91 getNum_timeGetPort_InputPorts() const
92 {
93 return static_cast<NATIVE_INT_TYPE>(FW_NUM_ARRAY_ELEMENTS(this->m_timeGetPort_InputPort));
94 }
95
96 // ----------------------------------------------------------------------
97 // Port handler base-class functions for typed input ports
98 //
99 // Call these functions directly to bypass the corresponding ports
100 // ----------------------------------------------------------------------
101
102 void PosixTimeComponentBase ::
103 timeGetPort_handlerBase(
104 NATIVE_INT_TYPE portNum,
105 Fw::Time& time
106 )
107 {
108 // Make sure port number is valid
109 FW_ASSERT(
110 portNum < this->getNum_timeGetPort_InputPorts(),
111 static_cast<FwAssertArgType>(portNum)
112 );
113
114 // Down call to pure virtual handler method implemented in Impl class
115 this->timeGetPort_handler(
116 portNum,
117 time
118 );
119 }
120
121 // ----------------------------------------------------------------------
122 // Calls for messages received on typed input ports
123 // ----------------------------------------------------------------------
124
125 void PosixTimeComponentBase ::
126 m_p_timeGetPort_in(
127 Fw::PassiveComponentBase* callComp,
128 NATIVE_INT_TYPE portNum,
129 Fw::Time& time
130 )
131 {
132 FW_ASSERT(callComp);
133 PosixTimeComponentBase* compPtr = static_cast<PosixTimeComponentBase*>(callComp);
135 portNum,
136 time
137 );
138 }
139
140}
#define FW_ASSERT(...)
Definition Assert.hpp:7
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
#define FW_NUM_ARRAY_ELEMENTS(a)
number of elements in an array
Definition BasicTypes.h:66
int PlatformIntType
DefaultTypes.hpp provides fallback defaults for the platform types.
#define PRI_PlatformIntType
PlatformAssertArgType FwAssertArgType
Definition FpConfig.h:21
void init()
Object initializer.
Definition ObjBase.cpp:27
Auto-generated base for PosixTime component.
void timeGetPort_handlerBase(NATIVE_INT_TYPE portNum, Fw::Time &time)
Handler base-class function for input port timeGetPort.