// Copyright (c) ZeroC, Inc.

// slice2cpp version 3.8.1
// <auto-generated>Generated from Slice file 'RemoteLogger.ice'.</auto-generated>

#ifndef ICE_API_EXPORTS
#   define ICE_API_EXPORTS
#endif
#define ICE_BUILDING_GENERATED_CODE

#include "Ice/RemoteLogger.h"
#include <Ice/AsyncResponseHandler.h>
#include <Ice/DefaultSliceLoader.h>
#include <Ice/OutgoingAsync.h>
#include <algorithm>
#include <array>

#if defined(_MSC_VER)
#   pragma warning(disable : 4458) // declaration of ... hides class member
#   pragma warning(disable : 4996) // ... was declared deprecated
#elif defined(__clang__)
#   pragma clang diagnostic ignored "-Wshadow"
#   pragma clang diagnostic ignored "-Wdeprecated-declarations"
#elif defined(__GNUC__)
#   pragma GCC diagnostic ignored "-Wshadow"
#   pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif

#ifndef ICE_DISABLE_VERSION
#   if ICE_INT_VERSION / 100 != 308
#       error Ice version mismatch!
#   endif
#   if ICE_INT_VERSION % 100 >= 50
#       error Beta header file detected
#   endif
#   if ICE_INT_VERSION % 100 < 1
#       error Ice patch level mismatch!
#   endif
#endif

std::ostream&
Ice::operator<<(std::ostream& os, LogMessageType value)
{
    switch (value)
    {
        case LogMessageType::PrintMessage:
            return os << "PrintMessage";
        case LogMessageType::TraceMessage:
            return os << "TraceMessage";
        case LogMessageType::WarningMessage:
            return os << "WarningMessage";
        case LogMessageType::ErrorMessage:
            return os << "ErrorMessage";
        default:
            return os << static_cast<std::int32_t>(value);
    }
}

namespace
{
    const IceInternal::ExceptionInit<::Ice::RemoteLoggerAlreadyAttachedException> iceC_Ice_RemoteLoggerAlreadyAttachedException_init;
}

Ice::RemoteLoggerPrx::~RemoteLoggerPrx() = default;

void
Ice::RemoteLoggerPrx::init(std::string_view iceP_prefix, const LogMessageSeq& iceP_logMessages, const Ice::Context& context) const
{
    IceInternal::makePromiseOutgoing<void>(true, this, &RemoteLoggerPrx::_iceI_init, iceP_prefix, iceP_logMessages, context).get();
}

std::future<void>
Ice::RemoteLoggerPrx::initAsync(std::string_view iceP_prefix, const LogMessageSeq& iceP_logMessages, const Ice::Context& context) const
{
    return IceInternal::makePromiseOutgoing<void>(false, this, &RemoteLoggerPrx::_iceI_init, iceP_prefix, iceP_logMessages, context);
}

std::function<void()>
Ice::RemoteLoggerPrx::initAsync(std::string_view iceP_prefix, const LogMessageSeq& iceP_logMessages, std::function<void()> response, std::function<void(std::exception_ptr)> exception, std::function<void(bool)> sent, const Ice::Context& context) const
{
    return IceInternal::makeLambdaOutgoing<void>(std::move(response), std::move(exception), std::move(sent), this, &Ice::RemoteLoggerPrx::_iceI_init, iceP_prefix, iceP_logMessages, context);
}

void
Ice::RemoteLoggerPrx::_iceI_init(const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>& outAsync, std::string_view iceP_prefix, const LogMessageSeq& iceP_logMessages, const Ice::Context& context) const
{
    static constexpr std::string_view operationName = "init";

    outAsync->invoke(
        operationName,
        Ice::OperationMode::Normal,
        std::nullopt,
        context,
        [&](Ice::OutputStream* ostr)
        {
            ostr->writeAll(iceP_prefix, iceP_logMessages);
        },
        nullptr);
}

void
Ice::RemoteLoggerPrx::log(const LogMessage& iceP_message, const Ice::Context& context) const
{
    IceInternal::makePromiseOutgoing<void>(true, this, &RemoteLoggerPrx::_iceI_log, iceP_message, context).get();
}

std::future<void>
Ice::RemoteLoggerPrx::logAsync(const LogMessage& iceP_message, const Ice::Context& context) const
{
    return IceInternal::makePromiseOutgoing<void>(false, this, &RemoteLoggerPrx::_iceI_log, iceP_message, context);
}

