mirror of
https://github.com/nasa/fpp.git
synced 2025-12-12 04:41:37 -06:00
163 lines
3.3 KiB
C++
163 lines
3.3 KiB
C++
// ======================================================================
|
|
// \title NoArgsPortAc.cpp
|
|
// \author Generated by fpp-to-cpp
|
|
// \brief cpp file for NoArgs port
|
|
// ======================================================================
|
|
|
|
#include "Fw/Types/Assert.hpp"
|
|
#include "Fw/Types/ExternalString.hpp"
|
|
#include "base/NoArgsPortAc.hpp"
|
|
|
|
namespace Ports {
|
|
|
|
namespace {
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Port buffer class
|
|
// ----------------------------------------------------------------------
|
|
|
|
class NoArgsPortBuffer : public Fw::SerializeBufferBase {
|
|
|
|
public:
|
|
|
|
Fw::Serializable::SizeType getBuffCapacity() const {
|
|
return InputNoArgsPort::SERIALIZED_SIZE;
|
|
}
|
|
|
|
U8* getBuffAddr() {
|
|
return nullptr;
|
|
}
|
|
|
|
const U8* getBuffAddr() const {
|
|
return nullptr;
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Input Port Member functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
InputNoArgsPort ::
|
|
InputNoArgsPort() :
|
|
Fw::InputPortBase(),
|
|
m_func(nullptr)
|
|
{
|
|
|
|
}
|
|
|
|
void InputNoArgsPort ::
|
|
init()
|
|
{
|
|
Fw::InputPortBase::init();
|
|
}
|
|
|
|
void InputNoArgsPort ::
|
|
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 InputNoArgsPort ::
|
|
invoke()
|
|
{
|
|
#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);
|
|
}
|
|
|
|
#if FW_PORT_SERIALIZATION == 1
|
|
|
|
Fw::SerializeStatus InputNoArgsPort ::
|
|
invokeSerial(Fw::SerializeBufferBase& _buffer)
|
|
{
|
|
(void) _buffer;
|
|
|
|
#if FW_PORT_TRACING == 1
|
|
this->trace();
|
|
#endif
|
|
|
|
FW_ASSERT(this->m_comp != nullptr);
|
|
FW_ASSERT(this->m_func != nullptr);
|
|
|
|
this->m_func(this->m_comp, this->m_portNum);
|
|
|
|
return Fw::FW_SERIALIZE_OK;
|
|
}
|
|
|
|
#endif
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Output Port Member functions
|
|
// ----------------------------------------------------------------------
|
|
|
|
OutputNoArgsPort ::
|
|
OutputNoArgsPort() :
|
|
Fw::OutputPortBase(),
|
|
m_port(nullptr)
|
|
{
|
|
|
|
}
|
|
|
|
void OutputNoArgsPort ::
|
|
init()
|
|
{
|
|
Fw::OutputPortBase::init();
|
|
}
|
|
|
|
void OutputNoArgsPort ::
|
|
addCallPort(InputNoArgsPort* callPort)
|
|
{
|
|
FW_ASSERT(callPort != nullptr);
|
|
|
|
this->m_port = callPort;
|
|
this->m_connObj = callPort;
|
|
|
|
#if FW_PORT_SERIALIZATION == 1
|
|
this->m_serPort = nullptr;
|
|
#endif
|
|
}
|
|
|
|
void OutputNoArgsPort ::
|
|
invoke() 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();
|
|
}
|
|
else {
|
|
Fw::SerializeStatus _status;
|
|
NoArgsPortBuffer _buffer;
|
|
|
|
_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();
|
|
#endif
|
|
}
|
|
|
|
}
|