F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
FileAnnouncePortAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title FileAnnouncePortAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for FileAnnounce port
5 // ======================================================================
6 
7 #include "Fw/Types/Assert.hpp"
10 
11 namespace Svc {
12 
13  namespace {
14 
15  // ----------------------------------------------------------------------
16  // Port buffer class
17  // ----------------------------------------------------------------------
18 
19  class FileAnnouncePortBuffer : public Fw::LinearBufferBase {
20 
21  public:
22 
23  Fw::Serializable::SizeType getCapacity() const {
25  }
26 
27  U8* getBuffAddr() {
28  return m_buff;
29  }
30 
31  const U8* getBuffAddr() const {
32  return m_buff;
33  }
34 
35  private:
36 
38 
39  };
40 
41  }
42 
43  // ----------------------------------------------------------------------
44  // Input Port Member functions
45  // ----------------------------------------------------------------------
46 
49  Fw::InputPortBase(),
50  m_func(nullptr)
51  {
52 
53  }
54 
57  {
59  }
60 
63  Fw::PassiveComponentBase* callComp,
64  CompFuncPtr funcPtr
65  )
66  {
67  FW_ASSERT(callComp != nullptr);
68  FW_ASSERT(funcPtr != nullptr);
69 
70  this->m_comp = callComp;
71  this->m_func = funcPtr;
72  this->m_connObj = callComp;
73  }
74 
77  {
78 #if FW_PORT_TRACING == 1
79  this->trace();
80 #endif
81 
82  FW_ASSERT(this->m_comp != nullptr);
83  FW_ASSERT(this->m_func != nullptr);
84 
85  return this->m_func(this->m_comp, this->m_portNum, file_name);
86  }
87 
88 #if FW_PORT_SERIALIZATION == 1
89 
90  Fw::SerializeStatus InputFileAnnouncePort ::
91  invokeSerial(Fw::LinearBufferBase& _buffer)
92  {
93  Fw::SerializeStatus _status;
94 
95 #if FW_PORT_TRACING == 1
96  this->trace();
97 #endif
98 
99  FW_ASSERT(this->m_comp != nullptr);
100  FW_ASSERT(this->m_func != nullptr);
101 
102  char __fprime_ac_file_name_buffer[Fw::StringBase::BUFFER_SIZE(80)];
103  Fw::ExternalString file_name(__fprime_ac_file_name_buffer, sizeof __fprime_ac_file_name_buffer);
104  _status = _buffer.deserializeTo(file_name);
105  if (_status != Fw::FW_SERIALIZE_OK) {
106  return _status;
107  }
108 
109  this->m_func(this->m_comp, this->m_portNum, file_name);
110 
111  return Fw::FW_SERIALIZE_OK;
112  }
113 
114 #endif
115 
116  // ----------------------------------------------------------------------
117  // Output Port Member functions
118  // ----------------------------------------------------------------------
119 
122  Fw::OutputPortBase(),
123  m_port(nullptr)
124  {
125 
126  }
127 
130  {
132  }
133 
136  {
137  FW_ASSERT(callPort != nullptr);
138 
139  this->m_port = callPort;
140  this->m_connObj = callPort;
141 
142 #if FW_PORT_SERIALIZATION == 1
143  this->m_serPort = nullptr;
144 #endif
145  }
146 
148  invoke(Fw::StringBase& file_name) const
149  {
150 #if FW_PORT_TRACING == 1
151  this->trace();
152 #endif
153 
154 #if FW_PORT_SERIALIZATION
155  FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));
156 
157  if (this->m_port != nullptr) {
158  this->m_port->invoke(file_name);
159  }
160  else {
161  Fw::SerializeStatus _status;
162  FileAnnouncePortBuffer _buffer;
163 
164  _status = _buffer.serializeFrom(file_name);
165  FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
166 
167  _status = this->m_serPort->invokeSerial(_buffer);
168  FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
169  }
170 #else
171  FW_ASSERT(this->m_port != nullptr);
172  this->m_port->invoke(file_name);
173 #endif
174  }
175 
176 }
Serialization/Deserialization operation was successful.
void invoke(Fw::StringBase &file_name)
Invoke a port interface.
FwIndexType m_portNum
void init()
Initialization function.
void addCallPort(InputFileAnnouncePort *callPort)
Register an input port.
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
SerializeStatus
forward declaration for string
The size of the serial representations of the port arguments.
void init() override
FwSizeType SizeType
A string backed by an external buffer.
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.h:53
PassiveComponentBase * m_comp
void init() override
void invoke(Fw::StringBase &file_name) const
Invoke a port interface.
RateGroupDivider component implementation.
SerializeStatus deserializeTo(U8 &val, Endianness mode=Endianness::BIG) override
Deserialize an 8-bit unsigned integer value.
Implementation of malloc based allocator.
static constexpr SizeType BUFFER_SIZE(SizeType maxLength)
Get the size of a null-terminated string buffer.
Fw::ObjBase * m_connObj
Definition: PortBase.hpp:34
#define FW_ASSERT(...)
Definition: Assert.hpp:14
void init()
Initialization function.