std::function<void()>
Ice::RemoteLoggerPrx::logAsync(const LogMessage& iceP_message, std::function<void()> response, std::function<void(std::exception_ptr)> exception, std::function<void(bool)> sent, const Ice::Context& context) const
{
    return IceInternal::makeLambdaOutgoing<void>(std::move(response), std::move(exception), std::move(sent), this, &Ice::RemoteLoggerPrx::_iceI_log, iceP_message, context);
}

void
Ice::RemoteLoggerPrx::_iceI_log(const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>& outAsync, const LogMessage& iceP_message, const Ice::Context& context) const
{
    static constexpr std::string_view operationName = "log";

    outAsync->invoke(
        operationName,
        Ice::OperationMode::Normal,
        std::nullopt,
        context,
        [&](Ice::OutputStream* ostr)
        {
            ostr->writeAll(iceP_message);
        },
        nullptr);
}

const char*
Ice::RemoteLoggerPrx::ice_staticId() noexcept
{
    return "::Ice::RemoteLogger";
}

Ice::LoggerAdminPrx::~LoggerAdminPrx() = default;

void
Ice::LoggerAdminPrx::attachRemoteLogger(const std::optional<RemoteLoggerPrx>& iceP_prx, const LogMessageTypeSeq& iceP_messageTypes, const StringSeq& iceP_traceCategories, std::int32_t iceP_messageMax, const Ice::Context& context) const
{
    IceInternal::makePromiseOutgoing<void>(true, this, &LoggerAdminPrx::_iceI_attachRemoteLogger, iceP_prx, iceP_messageTypes, iceP_traceCategories, iceP_messageMax, context).get();
}

std::future<void>
Ice::LoggerAdminPrx::attachRemoteLoggerAsync(const std::optional<RemoteLoggerPrx>& iceP_prx, const LogMessageTypeSeq& iceP_messageTypes, const StringSeq& iceP_traceCategories, std::int32_t iceP_messageMax, const Ice::Context& context) const
{
    return IceInternal::makePromiseOutgoing<void>(false, this, &LoggerAdminPrx::_iceI_attachRemoteLogger, iceP_prx, iceP_messageTypes, iceP_traceCategories, iceP_messageMax, context);
}

std::function<void()>
Ice::LoggerAdminPrx::attachRemoteLoggerAsync(const std::optional<RemoteLoggerPrx>& iceP_prx, const LogMessageTypeSeq& iceP_messageTypes, const StringSeq& iceP_traceCategories, std::int32_t iceP_messageMax, std::function<void()> response, std::function<void(std::exception_ptr)> exception, std::function<void(bool)> sent, const Ice::Context& context) const
{
    return IceInternal::makeLambdaOutgoing<void>(std::move(response), std::move(exception), std::move(sent), this, &Ice::LoggerAdminPrx::_iceI_attachRemoteLogger, iceP_prx, iceP_messageTypes, iceP_traceCategories, iceP_messageMax, context);
}

void
Ice::LoggerAdminPrx::_iceI_attachRemoteLogger(const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>& outAsync, const std::optional<RemoteLoggerPrx>& iceP_prx, const LogMessageTypeSeq& iceP_messageTypes, const StringSeq& iceP_traceCategories, std::int32_t iceP_messageMax, const Ice::Context& context) const
{
    static constexpr std::string_view operationName = "attachRemoteLogger";

    _checkTwowayOnly(operationName);
    outAsync->invoke(
        operationName,
        Ice::OperationMode::Normal,
        std::nullopt,
        context,
        [&](Ice::OutputStream* ostr)
        {
            ostr->writeAll(iceP_prx, iceP_messageTypes, iceP_traceCategories, iceP_messageMax);
        },
        [](const Ice::UserException& ex)
        {
            try
            {
                ex.ice_throw();
            }
            catch (const RemoteLoggerAlreadyAttachedException&)
            {
                throw;
            }
            catch (const Ice::UserException&)
            {
            }
        });
}

bool
Ice::LoggerAdminPrx::detachRemoteLogger(const std::optional<RemoteLoggerPrx>& iceP_prx, const Ice::Context& context) const
{
    return IceInternal::makePromiseOutgoing<bool>(true, this, &LoggerAdminPrx::_iceI_detachRemoteLogger, iceP_prx, context).get();
}

