F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
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 
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 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_FwIndexType "]",
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  (0 <= portNum) && (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  // 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  FwEventIdType id,
93  Fw::Time& timeTag,
94  const Fw::LogSeverity& severity,
95  Fw::TextLogString& text
96  )
97  {
98  // Make sure port number is valid
99  FW_ASSERT(
100  (0 <= portNum) && (portNum < this->getNum_TextLogger_InputPorts()),
101  static_cast<FwAssertArgType>(portNum)
102  );
103 
104  // Call handler function
105  this->TextLogger_handler(
106  portNum,
107  id,
108  timeTag,
109  severity,
110  text
111  );
112  }
113 
114  // ----------------------------------------------------------------------
115  // Calls for messages received on typed input ports
116  // ----------------------------------------------------------------------
117 
118  void PassiveTextLoggerComponentBase ::
119  m_p_TextLogger_in(
120  Fw::PassiveComponentBase* callComp,
121  FwIndexType portNum,
122  FwEventIdType id,
123  Fw::Time& timeTag,
124  const Fw::LogSeverity& severity,
125  Fw::TextLogString& text
126  )
127  {
128  FW_ASSERT(callComp);
129  PassiveTextLoggerComponentBase* compPtr = static_cast<PassiveTextLoggerComponentBase*>(callComp);
130  compPtr->TextLogger_handlerBase(
131  portNum,
132  id,
133  timeTag,
134  severity,
135  text
136  );
137  }
138 
139 }
virtual void TextLogger_handler(FwIndexType portNum, FwEventIdType id, Fw::Time &timeTag, const Fw::LogSeverity &severity, Fw::TextLogString &text)=0
Handler for input port TextLogger.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
void init()
Initialization function.
I32 FwEnumStoreType
Auto-generated base for PassiveTextLogger component.
void init()
Object initializer.
Definition: ObjBase.cpp:24
FwIdType FwEventIdType
The type of an event identifier.
const char * toChar() const
Convert to a C-style char*.
Definition: ObjectName.hpp:50
PassiveTextLoggerComponentBase(const char *compName="")
Construct PassiveTextLoggerComponentBase object.
static constexpr FwIndexType getNum_TextLogger_InputPorts()
Enum representing event severity.
#define PRI_FwIndexType
FormatStatus format(const CHAR *formatString,...)
write formatted string to buffer
Definition: StringBase.cpp:39
void setPortNum(FwIndexType portNum)
Fw::InputLogTextPort * get_TextLogger_InputPort(FwIndexType portNum)
PlatformIndexType FwIndexType
virtual ~PassiveTextLoggerComponentBase()
Destroy PassiveTextLoggerComponentBase object.
RateGroupDivider component implementation.
Implementation of malloc based allocator.
#define FW_ASSERT(...)
Definition: Assert.hpp:14
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.