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 #if !FW_DIRECT_PORT_CALLS
27  // Connect input port TextLogger
28  for (
29  FwIndexType port = 0;
30  port < static_cast<FwIndexType>(this->getNum_TextLogger_InputPorts());
31  port++
32  ) {
33  this->m_TextLogger_InputPort[port].init();
34  this->m_TextLogger_InputPort[port].addCallComp(
35  this,
36  m_p_TextLogger_in
37  );
38  this->m_TextLogger_InputPort[port].setPortNum(port);
39 
40 #if FW_OBJECT_NAMES == 1
41  Fw::ObjectName portName;
42  portName.format(
43  "%s_TextLogger_InputPort[%" PRI_FwIndexType "]",
44  this->m_objName.toChar(),
45  port
46  );
47  this->m_TextLogger_InputPort[port].setObjName(portName.toChar());
48 #endif
49  }
50 #endif
51  }
52 
53 #if !FW_DIRECT_PORT_CALLS
54 
55  // ----------------------------------------------------------------------
56  // Getters for typed input ports
57  // ----------------------------------------------------------------------
58 
61  {
62  FW_ASSERT(
63  (0 <= portNum) && (portNum < this->getNum_TextLogger_InputPorts()),
64  static_cast<FwAssertArgType>(portNum)
65  );
66 
67  return &this->m_TextLogger_InputPort[portNum];
68  }
69 
70 #endif
71 
72  // ----------------------------------------------------------------------
73  // Component construction and destruction
74  // ----------------------------------------------------------------------
75 
77  PassiveTextLoggerComponentBase(const char* compName) :
78  Fw::PassiveComponentBase(compName)
79  {
80 
81  }
82 
85  {
86 
87  }
88 
89  // ----------------------------------------------------------------------
90  // Port handler base-class functions for typed input ports
91  //
92  // Call these functions directly to bypass the corresponding ports
93  // ----------------------------------------------------------------------
94 
97  FwIndexType portNum,
98  FwEventIdType id,
99  Fw::Time& timeTag,
100  const Fw::LogSeverity& severity,
101  Fw::TextLogString& text
102  )
103  {
104  // Make sure port number is valid
105  FW_ASSERT(
106  (0 <= portNum) && (portNum < this->getNum_TextLogger_InputPorts()),
107  static_cast<FwAssertArgType>(portNum)
108  );
109 
110  // Call handler function
111  this->TextLogger_handler(
112  portNum,
113  id,
114  timeTag,
115  severity,
116  text
117  );
118  }
119 
120  // ----------------------------------------------------------------------
121  // Calls for messages received on typed input ports
122  // ----------------------------------------------------------------------
123 
124  void PassiveTextLoggerComponentBase ::
125  m_p_TextLogger_in(
126  Fw::PassiveComponentBase* callComp,
127  FwIndexType portNum,
128  FwEventIdType id,
129  Fw::Time& timeTag,
130  const Fw::LogSeverity& severity,
131  Fw::TextLogString& text
132  )
133  {
134  FW_ASSERT(callComp);
135  PassiveTextLoggerComponentBase* compPtr = static_cast<PassiveTextLoggerComponentBase*>(callComp);
136  compPtr->TextLogger_handlerBase(
137  portNum,
138  id,
139  timeTag,
140  severity,
141  text
142  );
143  }
144 
145 }
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.