/*
 * Generated by erpcgen 1.14.0 on Tue Apr 28 12:16:37 2026.
 *
 * AUTOGENERATED - DO NOT EDIT
 */


#include <new>
#include "c_file_service_server.h"
#include "file_service_server.hpp"
#include "erpc_manually_constructed.hpp"

using namespace erpc;
using namespace std;
using namespace erpcShim;


class file_service_server: public file_service_interface
{
    public:
        virtual ~file_service_server() {};


        int32_t fileWriteBegin(const char * path, uint32_t total_size)
        {
            int32_t result;
            result = ::fileWriteBegin(path, total_size);

            return result;
        }

        int32_t fileWriteChunk(const binary_t * data)
        {
            int32_t result;
            result = ::fileWriteChunk(data);

            return result;
        }

        int32_t fileWriteEnd(void)
        {
            int32_t result;
            result = ::fileWriteEnd();

            return result;
        }

        int32_t fileWriteAbort(void)
        {
            int32_t result;
            result = ::fileWriteAbort();

            return result;
        }
};

ERPC_MANUALLY_CONSTRUCTED_STATIC(file_service_service, s_file_service_service);
ERPC_MANUALLY_CONSTRUCTED_STATIC(file_service_server, s_file_service_server);

erpc_service_t create_file_service_service(void)
{
    erpc_service_t service;

#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
    service = new (nothrow) file_service_service(new (nothrow)file_service_server());
#else
    if (s_file_service_service.isUsed())
    {
        service = NULL;
    }
    else
    {
        s_file_service_server.construct();
        s_file_service_service.construct(s_file_service_server.get());
        service = s_file_service_service.get();
    }
#endif

    return service;
}

void destroy_file_service_service(erpc_service_t service)
{
#if ERPC_ALLOCATION_POLICY == ERPC_ALLOCATION_POLICY_DYNAMIC
    if (service)
    {
        delete (file_service_server *)(((file_service_service *)service)->getHandler());
        delete (file_service_service *)service;
    }
#else
    (void)service;
    erpc_assert(service == s_file_service_service.get());
    s_file_service_service.destroy();
    s_file_service_server.destroy();
#endif
}

