mirror of
https://github.com/nasa/fpp.git
synced 2025-12-11 11:16:42 -06:00
217 lines
5.2 KiB
C++
Vendored
217 lines
5.2 KiB
C++
Vendored
// ======================================================================
|
|
// \title StringPortAc.cpp
|
|
// \author Generated by fpp-to-cpp
|
|
// \brief cpp file for String port
|
|
// ======================================================================
|
|
|
|
#include "Fw/Types/Assert.hpp"
|
|
#include "Fw/Types/ExternalString.hpp"
|
|
#include "StringPortAc.hpp"
|
|
|
|
#if !FW_DIRECT_PORT_CALLS
|
|
|
|
namespace {
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Port buffer class
|
|
// ----------------------------------------------------------------------
|
|
|
|
class StringPortBuffer : public Fw::LinearBufferBase {
|
|
|
|
public:
|
|
|
|
Fw::Serializable::SizeType getCapacity() const {
|
|
return InputStringPort::SERIALIZED_SIZE;
|
|
}
|
|
|
|
U8* getBuffAddr() {
|
|
return m_buff;
|
|
}
|
|
|
|
const U8* getBuffAddr() const {
|
|
return m_buff;
|
|
}
|
|
|
|
private:
|
|
|
|
U8 m_buff[InputStringPort::SERIALIZED_SIZE];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Input Port Member functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
InputStringPort ::
|
|
InputStringPort() :
|
|
Fw::InputPortBase(),
|
|
m_func(nullptr)
|
|
{
|
|
|
|
}
|
|
|
|
void InputStringPort ::
|
|
init()
|
|
{
|
|
Fw::InputPortBase::init();
|
|
}
|
|
|
|
void InputStringPort ::
|
|
addCallComp(
|
|
Fw::PassiveComponentBase* callComp,
|
|
CompFuncPtr funcPtr
|
|
)
|
|
{
|
|
FW_ASSERT(callComp != nullptr);
|
|
FW_ASSERT(funcPtr != nullptr);
|
|
|
|
this->m_comp = callComp;
|
|
this->m_func = funcPtr;
|
|
this->m_connObj = callComp;
|
|
}
|
|
|
|
void InputStringPort ::
|
|
invoke(
|
|
const Fw::StringBase& str80,
|
|
Fw::StringBase& str80Ref,
|
|
const Fw::StringBase& str100,
|
|
Fw::StringBase& str100Ref
|
|
)
|
|
{
|
|
#if FW_PORT_TRACING == 1
|
|
this->trace();
|
|
#endif
|
|
|
|
FW_ASSERT(this->m_comp != nullptr);
|
|
FW_ASSERT(this->m_func != nullptr);
|
|
|
|
return this->m_func(this->m_comp, this->m_portNum, str80, str80Ref, str100, str100Ref);
|
|
}
|
|
|
|
#if FW_PORT_SERIALIZATION == 1
|
|
|
|
Fw::SerializeStatus InputStringPort ::
|
|
invokeSerial(Fw::LinearBufferBase& _buffer)
|
|
{
|
|
Fw::SerializeStatus _status;
|
|
|
|
#if FW_PORT_TRACING == 1
|
|
this->trace();
|
|
#endif
|
|
|
|
FW_ASSERT(this->m_comp != nullptr);
|
|
FW_ASSERT(this->m_func != nullptr);
|
|
|
|
char __fprime_ac_str80_buffer[Fw::StringBase::BUFFER_SIZE(80)];
|
|
Fw::ExternalString str80(__fprime_ac_str80_buffer, sizeof __fprime_ac_str80_buffer);
|
|
_status = _buffer.deserializeTo(str80);
|
|
if (_status != Fw::FW_SERIALIZE_OK) {
|
|
return _status;
|
|
}
|
|
|
|
char __fprime_ac_str80Ref_buffer[Fw::StringBase::BUFFER_SIZE(80)];
|
|
Fw::ExternalString str80Ref(__fprime_ac_str80Ref_buffer, sizeof __fprime_ac_str80Ref_buffer);
|
|
_status = _buffer.deserializeTo(str80Ref);
|
|
if (_status != Fw::FW_SERIALIZE_OK) {
|
|
return _status;
|
|
}
|
|
|
|
char __fprime_ac_str100_buffer[Fw::StringBase::BUFFER_SIZE(100)];
|
|
Fw::ExternalString str100(__fprime_ac_str100_buffer, sizeof __fprime_ac_str100_buffer);
|
|
_status = _buffer.deserializeTo(str100);
|
|
if (_status != Fw::FW_SERIALIZE_OK) {
|
|
return _status;
|
|
}
|
|
|
|
char __fprime_ac_str100Ref_buffer[Fw::StringBase::BUFFER_SIZE(100)];
|
|
Fw::ExternalString str100Ref(__fprime_ac_str100Ref_buffer, sizeof __fprime_ac_str100Ref_buffer);
|
|
_status = _buffer.deserializeTo(str100Ref);
|
|
if (_status != Fw::FW_SERIALIZE_OK) {
|
|
return _status;
|
|
}
|
|
|
|
this->m_func(this->m_comp, this->m_portNum, str80, str80Ref, str100, str100Ref);
|
|
|
|
return Fw::FW_SERIALIZE_OK;
|
|
}
|
|
|
|
#endif
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Output Port Member functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
OutputStringPort ::
|
|
OutputStringPort() :
|
|
Fw::OutputPortBase(),
|
|
m_port(nullptr)
|
|
{
|
|
|
|
}
|
|
|
|
void OutputStringPort ::
|
|
init()
|
|
{
|
|
Fw::OutputPortBase::init();
|
|
}
|
|
|
|
void OutputStringPort ::
|
|
addCallPort(InputStringPort* callPort)
|
|
{
|
|
FW_ASSERT(callPort != nullptr);
|
|
|
|
this->m_port = callPort;
|
|
this->m_connObj = callPort;
|
|
|
|
#if FW_PORT_SERIALIZATION == 1
|
|
this->m_serPort = nullptr;
|
|
#endif
|
|
}
|
|
|
|
void OutputStringPort ::
|
|
invoke(
|
|
const Fw::StringBase& str80,
|
|
Fw::StringBase& str80Ref,
|
|
const Fw::StringBase& str100,
|
|
Fw::StringBase& str100Ref
|
|
) const
|
|
{
|
|
#if FW_PORT_TRACING == 1
|
|
this->trace();
|
|
#endif
|
|
|
|
#if FW_PORT_SERIALIZATION
|
|
FW_ASSERT((this->m_port != nullptr) || (this->m_serPort != nullptr));
|
|
|
|
if (this->m_port != nullptr) {
|
|
this->m_port->invoke(str80, str80Ref, str100, str100Ref);
|
|
}
|
|
else {
|
|
Fw::SerializeStatus _status;
|
|
StringPortBuffer _buffer;
|
|
|
|
_status = _buffer.serializeFrom(str80);
|
|
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
|
|
|
|
_status = _buffer.serializeFrom(str80Ref);
|
|
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
|
|
|
|
_status = _buffer.serializeFrom(str100);
|
|
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
|
|
|
|
_status = _buffer.serializeFrom(str100Ref);
|
|
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
|
|
|
|
_status = this->m_serPort->invokeSerial(_buffer);
|
|
FW_ASSERT(_status == Fw::FW_SERIALIZE_OK, static_cast<FwAssertArgType>(_status));
|
|
}
|
|
#else
|
|
FW_ASSERT(this->m_port != nullptr);
|
|
this->m_port->invoke(str80, str80Ref, str100, str100Ref);
|
|
#endif
|
|
}
|
|
|
|
#endif
|