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
PassiveTextLoggerComponentAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title PassiveTextLoggerComponentAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for PassiveTextLogger 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 TextLogger
27  for (
28  FwIndexType port = 0;
29  port < static_cast<FwIndexType>(this->getNum_TextLogger_InputPorts());
30  port++
31  ) {
32  this->m_TextLogger_InputPort[port].init();
33  this->m_TextLogger_InputPort[port].addCallComp(
34  this,
35  m_p_TextLogger_in
36  );
37  this->m_TextLogger_InputPort[port].setPortNum(port);
38 
39 #if FW_OBJECT_NAMES == 1
40  Fw::ObjectName portName;
41  portName.format(
42  "%s_TextLogger_InputPort[%" PRI_PlatformIntType "]",
43  this->m_objName.toChar(),
44  port
45  );
46  this->m_TextLogger_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_TextLogger_InputPorts(),
60  static_cast<FwAssertArgType>(portNum)
61  );
62 
63  return &this->m_TextLogger_InputPort[portNum];
64  }
65 
66  // ----------------------------------------------------------------------
67  // Component construction and destruction
68  // ----------------------------------------------------------------------
69 
71  PassiveTextLoggerComponentBase(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_TextLogger_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  FwEventIdType id,
103  Fw::Time& timeTag,
104  const Fw::LogSeverity& severity,
105  Fw::TextLogString& text
106  )
107  {
108  // Make sure port number is valid
109  FW_ASSERT(
110  portNum < this->getNum_TextLogger_InputPorts(),
111  static_cast<FwAssertArgType>(portNum)
112  );
113 
114  // Call handler function
115  this->TextLogger_handler(
116  portNum,
117  id,
118  timeTag,
119  severity,
120  text
121  );
122  }
123 
124  // ----------------------------------------------------------------------
125  // Calls for messages received on typed input ports
126  // ----------------------------------------------------------------------
127 
128  void PassiveTextLoggerComponentBase ::
129  m_p_TextLogger_in(
130  Fw::PassiveComponentBase* callComp,
131  FwIndexType portNum,
132  FwEventIdType id,
133  Fw::Time& timeTag,
134  const Fw::LogSeverity& severity,
135  Fw::TextLogString& text
136  )
137  {
138  FW_ASSERT(callComp);
139  PassiveTextLoggerComponentBase* compPtr = static_cast<PassiveTextLoggerComponentBase*>(callComp);
140  compPtr->TextLogger_handlerBase(
141  portNum,
142  id,
143  timeTag,
144  severity,
145  text
146  );
147  }
148 
149 }
#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
U32 FwEventIdType
Definition: FpConfig.h:103
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
void setPortNum(NATIVE_INT_TYPE portNum)
Enum representing event severity.
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 PassiveTextLogger component.
virtual ~PassiveTextLoggerComponentBase()
Destroy PassiveTextLoggerComponentBase object.
virtual void TextLogger_handler(FwIndexType portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::TextLogString &text)=0
Handler for input port TextLogger.
PassiveTextLoggerComponentBase(const char *compName="")
Construct PassiveTextLoggerComponentBase object.
void TextLogger_handlerBase(FwIndexType portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::TextLogString &text)
Handler base-class function for input port TextLogger.
Fw::InputLogTextPort * get_TextLogger_InputPort(FwIndexType portNum)