std::future<bool>
Ice::LoggerAdminPrx::detachRemoteLoggerAsync(const std::optional<RemoteLoggerPrx>& iceP_prx, const Ice::Context& context) const
{
    return IceInternal::makePromiseOutgoing<bool>(false, this, &LoggerAdminPrx::_iceI_detachRemoteLogger, iceP_prx, context);
}

std::function<void()>
Ice::LoggerAdminPrx::detachRemoteLoggerAsync(const std::optional<RemoteLoggerPrx>& iceP_prx, std::function<void(bool)> response, std::function<void(std::exception_ptr)> exception, std::function<void(bool)> sent, const Ice::Context& context) const
{
    return IceInternal::makeLambdaOutgoing<bool>(std::move(response), std::move(exception), std::move(sent), this, &Ice::LoggerAdminPrx::_iceI_detachRemoteLogger, iceP_prx, context);
}

void
Ice::LoggerAdminPrx::_iceI_detachRemoteLogger(const std::shared_ptr<IceInternal::OutgoingAsyncT<bool>>& outAsync, const std::optional<RemoteLoggerPrx>& iceP_prx, const Ice::Context& context) const
{
    static constexpr std::string_view operationName = "detachRemoteLogger";

    _checkTwowayOnly(operationName);
    outAsync->invoke(
        operationName,
        Ice::OperationMode::Normal,
        std::nullopt,
        context,
        [&](Ice::OutputStream* ostr)
        {
            ostr->writeAll(iceP_prx);
        },
        nullptr);
}

::Ice::LogMessageSeq
Ice::LoggerAdminPrx::getLog(const LogMessageTypeSeq& iceP_messageTypes, const StringSeq& iceP_traceCategories, std::int32_t iceP_messageMax, std::string& iceP_prefix, const Ice::Context& context) const
{
    auto result = IceInternal::makePromiseOutgoing<std::tuple<LogMessageSeq, std::string>>(true, this, &LoggerAdminPrx::_iceI_getLog, iceP_messageTypes, iceP_traceCategories, iceP_messageMax, context).get();
    iceP_prefix = std::move(std::get<1>(result));
    return std::move(std::get<0>(result));
}

std::future<std::tuple<::Ice::LogMessageSeq, std::string>>
Ice::LoggerAdminPrx::getLogAsync(const LogMessageTypeSeq& iceP_messageTypes, const StringSeq& iceP_traceCategories, std::int32_t iceP_messageMax, const Ice::Context& context) const
{
    return IceInternal::makePromiseOutgoing<std::tuple<LogMessageSeq, std::string>>(false, this, &LoggerAdminPrx::_iceI_getLog, iceP_messageTypes, iceP_traceCategories, iceP_messageMax, context);
}

std::function<void()>
Ice::LoggerAdminPrx::getLogAsync(const LogMessageTypeSeq& iceP_messageTypes, const StringSeq& iceP_traceCategories, std::int32_t iceP_messageMax, std::function<void(::Ice::LogMessageSeq, std::string)> response, std::function<void(std::exception_ptr)> exception, std::function<void(bool)> sent, const Ice::Context& context) const
{
    auto responseCb = [response = std::move(response)](std::tuple<LogMessageSeq, std::string>&& result) mutable
    {
        std::apply(std::move(response), std::move(result));
    };
    return IceInternal::makeLambdaOutgoing<std::tuple<LogMessageSeq, std::string>>(std::move(responseCb), std::move(exception), std::move(sent), this, &Ice::LoggerAdminPrx::_iceI_getLog, iceP_messageTypes, iceP_traceCategories, iceP_messageMax, context);
}

void
Ice::LoggerAdminPrx::_iceI_getLog(const std::shared_ptr<IceInternal::OutgoingAsyncT<std::tuple<LogMessageSeq, std::string>>>& outAsync, const LogMessageTypeSeq& iceP_messageTypes, const StringSeq& iceP_traceCategories, std::int32_t iceP_messageMax, const Ice::Context& context) const
{
    static constexpr std::string_view operationName = "getLog";

    _checkTwowayOnly(operationName);
    outAsync->invoke(
        operationName,
        Ice::OperationMode::Normal,
        std::nullopt,
        context,
        [&](Ice::OutputStream* ostr)
        {
            ostr->writeAll(iceP_messageTypes, iceP_traceCategories, iceP_messageMax);
        },
        nullptr,
        [](Ice::InputStream* istr)
        {
            std::tuple<LogMessageSeq, std::string> v;
            istr->readAll(std::get<1>(v), std::get<0>(v));
            return v;
        });
}

