fpp/compiler/tools/fpp-to-cpp/test/port/StringPortAc.ref.hpp

155 lines
4.0 KiB
C++
Vendored

// ======================================================================
// \title StringPortAc.hpp
// \author Generated by fpp-to-cpp
// \brief hpp file for String port
// ======================================================================
#ifndef StringPortAc_HPP
#define StringPortAc_HPP
#include "Fw/FPrimeBasicTypes.hpp"
#if !FW_DIRECT_PORT_CALLS
#include "Fw/Comp/PassiveComponentBase.hpp"
#include "Fw/Port/InputPortBase.hpp"
#include "Fw/Port/OutputPortBase.hpp"
#include "Fw/Types/Serializable.hpp"
#include "Fw/Types/String.hpp"
#endif
//! String port constants
struct StringPortConstants {
//! The size of the serial representations of the port arguments
static constexpr FwSizeType INPUT_SERIALIZED_SIZE =
Fw::StringBase::STATIC_SERIALIZED_SIZE(80) +
Fw::StringBase::STATIC_SERIALIZED_SIZE(80) +
Fw::StringBase::STATIC_SERIALIZED_SIZE(100) +
Fw::StringBase::STATIC_SERIALIZED_SIZE(100);
};
#if !FW_DIRECT_PORT_CALLS
//! Input String port
//! A port with string parameters
class InputStringPort :
public Fw::InputPortBase
{
public:
// ----------------------------------------------------------------------
// Constants
// ----------------------------------------------------------------------
enum {
//! The size of the serial representations of the port arguments
SERIALIZED_SIZE = StringPortConstants::INPUT_SERIALIZED_SIZE
};
public:
// ----------------------------------------------------------------------
// Types
// ----------------------------------------------------------------------
//! The port callback function type
typedef void (*CompFuncPtr)(
Fw::PassiveComponentBase* callComp,
FwIndexType portNum,
const Fw::StringBase& str80,
Fw::StringBase& str80Ref,
const Fw::StringBase& str100,
Fw::StringBase& str100Ref
);
public:
// ----------------------------------------------------------------------
// Input Port Member functions
// ----------------------------------------------------------------------
//! Constructor
InputStringPort();
//! Initialization function
void init();
//! Register a component
void addCallComp(
Fw::PassiveComponentBase* callComp, //!< The containing component
CompFuncPtr funcPtr //!< The port callback function
);
//! Invoke a port interface
void invoke(
const Fw::StringBase& str80, //!< A string of size 80
Fw::StringBase& str80Ref,
const Fw::StringBase& str100, //!< A string of size 100
Fw::StringBase& str100Ref
);
private:
#if FW_PORT_SERIALIZATION == 1
//! Invoke the port with serialized arguments
Fw::SerializeStatus invokeSerial(Fw::LinearBufferBase& _buffer);
#endif
private:
// ----------------------------------------------------------------------
// Member variables
// ----------------------------------------------------------------------
//! The pointer to the port callback function
CompFuncPtr m_func;
};
//! Output String port
//! A port with string parameters
class OutputStringPort :
public Fw::OutputPortBase
{
public:
// ----------------------------------------------------------------------
// Output Port Member functions
// ----------------------------------------------------------------------
//! Constructor
OutputStringPort();
//! Initialization function
void init();
//! Register an input port
void addCallPort(
InputStringPort* callPort //!< The input port
);
//! Invoke a port interface
void invoke(
const Fw::StringBase& str80, //!< A string of size 80
Fw::StringBase& str80Ref,
const Fw::StringBase& str100, //!< A string of size 100
Fw::StringBase& str100Ref
) const;
private:
// ----------------------------------------------------------------------
// Member variables
// ----------------------------------------------------------------------
//! The pointer to the input port
InputStringPort* m_port;
};
#endif
#endif