Skip to content

Commit

Permalink
Added missing override keyword
Browse files Browse the repository at this point in the history
Signed-off-by: Cervenka Dusan <[email protected]>
  • Loading branch information
Hadatko committed Oct 23, 2023
1 parent f408f8d commit e27a424
Show file tree
Hide file tree
Showing 30 changed files with 285 additions and 198 deletions.
14 changes: 14 additions & 0 deletions erpc_c/infra/erpc_basic_codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ using namespace erpc;

const uint32_t BasicCodec::kBasicCodecVersion = 1UL;

BasicCodec::BasicCodec(void)
: Codec()
{
}

BasicCodec::~BasicCodec(void) {}

void BasicCodec::startWriteMessage(message_type_t type, uint32_t service, uint32_t request, uint32_t sequence)
{
uint32_t header =
Expand Down Expand Up @@ -367,6 +374,13 @@ void BasicCodec::readNullFlag(bool &isNull)

ERPC_MANUALLY_CONSTRUCTED_ARRAY_STATIC(BasicCodec, s_basicCodecManual, ERPC_CODEC_COUNT);

BasicCodecFactory::BasicCodecFactory(void)
: CodecFactory()
{
}

BasicCodecFactory::~BasicCodecFactory(void) {}

Codec *BasicCodecFactory::create(void)
{
ERPC_CREATE_NEW_OBJECT(BasicCodec, s_basicCodecManual, ERPC_CODEC_COUNT)
Expand Down
23 changes: 19 additions & 4 deletions erpc_c/infra/erpc_basic_codec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ class BasicCodec : public Codec
public:
static const uint32_t kBasicCodecVersion; /*!< Codec version. */

BasicCodec(void)
: Codec()
{
}
/*!
* @brief Constructor.
*/
BasicCodec(void);

/*!
* @brief CodecFactory destructor
*/
virtual ~BasicCodec(void);

//! @name Encoding
//@{
Expand Down Expand Up @@ -344,6 +349,16 @@ class BasicCodec : public Codec
class BasicCodecFactory : public CodecFactory
{
public:
/*!
* @brief Constructor.
*/
BasicCodecFactory(void);

/*!
* @brief CodecFactory destructor
*/
virtual ~BasicCodecFactory(void);

/*!
* @brief Return created codec.
*
Expand Down
9 changes: 9 additions & 0 deletions erpc_c/infra/erpc_message_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@ erpc_status_t Cursor::write(const void *data, uint32_t length)
return err;
}

MessageBufferFactory::MessageBufferFactory(void) {}

MessageBufferFactory::~MessageBufferFactory(void) {}

MessageBuffer MessageBufferFactory::create(uint8_t reserveHeaderSize)
{
MessageBuffer messageBuffer = create();
Expand All @@ -248,6 +252,11 @@ MessageBuffer MessageBufferFactory::create(uint8_t reserveHeaderSize)
return messageBuffer;
}

bool createServerBuffer(void)
{
return true;
}

erpc_status_t MessageBufferFactory::prepareServerBufferForSend(MessageBuffer &message, uint8_t reserveHeaderSize)
{
message.setUsed(reserveHeaderSize);
Expand Down
6 changes: 3 additions & 3 deletions erpc_c/infra/erpc_message_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,12 @@ class MessageBufferFactory
*
* This function initializes object attributes.
*/
MessageBufferFactory(void) {}
MessageBufferFactory(void);

/*!
* @brief MessageBufferFactory destructor
*/
virtual ~MessageBufferFactory(void) {}
virtual ~MessageBufferFactory(void);

/*!
* @brief This function creates new message buffer.
Expand All @@ -397,7 +397,7 @@ class MessageBufferFactory
*
* @return Has to return TRUE when server need create buffer for receiving message.
*/
virtual bool createServerBuffer(void) { return true; }
virtual bool createServerBuffer(void);

/*!
* @brief This function is preparing output buffer on server side.
Expand Down
2 changes: 1 addition & 1 deletion erpc_c/infra/erpc_message_loggers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class MessageLoggers
/*!
* @brief Transport destructor
*/
virtual ~MessageLoggers(void);
~MessageLoggers(void);

/*!
* @brief This function add given transport to newly created MessageLogger object.
Expand Down
78 changes: 42 additions & 36 deletions erpc_c/infra/erpc_simple_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,49 @@ using namespace erpc;
////////////////////////////////////////////////////////////////////////////////
// Code
////////////////////////////////////////////////////////////////////////////////
SimpleServer::SimpleServer(void)
: m_isServerOn(true)
{
}

void SimpleServer::disposeBufferAndCodec(Codec *codec)
SimpleServer::~SimpleServer(void) {}

erpc_status_t SimpleServer::run(void)
{
if (codec != NULL)
erpc_status_t err = kErpcStatus_Success;
while ((err == kErpcStatus_Success) && m_isServerOn)
{
if (codec->getBuffer() != NULL)
err = runInternal();
}
return err;
}

erpc_status_t SimpleServer::poll(void)
{
erpc_status_t err;

if (m_isServerOn)
{
if (m_transport->hasMessage() == true)
{
m_messageFactory->dispose(&codec->getBufferRef());
err = runInternal();
}
else
{
err = kErpcStatus_Success;
}
m_codecFactory->dispose(codec);
}
else
{
err = kErpcStatus_ServerIsDown;
}

return err;
}

void SimpleServer::stop(void)
{
m_isServerOn = false;
}

erpc_status_t SimpleServer::runInternal(void)
Expand Down Expand Up @@ -151,16 +183,6 @@ erpc_status_t SimpleServer::runInternalEnd(Codec *codec, message_type_t msgType,
return err;
}

erpc_status_t SimpleServer::run(void)
{
erpc_status_t err = kErpcStatus_Success;
while ((err == kErpcStatus_Success) && m_isServerOn)
{
err = runInternal();
}
return err;
}

#if ERPC_NESTED_CALLS
erpc_status_t SimpleServer::run(RequestContext &request)
{
Expand Down Expand Up @@ -212,30 +234,14 @@ erpc_status_t SimpleServer::run(RequestContext &request)
}
#endif

erpc_status_t SimpleServer::poll(void)
void SimpleServer::disposeBufferAndCodec(Codec *codec)
{
erpc_status_t err;

if (m_isServerOn)
if (codec != NULL)
{
if (m_transport->hasMessage() == true)
{
err = runInternal();
}
else
if (codec->getBuffer() != NULL)
{
err = kErpcStatus_Success;
m_messageFactory->dispose(&codec->getBufferRef());
}
m_codecFactory->dispose(codec);
}
else
{
err = kErpcStatus_ServerIsDown;
}

return err;
}

void SimpleServer::stop(void)
{
m_isServerOn = false;
}
27 changes: 13 additions & 14 deletions erpc_c/infra/erpc_simple_server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ class SimpleServer : public Server
*
* This function initializes object attributes.
*/
SimpleServer(void)
: m_isServerOn(true)
{
}
SimpleServer(void);

virtual ~SimpleServer(void);

/*!
* @brief Run server in infinite loop.
Expand All @@ -66,6 +65,16 @@ class SimpleServer : public Server
virtual void stop(void) override;

protected:
bool m_isServerOn; /*!< Information if server is ON or OFF. */

/*!
* @brief Run server implementation.
*
* This function call functions for receiving data, process this data and
* if reply exist, send it back.
*/
erpc_status_t runInternal(void);

/*!
* @brief This function handle receiving request message and reading base info about message.
*
Expand Down Expand Up @@ -104,22 +113,12 @@ class SimpleServer : public Server
virtual erpc_status_t run(RequestContext &request) override;
#endif

/*!
* @brief Run server implementation.
*
* This function call functions for receiving data, process this data and
* if reply exist, send it back.
*/
erpc_status_t runInternal(void);

/*!
* @brief Disposing message buffers and codecs.
*
* @param[in] codec Pointer to codec to dispose. It contains also message buffer to dispose.
*/
void disposeBufferAndCodec(Codec *codec);

bool m_isServerOn; /*!< Information if server is ON or OFF. */
};

} // namespace erpc
Expand Down
2 changes: 2 additions & 0 deletions erpc_c/infra/erpc_transport.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ class TransportFactory
* @brief Constructor.
*/
TransportFactory(void) {}

/*!
* @brief TransportFactory destructor
*/
virtual ~TransportFactory(void) {}

/*!
* @brief Return created transport object.
*
Expand Down
59 changes: 42 additions & 17 deletions erpc_c/infra/erpc_transport_arbitrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,9 @@ TransportArbitrator::~TransportArbitrator(void)
freeClientList(m_clientFreeList);
}

void TransportArbitrator::setCrc16(Crc16 *crcImpl)
uint8_t TransportArbitrator::reserveHeaderSize(void)
{
erpc_assert(crcImpl != NULL);
erpc_assert(m_sharedTransport != NULL);
m_sharedTransport->setCrc16(crcImpl);
}

Crc16 *TransportArbitrator::getCrc16(void)
{
erpc_assert(m_sharedTransport != NULL);
return m_sharedTransport->getCrc16();
}

bool TransportArbitrator::hasMessage(void)
{
erpc_assert((m_sharedTransport != NULL) && ("shared transport is not set" != NULL));

return m_sharedTransport->hasMessage();
return m_sharedTransport->reserveHeaderSize();
}

erpc_status_t TransportArbitrator::receive(MessageBuffer *message)
Expand Down Expand Up @@ -151,6 +136,46 @@ erpc_status_t TransportArbitrator::send(MessageBuffer *message)
return m_sharedTransport->send(message);
}

bool TransportArbitrator::hasMessage(void)
{
erpc_assert((m_sharedTransport != NULL) && ("shared transport is not set" != NULL));

return m_sharedTransport->hasMessage();
}

void TransportArbitrator::setCrc16(Crc16 *crcImpl)
{
erpc_assert(crcImpl != NULL);
erpc_assert(m_sharedTransport != NULL);
m_sharedTransport->setCrc16(crcImpl);
}

Crc16 *TransportArbitrator::getCrc16(void)
{
erpc_assert(m_sharedTransport != NULL);
return m_sharedTransport->getCrc16();
}

void TransportArbitrator::setSharedTransport(Transport *shared)
{
m_sharedTransport = shared;
}

Transport *TransportArbitrator::getSharedTransport(void)
{
return m_sharedTransport;
}

void TransportArbitrator::setCodec(Codec *codec)
{
m_codec = codec;
}

Codec *TransportArbitrator::getCodec(void)
{
return m_codec;
}

TransportArbitrator::client_token_t TransportArbitrator::prepareClientReceive(RequestContext &request)
{
PendingClientInfo *info = addPendingClient();
Expand Down
Loading

0 comments on commit e27a424

Please sign in to comment.