const char*
Ice::LoggerAdminPrx::ice_staticId() noexcept
{
    return "::Ice::LoggerAdmin";
}

void
Ice::LogMessage::ice_printFields(std::ostream& os) const
{
    Ice::print(os << "type = ", this->type);
    Ice::print(os << ", timestamp = ", this->timestamp);
    Ice::print(os << ", traceCategory = ", this->traceCategory);
    Ice::print(os << ", message = ", this->message);
}

std::ostream&
Ice::operator<<(std::ostream& os, const ::Ice::LogMessage& value)
{
    os << "Ice::LogMessage{";
    value.ice_printFields(os);
    os << '}';
    return os;
}

const char*
Ice::RemoteLoggerAlreadyAttachedException::ice_staticId() noexcept
{
    return "::Ice::RemoteLoggerAlreadyAttachedException";
}

const char*
Ice::RemoteLoggerAlreadyAttachedException::ice_id() const noexcept
{
    return ice_staticId();
}

void
Ice::RemoteLoggerAlreadyAttachedException::ice_throw() const
{
    throw *this;
}

void
Ice::RemoteLoggerAlreadyAttachedException::_writeImpl(Ice::OutputStream* ostr) const
{
    ostr->startSlice(ice_staticId(), -1, true);
    ostr->endSlice();
}

void
Ice::RemoteLoggerAlreadyAttachedException::_readImpl(Ice::InputStream* istr)
{
    istr->startSlice();
    istr->endSlice();
}

void
Ice::RemoteLogger::dispatch(Ice::IncomingRequest& request, std::function<void(Ice::OutgoingResponse)> sendResponse)
{
    static constexpr std::array<std::string_view, 6> allOperations{"ice_id", "ice_ids", "ice_isA", "ice_ping", "init", "log"};

    const Ice::Current& current = request.current();
    auto r = std::equal_range(allOperations.begin(), allOperations.end(), current.operation); // NOLINT(modernize-use-ranges)
    if (r.first == r.second)
    {
        sendResponse(Ice::makeOutgoingResponse(std::make_exception_ptr(Ice::OperationNotExistException{__FILE__, __LINE__}), current));
        return;
    }

    switch (r.first - allOperations.begin())
    {
        case 0:
        {
            _iceD_ice_id(request, std::move(sendResponse));
            break;
        }
        case 1:
        {
            _iceD_ice_ids(request, std::move(sendResponse));
            break;
        }
        case 2:
        {
            _iceD_ice_isA(request, std::move(sendResponse));
            break;
        }
        case 3:
        {
            _iceD_ice_ping(request, std::move(sendResponse));
            break;
        }
        case 4:
        {
            _iceD_init(request, std::move(sendResponse));
            break;
        }
        case 5:
        {
            _iceD_log(request, std::move(sendResponse));
            break;
        }
        default:
        {
            assert(false);
            sendResponse(Ice::makeOutgoingResponse(std::make_exception_ptr(Ice::OperationNotExistException{__FILE__, __LINE__}), current));
        }
    }
}

std::vector<std::string>
Ice::RemoteLogger::ice_ids(const Ice::Current&) const
{
    static const std::vector<std::string> allTypeIds = {"::Ice::Object", "::Ice::RemoteLogger"};
    return allTypeIds;
}

std::string
Ice::RemoteLogger::ice_id(const Ice::Current&) const
{
    return std::string{ice_staticId()};
}

void
Ice::RemoteLogger::_iceD_init(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse) // NOLINT(performance-unnecessary-value-param)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    std::string iceP_prefix;
    LogMessageSeq iceP_logMessages;
    istr->readAll(iceP_prefix, iceP_logMessages);
    istr->endEncapsulation();
    this->init(std::move(iceP_prefix), std::move(iceP_logMessages), request.current());
    sendResponse(Ice::makeEmptyOutgoingResponse(request.current()));
}

void
Ice::RemoteLogger::_iceD_log(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse) // NOLINT(performance-unnecessary-value-param)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    LogMessage iceP_message;
    istr->readAll(iceP_message);
    istr->endEncapsulation();
    this->log(std::move(iceP_message), request.current());
    sendResponse(Ice::makeEmptyOutgoingResponse(request.current()));
}

const char*
Ice::RemoteLogger::ice_staticId() noexcept
{
    return "::Ice::RemoteLogger";
}

void
Ice::LoggerAdmin::dispatch(Ice::IncomingRequest& request, std::function<void(Ice::OutgoingResponse)> sendResponse)
{
    static constexpr std::array<std::string_view, 7> allOperations{"attachRemoteLogger", "detachRemoteLogger", "getLog", "ice_id", "ice_ids", "ice_isA", "ice_ping"};

    const Ice::Current& current = request.current();
    auto r = std::equal_range(allOperations.begin(), allOperations.end(), current.operation); // NOLINT(modernize-use-ranges)
    if (r.first == r.second)
    {
        sendResponse(Ice::makeOutgoingResponse(std::make_exception_ptr(Ice::OperationNotExistException{__FILE__, __LINE__}), current));
        return;
    }

    switch (r.first - allOperations.begin())
    {
        case 0:
        {
            _iceD_attachRemoteLogger(request, std::move(sendResponse));
            break;
        }
        case 1:
        {
            _iceD_detachRemoteLogger(request, std::move(sendResponse));
            break;
        }
        case 2:
        {
            _iceD_getLog(request, std::move(sendResponse));
            break;
        }
        case 3:
        {
            _iceD_ice_id(request, std::move(sendResponse));
            break;
        }
        case 4:
        {
            _iceD_ice_ids(request, std::move(sendResponse));
            break;
        }
        case 5:
        {
            _iceD_ice_isA(request, std::move(sendResponse));
            break;
        }
        case 6:
        {
            _iceD_ice_ping(request, std::move(sendResponse));
            break;
        }
        default:
        {
            assert(false);
            sendResponse(Ice::makeOutgoingResponse(std::make_exception_ptr(Ice::OperationNotExistException{__FILE__, __LINE__}), current));
        }
    }
}

std::vector<std::string>
Ice::LoggerAdmin::ice_ids(const Ice::Current&) const
{
    static const std::vector<std::string> allTypeIds = {"::Ice::LoggerAdmin", "::Ice::Object"};
    return allTypeIds;
}

std::string
Ice::LoggerAdmin::ice_id(const Ice::Current&) const
{
    return std::string{ice_staticId()};
}

void
Ice::LoggerAdmin::_iceD_attachRemoteLogger(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse) // NOLINT(performance-unnecessary-value-param)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    std::optional<RemoteLoggerPrx> iceP_prx;
    LogMessageTypeSeq iceP_messageTypes;
    StringSeq iceP_traceCategories;
    std::int32_t iceP_messageMax;
    istr->readAll(iceP_prx, iceP_messageTypes, iceP_traceCategories, iceP_messageMax);
    istr->endEncapsulation();
    this->attachRemoteLogger(std::move(iceP_prx), std::move(iceP_messageTypes), std::move(iceP_traceCategories), iceP_messageMax, request.current());
    sendResponse(Ice::makeEmptyOutgoingResponse(request.current()));
}

void
Ice::LoggerAdmin::_iceD_detachRemoteLogger(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse) // NOLINT(performance-unnecessary-value-param)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    std::optional<RemoteLoggerPrx> iceP_prx;
    istr->readAll(iceP_prx);
    istr->endEncapsulation();
    const bool ret = this->detachRemoteLogger(std::move(iceP_prx), request.current());
    sendResponse(Ice::makeOutgoingResponse([&](Ice::OutputStream* ostr)
        {
            ostr->writeAll(ret);
        },
        request.current()));
}

void
Ice::LoggerAdmin::_iceD_getLog(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse) // NOLINT(performance-unnecessary-value-param)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    LogMessageTypeSeq iceP_messageTypes;
    StringSeq iceP_traceCategories;
    std::int32_t iceP_messageMax;
    istr->readAll(iceP_messageTypes, iceP_traceCategories, iceP_messageMax);
    istr->endEncapsulation();
    std::string iceP_prefix;
    const LogMessageSeq ret = this->getLog(std::move(iceP_messageTypes), std::move(iceP_traceCategories), iceP_messageMax, iceP_prefix, request.current());
    sendResponse(Ice::makeOutgoingResponse([&](Ice::OutputStream* ostr)
        {
            ostr->writeAll(iceP_prefix, ret);
        },
        request.current()));
}

const char*
Ice::LoggerAdmin::ice_staticId() noexcept
{
    return "::Ice::LoggerAdmin";
}

void
Ice::AsyncRemoteLogger::dispatch(Ice::IncomingRequest& request, std::function<void(Ice::OutgoingResponse)> sendResponse)
{
    static constexpr std::array<std::string_view, 6> allOperations{"ice_id", "ice_ids", "ice_isA", "ice_ping", "init", "log"};

    const Ice::Current& current = request.current();
    auto r = std::equal_range(allOperations.begin(), allOperations.end(), current.operation); // NOLINT(modernize-use-ranges)
    if (r.first == r.second)
    {
        sendResponse(Ice::makeOutgoingResponse(std::make_exception_ptr(Ice::OperationNotExistException{__FILE__, __LINE__}), current));
        return;
    }

    switch (r.first - allOperations.begin())
    {
        case 0:
        {
            _iceD_ice_id(request, std::move(sendResponse));
            break;
        }
        case 1:
        {
            _iceD_ice_ids(request, std::move(sendResponse));
            break;
        }
        case 2:
        {
            _iceD_ice_isA(request, std::move(sendResponse));
            break;
        }
        case 3:
        {
            _iceD_ice_ping(request, std::move(sendResponse));
            break;
        }
        case 4:
        {
            _iceD_init(request, std::move(sendResponse));
            break;
        }
        case 5:
        {
            _iceD_log(request, std::move(sendResponse));
            break;
        }
        default:
        {
            assert(false);
            sendResponse(Ice::makeOutgoingResponse(std::make_exception_ptr(Ice::OperationNotExistException{__FILE__, __LINE__}), current));
        }
    }
}

std::vector<std::string>
Ice::AsyncRemoteLogger::ice_ids(const Ice::Current&) const
{
    static const std::vector<std::string> allTypeIds = {"::Ice::Object", "::Ice::RemoteLogger"};
    return allTypeIds;
}

std::string
Ice::AsyncRemoteLogger::ice_id(const Ice::Current&) const
{
    return std::string{ice_staticId()};
}

void
Ice::AsyncRemoteLogger::_iceD_init(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    std::string iceP_prefix;
    LogMessageSeq iceP_logMessages;
    istr->readAll(iceP_prefix, iceP_logMessages);
    istr->endEncapsulation();
    auto responseHandler = std::make_shared<IceInternal::AsyncResponseHandler>(std::move(sendResponse), request.current());
    try
    {
        this->initAsync(std::move(iceP_prefix), std::move(iceP_logMessages), [responseHandler] { responseHandler->sendEmptyResponse(); }, [responseHandler](std::exception_ptr ex) { responseHandler->sendException(ex); }, responseHandler->current());
    }
    catch (...)
    {
        responseHandler->sendException(std::current_exception());
    }
}

void
Ice::AsyncRemoteLogger::_iceD_log(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    LogMessage iceP_message;
    istr->readAll(iceP_message);
    istr->endEncapsulation();
    auto responseHandler = std::make_shared<IceInternal::AsyncResponseHandler>(std::move(sendResponse), request.current());
    try
    {
        this->logAsync(std::move(iceP_message), [responseHandler] { responseHandler->sendEmptyResponse(); }, [responseHandler](std::exception_ptr ex) { responseHandler->sendException(ex); }, responseHandler->current());
    }
    catch (...)
    {
        responseHandler->sendException(std::current_exception());
    }
}

const char*
Ice::AsyncRemoteLogger::ice_staticId() noexcept
{
    return "::Ice::RemoteLogger";
}

void
Ice::AsyncLoggerAdmin::dispatch(Ice::IncomingRequest& request, std::function<void(Ice::OutgoingResponse)> sendResponse)
{
    static constexpr std::array<std::string_view, 7> allOperations{"attachRemoteLogger", "detachRemoteLogger", "getLog", "ice_id", "ice_ids", "ice_isA", "ice_ping"};

    const Ice::Current& current = request.current();
    auto r = std::equal_range(allOperations.begin(), allOperations.end(), current.operation); // NOLINT(modernize-use-ranges)
    if (r.first == r.second)
    {
        sendResponse(Ice::makeOutgoingResponse(std::make_exception_ptr(Ice::OperationNotExistException{__FILE__, __LINE__}), current));
        return;
    }

    switch (r.first - allOperations.begin())
    {
        case 0:
        {
            _iceD_attachRemoteLogger(request, std::move(sendResponse));
            break;
        }
        case 1:
        {
            _iceD_detachRemoteLogger(request, std::move(sendResponse));
            break;
        }
        case 2:
        {
            _iceD_getLog(request, std::move(sendResponse));
            break;
        }
        case 3:
        {
            _iceD_ice_id(request, std::move(sendResponse));
            break;
        }
        case 4:
        {
            _iceD_ice_ids(request, std::move(sendResponse));
            break;
        }
        case 5:
        {
            _iceD_ice_isA(request, std::move(sendResponse));
            break;
        }
        case 6:
        {
            _iceD_ice_ping(request, std::move(sendResponse));
            break;
        }
        default:
        {
            assert(false);
            sendResponse(Ice::makeOutgoingResponse(std::make_exception_ptr(Ice::OperationNotExistException{__FILE__, __LINE__}), current));
        }
    }
}

std::vector<std::string>
Ice::AsyncLoggerAdmin::ice_ids(const Ice::Current&) const
{
    static const std::vector<std::string> allTypeIds = {"::Ice::LoggerAdmin", "::Ice::Object"};
    return allTypeIds;
}

std::string
Ice::AsyncLoggerAdmin::ice_id(const Ice::Current&) const
{
    return std::string{ice_staticId()};
}

void
Ice::AsyncLoggerAdmin::_iceD_attachRemoteLogger(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    std::optional<RemoteLoggerPrx> iceP_prx;
    LogMessageTypeSeq iceP_messageTypes;
    StringSeq iceP_traceCategories;
    std::int32_t iceP_messageMax;
    istr->readAll(iceP_prx, iceP_messageTypes, iceP_traceCategories, iceP_messageMax);
    istr->endEncapsulation();
    auto responseHandler = std::make_shared<IceInternal::AsyncResponseHandler>(std::move(sendResponse), request.current());
    try
    {
        this->attachRemoteLoggerAsync(std::move(iceP_prx), std::move(iceP_messageTypes), std::move(iceP_traceCategories), iceP_messageMax, [responseHandler] { responseHandler->sendEmptyResponse(); }, [responseHandler](std::exception_ptr ex) { responseHandler->sendException(ex); }, responseHandler->current());
    }
    catch (...)
    {
        responseHandler->sendException(std::current_exception());
    }
}

void
Ice::AsyncLoggerAdmin::_iceD_detachRemoteLogger(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    std::optional<RemoteLoggerPrx> iceP_prx;
    istr->readAll(iceP_prx);
    istr->endEncapsulation();
    auto responseHandler = std::make_shared<IceInternal::AsyncResponseHandler>(std::move(sendResponse), request.current());
    auto responseCb = [responseHandler](bool ret)
    {
        responseHandler->sendResponse(
            [&](Ice::OutputStream* ostr)
            {
                ostr->writeAll(ret);
            });
    };
    try
    {
        this->detachRemoteLoggerAsync(std::move(iceP_prx), std::move(responseCb), [responseHandler](std::exception_ptr ex) { responseHandler->sendException(ex); }, responseHandler->current());
    }
    catch (...)
    {
        responseHandler->sendException(std::current_exception());
    }
}

void
Ice::AsyncLoggerAdmin::_iceD_getLog(
    Ice::IncomingRequest& request,
    std::function<void(Ice::OutgoingResponse)> sendResponse)
{
    checkNonIdempotent(request.current());
    auto istr = &request.inputStream();
    istr->startEncapsulation();
    LogMessageTypeSeq iceP_messageTypes;
    StringSeq iceP_traceCategories;
    std::int32_t iceP_messageMax;
    istr->readAll(iceP_messageTypes, iceP_traceCategories, iceP_messageMax);
    istr->endEncapsulation();
    auto responseHandler = std::make_shared<IceInternal::AsyncResponseHandler>(std::move(sendResponse), request.current());
    auto responseCb = [responseHandler](const LogMessageSeq& ret, std::string_view iceP_prefix)
    {
        responseHandler->sendResponse(
            [&](Ice::OutputStream* ostr)
            {
                ostr->writeAll(iceP_prefix, ret);
            });
    };
    try
    {
        this->getLogAsync(std::move(iceP_messageTypes), std::move(iceP_traceCategories), iceP_messageMax, std::move(responseCb), [responseHandler](std::exception_ptr ex) { responseHandler->sendException(ex); }, responseHandler->current());
    }
    catch (...)
    {
        responseHandler->sendException(std::current_exception());
    }
}

const char*
Ice::AsyncLoggerAdmin::ice_staticId() noexcept
{
    return "::Ice::LoggerAdmin";
}
