// Copyright (c) ZeroC, Inc.

// slice2cpp version 3.8.1
// <auto-generated>Generated from Slice file 'Metrics.ice'.</auto-generated>
// clang-format off

#ifndef Ice_Metrics_h_
#define Ice_Metrics_h_

#include <Ice/PushDisableWarnings.h>
#include <Ice/Ice.h>
#include "BuiltinSequences.h"

#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

// NOLINTBEGIN(modernize-concat-nested-namespaces)

/// The Ice Management eXtension facility.
namespace IceMX
{
    /// A dictionary of strings to integers.
    using StringIntDict = std::map<std::string, std::int32_t>;

    class Metrics;

    /// A shared pointer to a Metrics.
    using MetricsPtr = std::shared_ptr<Metrics>;

    struct MetricsFailures;

    /// A sequence of MetricsFailures.
    using MetricsFailuresSeq = std::vector<MetricsFailures>;

    /// A sequence of metrics.
    /// @remarks We use a sequence here instead of a map because the ID of the metrics is already included in the Metrics
    /// class and using sequences of metrics objects is more efficient than using dictionaries since lookups are not
    /// necessary.
    using MetricsMap = std::vector<MetricsPtr>;

    /// A metrics view is a dictionary of metrics maps. The key of the dictionary is the name of the metrics map.
    using MetricsView = std::map<std::string, MetricsMap>;

    class MetricsAdminPrx;

    class ThreadMetrics;

    /// A shared pointer to a ThreadMetrics.
    using ThreadMetricsPtr = std::shared_ptr<ThreadMetrics>;

    class DispatchMetrics;

    /// A shared pointer to a DispatchMetrics.
    using DispatchMetricsPtr = std::shared_ptr<DispatchMetrics>;

    class ChildInvocationMetrics;

    /// A shared pointer to a ChildInvocationMetrics.
    using ChildInvocationMetricsPtr = std::shared_ptr<ChildInvocationMetrics>;

    class CollocatedMetrics;

    /// A shared pointer to a CollocatedMetrics.
    using CollocatedMetricsPtr = std::shared_ptr<CollocatedMetrics>;

    class RemoteMetrics;

    /// A shared pointer to a RemoteMetrics.
    using RemoteMetricsPtr = std::shared_ptr<RemoteMetrics>;

    class InvocationMetrics;

    /// A shared pointer to an InvocationMetrics.
    using InvocationMetricsPtr = std::shared_ptr<InvocationMetrics>;

    class ConnectionMetrics;

    /// A shared pointer to a ConnectionMetrics.
    using ConnectionMetricsPtr = std::shared_ptr<ConnectionMetrics>;
}

namespace IceMX
{
    /// The metrics administrative facet interface. This interface allows remote administrative clients to access the
    /// metrics of an application that enabled the Ice administrative facility and configured one or more metrics views.
    /// @remarks The Slice compiler generated this proxy class from Slice interface `::IceMX::MetricsAdmin`.
    /// @headerfile Ice/Ice.h
    class ICE_API MetricsAdminPrx : public Ice::Proxy<MetricsAdminPrx, Ice::ObjectPrx>
    {
    public:
        /// Constructs a proxy from a Communicator and a proxy string.
        /// @param communicator The communicator of the new proxy.
        /// @param proxyString The proxy string to parse.
        MetricsAdminPrx(const Ice::CommunicatorPtr& communicator, std::string_view proxyString) : Ice::ObjectPrx{communicator, proxyString} {} // NOLINT(modernize-use-equals-default)

        /// Copy constructor. Constructs with a copy of the contents of @p other.
        /// @param other The proxy to copy from.
        MetricsAdminPrx(const MetricsAdminPrx& other) noexcept : Ice::ObjectPrx{other} {} // NOLINT(modernize-use-equals-default)

        /// Move constructor. Constructs a proxy with the contents of @p other using move semantics.
        /// @param other The proxy to move from.
        MetricsAdminPrx(MetricsAdminPrx&& other) noexcept : Ice::ObjectPrx{std::move(other)} {} // NOLINT(modernize-use-equals-default)

        ~MetricsAdminPrx() override;

        /// Copy assignment operator. Replaces the contents of this proxy with a copy of the contents of @p rhs.
        /// @param rhs The proxy to copy from.
        /// @return A reference to this proxy.
        MetricsAdminPrx& operator=(const MetricsAdminPrx& rhs) noexcept
        {
            if (this != &rhs)
            {
                Ice::ObjectPrx::operator=(rhs);
            }
            return *this;
        }

        /// Move assignment operator. Replaces the contents of this proxy with the contents of @p rhs using move semantics.
        /// @param rhs The proxy to move from.
        MetricsAdminPrx& operator=(MetricsAdminPrx&& rhs) noexcept
        {
            if (this != &rhs)
            {
                Ice::ObjectPrx::operator=(std::move(rhs));
            }
            return *this;
        }

        /// Gets the names of enabled and disabled metrics.
        /// @param[out] disabledViews The names of the disabled views.
        /// @param context The request context.
        /// @return The names of the enabled views.
        ::Ice::StringSeq getMetricsViewNames(::Ice::StringSeq& disabledViews, const Ice::Context& context = Ice::noExplicitContext) const;

        /// Gets the names of enabled and disabled metrics.
        /// @param context The request context.
        /// @return A future that becomes available when the invocation completes. This future holds:
        /// - `returnValue` The names of the enabled views.
        /// - `disabledViews` The names of the disabled views.
        [[nodiscard]] std::future<std::tuple<::Ice::StringSeq, ::Ice::StringSeq>> getMetricsViewNamesAsync(const Ice::Context& context = Ice::noExplicitContext) const;

        /// Gets the names of enabled and disabled metrics.
        /// @param response The response callback. It accepts:
        /// - `returnValue` The names of the enabled views.
        /// - `disabledViews` The names of the disabled views.
        /// @param exception The exception callback.
        /// @param sent The sent callback.
        /// @param context The request context.
        /// @return A function that can be called to cancel the invocation locally.
        // NOLINTNEXTLINE(modernize-use-nodiscard)
        std::function<void()> getMetricsViewNamesAsync(std::function<void(::Ice::StringSeq, ::Ice::StringSeq)> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;

        /// @private
        void _iceI_getMetricsViewNames(const std::shared_ptr<IceInternal::OutgoingAsyncT<std::tuple<::Ice::StringSeq, ::Ice::StringSeq>>>&, const Ice::Context&) const;

        /// Enables a metrics view.
        /// @param name The metrics view name.
        /// @param context The request context.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        void enableMetricsView(std::string_view name, const Ice::Context& context = Ice::noExplicitContext) const;

        /// Enables a metrics view.
        /// @param name The metrics view name.
        /// @param context The request context.
        /// @return A future that becomes available when the invocation completes.
        [[nodiscard]] std::future<void> enableMetricsViewAsync(std::string_view name, const Ice::Context& context = Ice::noExplicitContext) const;

        /// Enables a metrics view.
        /// @param name The metrics view name.
        /// @param response The response callback.
        /// @param exception The exception callback.
        /// @param sent The sent callback.
        /// @param context The request context.
        /// @return A function that can be called to cancel the invocation locally.
        // NOLINTNEXTLINE(modernize-use-nodiscard)
        std::function<void()> enableMetricsViewAsync(std::string_view name, std::function<void()> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;

        /// @private
        void _iceI_enableMetricsView(const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>&, std::string_view, const Ice::Context&) const;

        /// Disables a metrics view.
        /// @param name The metrics view name.
        /// @param context The request context.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        void disableMetricsView(std::string_view name, const Ice::Context& context = Ice::noExplicitContext) const;

        /// Disables a metrics view.
        /// @param name The metrics view name.
        /// @param context The request context.
        /// @return A future that becomes available when the invocation completes.
        [[nodiscard]] std::future<void> disableMetricsViewAsync(std::string_view name, const Ice::Context& context = Ice::noExplicitContext) const;

        /// Disables a metrics view.
        /// @param name The metrics view name.
        /// @param response The response callback.
        /// @param exception The exception callback.
        /// @param sent The sent callback.
        /// @param context The request context.
        /// @return A function that can be called to cancel the invocation locally.
        // NOLINTNEXTLINE(modernize-use-nodiscard)
        std::function<void()> disableMetricsViewAsync(std::string_view name, std::function<void()> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;

        /// @private
        void _iceI_disableMetricsView(const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>&, std::string_view, const Ice::Context&) const;

        /// Gets the metrics objects for the given metrics view.
        /// @param view The name of the metrics view.
        /// @param[out] timestamp The local time of the process when the metrics objects were retrieved.
        /// @param context The request context.
        /// @return The metrics view data, a dictionary of metric maps for each metrics class configured with the view.
        /// The @p timestamp allows the client to compute averages which are not dependent of the invocation latency for
        /// this operation.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        MetricsView getMetricsView(std::string_view view, std::int64_t& timestamp, const Ice::Context& context = Ice::noExplicitContext) const;

        /// Gets the metrics objects for the given metrics view.
        /// @param view The name of the metrics view.
        /// @param context The request context.
        /// @return A future that becomes available when the invocation completes. This future holds:
        /// - `returnValue` The metrics view data, a dictionary of metric maps for each metrics class configured with the view.
        /// The @p timestamp allows the client to compute averages which are not dependent of the invocation latency for
        /// this operation.
        /// - `timestamp` The local time of the process when the metrics objects were retrieved.
        [[nodiscard]] std::future<std::tuple<MetricsView, std::int64_t>> getMetricsViewAsync(std::string_view view, const Ice::Context& context = Ice::noExplicitContext) const;

        /// Gets the metrics objects for the given metrics view.
        /// @param view The name of the metrics view.
        /// @param response The response callback. It accepts:
        /// - `returnValue` The metrics view data, a dictionary of metric maps for each metrics class configured with the view.
        /// The @p timestamp allows the client to compute averages which are not dependent of the invocation latency for
        /// this operation.
        /// - `timestamp` The local time of the process when the metrics objects were retrieved.
        /// @param exception The exception callback.
        /// @param sent The sent callback.
        /// @param context The request context.
        /// @return A function that can be called to cancel the invocation locally.
        // NOLINTNEXTLINE(modernize-use-nodiscard)
        std::function<void()> getMetricsViewAsync(std::string_view view, std::function<void(::IceMX::MetricsView, std::int64_t)> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;

        /// @private
        void _iceI_getMetricsView(const std::shared_ptr<IceInternal::OutgoingAsyncT<std::tuple<MetricsView, std::int64_t>>>&, std::string_view, const Ice::Context&) const;

        /// Gets the metrics failures associated with the given @p view and @p map.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param context The request context.
        /// @return The metrics failures associated with the map.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        MetricsFailuresSeq getMapMetricsFailures(std::string_view view, std::string_view map, const Ice::Context& context = Ice::noExplicitContext) const; // NOLINT(modernize-use-nodiscard)

        /// Gets the metrics failures associated with the given @p view and @p map.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param context The request context.
        /// @return A future that becomes available when the invocation completes. This future holds:
        /// - The metrics failures associated with the map.
        [[nodiscard]] std::future<MetricsFailuresSeq> getMapMetricsFailuresAsync(std::string_view view, std::string_view map, const Ice::Context& context = Ice::noExplicitContext) const;

        /// Gets the metrics failures associated with the given @p view and @p map.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param response The response callback. It accepts:
        /// - The metrics failures associated with the map.
        /// @param exception The exception callback.
        /// @param sent The sent callback.
        /// @param context The request context.
        /// @return A function that can be called to cancel the invocation locally.
        // NOLINTNEXTLINE(modernize-use-nodiscard)
        std::function<void()> getMapMetricsFailuresAsync(std::string_view view, std::string_view map, std::function<void(::IceMX::MetricsFailuresSeq)> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;

        /// @private
        void _iceI_getMapMetricsFailures(const std::shared_ptr<IceInternal::OutgoingAsyncT<MetricsFailuresSeq>>&, std::string_view, std::string_view, const Ice::Context&) const;

        /// Gets the metrics failure associated for the given metrics.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param id The ID of the metrics.
        /// @param context The request context.
        /// @return The metrics failures associated with the metrics.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        MetricsFailures getMetricsFailures(std::string_view view, std::string_view map, std::string_view id, const Ice::Context& context = Ice::noExplicitContext) const; // NOLINT(modernize-use-nodiscard)

        /// Gets the metrics failure associated for the given metrics.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param id The ID of the metrics.
        /// @param context The request context.
        /// @return A future that becomes available when the invocation completes. This future holds:
        /// - The metrics failures associated with the metrics.
        [[nodiscard]] std::future<MetricsFailures> getMetricsFailuresAsync(std::string_view view, std::string_view map, std::string_view id, const Ice::Context& context = Ice::noExplicitContext) const;

        /// Gets the metrics failure associated for the given metrics.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param id The ID of the metrics.
        /// @param response The response callback. It accepts:
        /// - The metrics failures associated with the metrics.
        /// @param exception The exception callback.
        /// @param sent The sent callback.
        /// @param context The request context.
        /// @return A function that can be called to cancel the invocation locally.
        // NOLINTNEXTLINE(modernize-use-nodiscard)
        std::function<void()> getMetricsFailuresAsync(std::string_view view, std::string_view map, std::string_view id, std::function<void(::IceMX::MetricsFailures)> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;

        /// @private
        void _iceI_getMetricsFailures(const std::shared_ptr<IceInternal::OutgoingAsyncT<MetricsFailures>>&, std::string_view, std::string_view, std::string_view, const Ice::Context&) const;

        /// Gets the type ID of the associated Slice interface.
        /// @return The string `"::IceMX::MetricsAdmin"`.
        static const char* ice_staticId() noexcept;

        /// @private
        static MetricsAdminPrx _fromReference(IceInternal::ReferencePtr ref) { return MetricsAdminPrx{std::move(ref)}; }

    protected:
        /// @private
        MetricsAdminPrx() = default;

        /// @private
        explicit MetricsAdminPrx(IceInternal::ReferencePtr&& ref) : Ice::ObjectPrx{std::move(ref)}
        {
        }
    };
}

namespace IceMX
{
    /// The base class for metrics. A metrics object represents a collection of measurements associated to a given a
    /// system.
    /// @remarks The Slice compiler generated this class from Slice class `::IceMX::Metrics`.
    /// @headerfile Ice/Ice.h
    class ICE_API Metrics : public Ice::Value
    {
    public:
        /// Default constructor.
        Metrics() noexcept = default;

        /// One-shot constructor to initialize all data members.
        /// @param id The metrics identifier.
        /// @param total The total number of objects observed by this metrics.
        /// @param current The number of objects currently observed by this metrics.
        /// @param totalLifetime The sum of the lifetime of each observed objects.
        /// @param failures The number of failures observed.
        Metrics(std::string id, std::int64_t total, std::int32_t current, std::int64_t totalLifetime, std::int32_t failures) noexcept :
            id(std::move(id)),
            total(total),
            current(current),
            totalLifetime(totalLifetime),
            failures(failures)
        {
        }

        /// Gets the type ID of the associated Slice class.
        /// @return The string `"::IceMX::Metrics"`.
        static const char* ice_staticId() noexcept;

        [[nodiscard]] const char* ice_id() const noexcept override;

        /// Creates a tuple with all the fields of this class.
        /// @return A tuple with all the fields of this class.
        [[nodiscard]] std::tuple<const std::string&, const std::int64_t&, const std::int32_t&, const std::int64_t&, const std::int32_t&> ice_tuple() const
        {
            return std::tie(id, total, current, totalLifetime, failures);
        }

        /// Creates a shallow polymorphic copy of this instance.
        /// @return The cloned value.
        [[nodiscard]] MetricsPtr ice_clone() const { return std::static_pointer_cast<Metrics>(_iceCloneImpl()); }

        void ice_printFields(std::ostream& os) const override;

        /// The metrics identifier.
        std::string id;

        /// The total number of objects observed by this metrics. This includes the number of currently observed objects
        /// and the number of objects observed in the past.
        std::int64_t total{INT64_C(0)};

        /// The number of objects currently observed by this metrics.
        std::int32_t current{0};

        /// The sum of the lifetime of each observed objects. This does not include the lifetime of objects which are
        /// currently observed, only the objects observed in the past.
        std::int64_t totalLifetime{INT64_C(0)};

        /// The number of failures observed.
        std::int32_t failures{0};

    protected:
        /// Copy constructor.
        Metrics(const Metrics&) = default;

        /// @private
        [[nodiscard]] Ice::ValuePtr _iceCloneImpl() const override;

        /// @private
        void _iceWriteImpl(Ice::OutputStream*) const override;

        /// @private
        void _iceReadImpl(Ice::InputStream*) override;
    };

    /// Keeps track of metrics failures.
    /// @remarks The Slice compiler generated this struct from Slice struct `::IceMX::MetricsFailures`.
    /// @headerfile Ice/Ice.h
    struct MetricsFailures
    {
        /// The identifier of the metrics object associated to the failures.
        std::string id;

        /// The failures observed for this metrics.
        ::IceMX::StringIntDict failures;

        /// Creates a tuple with all the fields of this struct.
        /// @return A tuple with all the fields of this struct.
        [[nodiscard]] std::tuple<const std::string&, const ::IceMX::StringIntDict&> ice_tuple() const
        {
            return std::tie(id, failures);
        }

        /// Outputs the name and value of each field of this instance to the stream.
        /// @param os The output stream.
        ICE_API void ice_printFields(std::ostream& os) const;
    };

    /// Outputs the description of a MetricsFailures to a stream, including all its fields.
    /// @param os The output stream.
    /// @param value The instance to output.
    /// @return The output stream.
    ICE_API std::ostream& operator<<(std::ostream& os, const MetricsFailures& value);

    /// The exception that is thrown when a metrics view cannot be found.
    /// @remarks The Slice compiler generated this exception class from Slice exception `::IceMX::UnknownMetricsView`.
    /// @headerfile Ice/Ice.h
    class ICE_API UnknownMetricsView : public Ice::UserException
    {
    public:
        /// Gets the type ID of the associated Slice exception.
        /// @return The string `"::IceMX::UnknownMetricsView"`.
        static const char* ice_staticId() noexcept;

        [[nodiscard]] const char* ice_id() const noexcept override;

        void ice_throw() const override;

    protected:
        /// @private
        void _writeImpl(Ice::OutputStream*) const override;

        /// @private
        void _readImpl(Ice::InputStream*) override;
    };

    /// Provides information on the number of threads currently in use and their activity.
    /// @remarks The Slice compiler generated this class from Slice class `::IceMX::ThreadMetrics`.
    /// @headerfile Ice/Ice.h
    class ICE_API ThreadMetrics : public Metrics
    {
    public:
        /// Default constructor.
        ThreadMetrics() noexcept = default;

        /// One-shot constructor to initialize all data members.
        /// @param id The metrics identifier.
        /// @param total The total number of objects observed by this metrics.
        /// @param current The number of objects currently observed by this metrics.
        /// @param totalLifetime The sum of the lifetime of each observed objects.
        /// @param failures The number of failures observed.
        /// @param inUseForIO The number of threads which are currently performing socket reads or writes.
        /// @param inUseForUser The number of threads which are currently calling user code (servant dispatch, AMI callbacks, etc).
        /// @param inUseForOther The number of threads which are currently performing other activities such as DNS lookups, garbage collection, etc.
        ThreadMetrics(std::string id, std::int64_t total, std::int32_t current, std::int64_t totalLifetime, std::int32_t failures, std::int32_t inUseForIO, std::int32_t inUseForUser, std::int32_t inUseForOther) noexcept :
            Metrics(std::move(id), total, current, totalLifetime, failures),
            inUseForIO(inUseForIO),
            inUseForUser(inUseForUser),
            inUseForOther(inUseForOther)
        {
        }

        /// Gets the type ID of the associated Slice class.
        /// @return The string `"::IceMX::ThreadMetrics"`.
        static const char* ice_staticId() noexcept;

        [[nodiscard]] const char* ice_id() const noexcept override;

        /// Creates a tuple with all the fields of this class.
        /// @return A tuple with all the fields of this class.
        [[nodiscard]] std::tuple<const std::string&, const std::int64_t&, const std::int32_t&, const std::int64_t&, const std::int32_t&, const std::int32_t&, const std::int32_t&, const std::int32_t&> ice_tuple() const
        {
            return std::tie(id, total, current, totalLifetime, failures, inUseForIO, inUseForUser, inUseForOther);
        }

        /// Creates a shallow polymorphic copy of this instance.
        /// @return The cloned value.
        [[nodiscard]] ThreadMetricsPtr ice_clone() const { return std::static_pointer_cast<ThreadMetrics>(_iceCloneImpl()); }

        void ice_printFields(std::ostream& os) const override;

        /// The number of threads which are currently performing socket reads or writes.
        std::int32_t inUseForIO{0};

        /// The number of threads which are currently calling user code (servant dispatch, AMI callbacks, etc).
        std::int32_t inUseForUser{0};

        /// The number of threads which are currently performing other activities such as DNS lookups, garbage
        /// collection, etc. These are all the other threads created by the Ice runtime that are not counted in
        /// ::IceMX::ThreadMetrics#inUseForUser or ::IceMX::ThreadMetrics#inUseForIO.
        std::int32_t inUseForOther{0};

    protected:
        /// Copy constructor.
        ThreadMetrics(const ThreadMetrics&) = default;

        /// @private
        [[nodiscard]] Ice::ValuePtr _iceCloneImpl() const override;

        /// @private
        void _iceWriteImpl(Ice::OutputStream*) const override;

        /// @private
        void _iceReadImpl(Ice::InputStream*) override;
    };

    /// Provides information on servant dispatches.
    /// @remarks The Slice compiler generated this class from Slice class `::IceMX::DispatchMetrics`.
    /// @headerfile Ice/Ice.h
    class ICE_API DispatchMetrics : public Metrics
    {
    public:
        /// Default constructor.
        DispatchMetrics() noexcept = default;

        /// One-shot constructor to initialize all data members.
        /// @param id The metrics identifier.
        /// @param total The total number of objects observed by this metrics.
        /// @param current The number of objects currently observed by this metrics.
        /// @param totalLifetime The sum of the lifetime of each observed objects.
        /// @param failures The number of failures observed.
        /// @param userException The number of dispatches that failed with a user exception.
        /// @param size The size of the incoming requests.
        /// @param replySize The size of the replies.
        DispatchMetrics(std::string id, std::int64_t total, std::int32_t current, std::int64_t totalLifetime, std::int32_t failures, std::int32_t userException, std::int64_t size, std::int64_t replySize) noexcept :
            Metrics(std::move(id), total, current, totalLifetime, failures),
            userException(userException),
            size(size),
            replySize(replySize)
        {
        }

        /// Gets the type ID of the associated Slice class.
        /// @return The string `"::IceMX::DispatchMetrics"`.
        static const char* ice_staticId() noexcept;

        [[nodiscard]] const char* ice_id() const noexcept override;

        /// Creates a tuple with all the fields of this class.
        /// @return A tuple with all the fields of this class.
        [[nodiscard]] std::tuple<const std::string&, const std::int64_t&, const std::int32_t&, const std::int64_t&, const std::int32_t&, const std::int32_t&, const std::int64_t&, const std::int64_t&> ice_tuple() const
        {
            return std::tie(id, total, current, totalLifetime, failures, userException, size, replySize);
        }

        /// Creates a shallow polymorphic copy of this instance.
        /// @return The cloned value.
        [[nodiscard]] DispatchMetricsPtr ice_clone() const { return std::static_pointer_cast<DispatchMetrics>(_iceCloneImpl()); }

        void ice_printFields(std::ostream& os) const override;

        /// The number of dispatches that failed with a user exception.
        std::int32_t userException{0};

        /// The size of the incoming requests. This corresponds to the size of the marshaled input parameters.
        std::int64_t size{INT64_C(0)};

        /// The size of the replies. This corresponds to the size of the marshaled output and return parameters.
        std::int64_t replySize{INT64_C(0)};

    protected:
        /// Copy constructor.
        DispatchMetrics(const DispatchMetrics&) = default;

        /// @private
        [[nodiscard]] Ice::ValuePtr _iceCloneImpl() const override;

        /// @private
        void _iceWriteImpl(Ice::OutputStream*) const override;

        /// @private
        void _iceReadImpl(Ice::InputStream*) override;
    };

    /// Provides information on child invocations. A child invocation is either remote (sent over an Ice connection) or
    /// collocated. An invocation can have multiple child invocations if it is retried. Child invocation metrics are
    /// embedded within InvocationMetrics.
    /// @remarks The Slice compiler generated this class from Slice class `::IceMX::ChildInvocationMetrics`.
    /// @headerfile Ice/Ice.h
    class ICE_API ChildInvocationMetrics : public Metrics
    {
    public:
        /// Default constructor.
        ChildInvocationMetrics() noexcept = default;

        /// One-shot constructor to initialize all data members.
        /// @param id The metrics identifier.
        /// @param total The total number of objects observed by this metrics.
        /// @param current The number of objects currently observed by this metrics.
        /// @param totalLifetime The sum of the lifetime of each observed objects.
        /// @param failures The number of failures observed.
        /// @param size The size of the invocation.
        /// @param replySize The size of the invocation reply.
        ChildInvocationMetrics(std::string id, std::int64_t total, std::int32_t current, std::int64_t totalLifetime, std::int32_t failures, std::int64_t size, std::int64_t replySize) noexcept :
            Metrics(std::move(id), total, current, totalLifetime, failures),
            size(size),
            replySize(replySize)
        {
        }

        /// Gets the type ID of the associated Slice class.
        /// @return The string `"::IceMX::ChildInvocationMetrics"`.
        static const char* ice_staticId() noexcept;

        [[nodiscard]] const char* ice_id() const noexcept override;

        /// Creates a tuple with all the fields of this class.
        /// @return A tuple with all the fields of this class.
        [[nodiscard]] std::tuple<const std::string&, const std::int64_t&, const std::int32_t&, const std::int64_t&, const std::int32_t&, const std::int64_t&, const std::int64_t&> ice_tuple() const
        {
            return std::tie(id, total, current, totalLifetime, failures, size, replySize);
        }

        /// Creates a shallow polymorphic copy of this instance.
        /// @return The cloned value.
        [[nodiscard]] ChildInvocationMetricsPtr ice_clone() const { return std::static_pointer_cast<ChildInvocationMetrics>(_iceCloneImpl()); }

        void ice_printFields(std::ostream& os) const override;

        /// The size of the invocation. This corresponds to the size of the marshaled input parameters.
        std::int64_t size{INT64_C(0)};

        /// The size of the invocation reply. This corresponds to the size of the marshaled output and return
        /// parameters.
        std::int64_t replySize{INT64_C(0)};

    protected:
        /// Copy constructor.
        ChildInvocationMetrics(const ChildInvocationMetrics&) = default;

        /// @private
        [[nodiscard]] Ice::ValuePtr _iceCloneImpl() const override;

        /// @private
        void _iceWriteImpl(Ice::OutputStream*) const override;

        /// @private
        void _iceReadImpl(Ice::InputStream*) override;
    };

    /// Provides information on invocations that are collocated. Collocated metrics are embedded within
    /// InvocationMetrics.
    /// @remarks The Slice compiler generated this class from Slice class `::IceMX::CollocatedMetrics`.
    /// @headerfile Ice/Ice.h
    class ICE_API CollocatedMetrics : public ChildInvocationMetrics
    {
    public:using ChildInvocationMetrics::ChildInvocationMetrics;

        /// Gets the type ID of the associated Slice class.
        /// @return The string `"::IceMX::CollocatedMetrics"`.
        static const char* ice_staticId() noexcept;

        [[nodiscard]] const char* ice_id() const noexcept override;

        /// Creates a shallow polymorphic copy of this instance.
        /// @return The cloned value.
        [[nodiscard]] CollocatedMetricsPtr ice_clone() const { return std::static_pointer_cast<CollocatedMetrics>(_iceCloneImpl()); }

    protected:
        /// Copy constructor.
        CollocatedMetrics(const CollocatedMetrics&) = default;

        /// @private
        [[nodiscard]] Ice::ValuePtr _iceCloneImpl() const override;

        /// @private
        void _iceWriteImpl(Ice::OutputStream*) const override;

        /// @private
        void _iceReadImpl(Ice::InputStream*) override;
    };

    /// Provides information on invocations that are specifically sent over Ice connections. Remote metrics are embedded
    /// within InvocationMetrics.
    /// @remarks The Slice compiler generated this class from Slice class `::IceMX::RemoteMetrics`.
    /// @headerfile Ice/Ice.h
    class ICE_API RemoteMetrics : public ChildInvocationMetrics
    {
    public:using ChildInvocationMetrics::ChildInvocationMetrics;

        /// Gets the type ID of the associated Slice class.
        /// @return The string `"::IceMX::RemoteMetrics"`.
        static const char* ice_staticId() noexcept;

        [[nodiscard]] const char* ice_id() const noexcept override;

        /// Creates a shallow polymorphic copy of this instance.
        /// @return The cloned value.
        [[nodiscard]] RemoteMetricsPtr ice_clone() const { return std::static_pointer_cast<RemoteMetrics>(_iceCloneImpl()); }

    protected:
        /// Copy constructor.
        RemoteMetrics(const RemoteMetrics&) = default;

        /// @private
        [[nodiscard]] Ice::ValuePtr _iceCloneImpl() const override;

        /// @private
        void _iceWriteImpl(Ice::OutputStream*) const override;

        /// @private
        void _iceReadImpl(Ice::InputStream*) override;
    };

    /// Provide measurements for proxy invocations. Proxy invocations can either be sent over the wire or be collocated.
    /// @remarks The Slice compiler generated this class from Slice class `::IceMX::InvocationMetrics`.
    /// @headerfile Ice/Ice.h
    class ICE_API InvocationMetrics : public Metrics
    {
    public:
        /// Default constructor.
        InvocationMetrics() noexcept = default;

        /// One-shot constructor to initialize all data members.
        /// @param id The metrics identifier.
        /// @param total The total number of objects observed by this metrics.
        /// @param current The number of objects currently observed by this metrics.
        /// @param totalLifetime The sum of the lifetime of each observed objects.
        /// @param failures The number of failures observed.
        /// @param retry The number of retries for the invocations.
        /// @param userException The number of invocations that failed with a user exception.
        /// @param remotes The remote invocation metrics map.
        /// @param collocated The collocated invocation metrics map.
        InvocationMetrics(std::string id, std::int64_t total, std::int32_t current, std::int64_t totalLifetime, std::int32_t failures, std::int32_t retry, std::int32_t userException, ::IceMX::MetricsMap remotes, ::IceMX::MetricsMap collocated) noexcept :
            Metrics(std::move(id), total, current, totalLifetime, failures),
            retry(retry),
            userException(userException),
            remotes(std::move(remotes)),
            collocated(std::move(collocated))
        {
        }

        /// Gets the type ID of the associated Slice class.
        /// @return The string `"::IceMX::InvocationMetrics"`.
        static const char* ice_staticId() noexcept;

        [[nodiscard]] const char* ice_id() const noexcept override;

        /// Creates a tuple with all the fields of this class.
        /// @return A tuple with all the fields of this class.
        [[nodiscard]] std::tuple<const std::string&, const std::int64_t&, const std::int32_t&, const std::int64_t&, const std::int32_t&, const std::int32_t&, const std::int32_t&, const ::IceMX::MetricsMap&, const ::IceMX::MetricsMap&> ice_tuple() const
        {
            return std::tie(id, total, current, totalLifetime, failures, retry, userException, remotes, collocated);
        }

        /// Creates a shallow polymorphic copy of this instance.
        /// @return The cloned value.
        [[nodiscard]] InvocationMetricsPtr ice_clone() const { return std::static_pointer_cast<InvocationMetrics>(_iceCloneImpl()); }

        void ice_printFields(std::ostream& os) const override;

        /// The number of retries for the invocations.
        std::int32_t retry{0};

        /// The number of invocations that failed with a user exception.
        std::int32_t userException{0};

        /// The remote invocation metrics map.
        /// @see ::IceMX::RemoteMetrics
        ::IceMX::MetricsMap remotes;

        /// The collocated invocation metrics map.
        /// @see ::IceMX::CollocatedMetrics
        ::IceMX::MetricsMap collocated;

    protected:
        /// Copy constructor.
        InvocationMetrics(const InvocationMetrics&) = default;

        /// @private
        [[nodiscard]] Ice::ValuePtr _iceCloneImpl() const override;

        /// @private
        void _iceWriteImpl(Ice::OutputStream*) const override;

        /// @private
        void _iceReadImpl(Ice::InputStream*) override;
    };

    /// Provides information on the data sent and received over Ice connections.
    /// @remarks The Slice compiler generated this class from Slice class `::IceMX::ConnectionMetrics`.
    /// @headerfile Ice/Ice.h
    class ICE_API ConnectionMetrics : public Metrics
    {
    public:
        /// Default constructor.
        ConnectionMetrics() noexcept = default;

        /// One-shot constructor to initialize all data members.
        /// @param id The metrics identifier.
        /// @param total The total number of objects observed by this metrics.
        /// @param current The number of objects currently observed by this metrics.
        /// @param totalLifetime The sum of the lifetime of each observed objects.
        /// @param failures The number of failures observed.
        /// @param receivedBytes The number of bytes received by the connection.
        /// @param sentBytes The number of bytes sent by the connection.
        ConnectionMetrics(std::string id, std::int64_t total, std::int32_t current, std::int64_t totalLifetime, std::int32_t failures, std::int64_t receivedBytes, std::int64_t sentBytes) noexcept :
            Metrics(std::move(id), total, current, totalLifetime, failures),
            receivedBytes(receivedBytes),
            sentBytes(sentBytes)
        {
        }

        /// Gets the type ID of the associated Slice class.
        /// @return The string `"::IceMX::ConnectionMetrics"`.
        static const char* ice_staticId() noexcept;

        [[nodiscard]] const char* ice_id() const noexcept override;

        /// Creates a tuple with all the fields of this class.
        /// @return A tuple with all the fields of this class.
        [[nodiscard]] std::tuple<const std::string&, const std::int64_t&, const std::int32_t&, const std::int64_t&, const std::int32_t&, const std::int64_t&, const std::int64_t&> ice_tuple() const
        {
            return std::tie(id, total, current, totalLifetime, failures, receivedBytes, sentBytes);
        }

        /// Creates a shallow polymorphic copy of this instance.
        /// @return The cloned value.
        [[nodiscard]] ConnectionMetricsPtr ice_clone() const { return std::static_pointer_cast<ConnectionMetrics>(_iceCloneImpl()); }

        void ice_printFields(std::ostream& os) const override;

        /// The number of bytes received by the connection.
        std::int64_t receivedBytes{INT64_C(0)};

        /// The number of bytes sent by the connection.
        std::int64_t sentBytes{INT64_C(0)};

    protected:
        /// Copy constructor.
        ConnectionMetrics(const ConnectionMetrics&) = default;

        /// @private
        [[nodiscard]] Ice::ValuePtr _iceCloneImpl() const override;

        /// @private
        void _iceWriteImpl(Ice::OutputStream*) const override;

        /// @private
        void _iceReadImpl(Ice::InputStream*) override;
    };

    /// @cond INTERNAL
    using Ice::Tuple::operator<;
    using Ice::Tuple::operator<=;
    using Ice::Tuple::operator>;
    using Ice::Tuple::operator>=;
    using Ice::Tuple::operator==;
    using Ice::Tuple::operator!=;
    /// @endcond
}

namespace IceMX
{
    /// The metrics administrative facet interface. This interface allows remote administrative clients to access the
    /// metrics of an application that enabled the Ice administrative facility and configured one or more metrics views.
    /// @remarks The Slice compiler generated this skeleton class from Slice interface `::IceMX::MetricsAdmin`.
    /// @headerfile Ice/Ice.h
    class ICE_API MetricsAdmin : public virtual Ice::Object
    {
    public:
        /// The associated proxy type.
        using ProxyType = MetricsAdminPrx;

        /// Dispatches an incoming request to one of the member functions of this generated class, based on the operation name carried by the request.
        /// @param request The incoming request.
        /// @param sendResponse The callback to send the response.
        void dispatch(Ice::IncomingRequest& request, std::function<void(Ice::OutgoingResponse)> sendResponse) override;

        [[nodiscard]] std::vector<std::string> ice_ids(const Ice::Current& current) const override;

        [[nodiscard]] std::string ice_id(const Ice::Current& current) const override;

        /// Gets the names of enabled and disabled metrics.
        /// @param[out] disabledViews The names of the disabled views.
        /// @param current The Current object of the incoming request.
        /// @return The names of the enabled views.
        virtual ::Ice::StringSeq getMetricsViewNames(::Ice::StringSeq& disabledViews, const Ice::Current& current) = 0;

        /// @private
        void _iceD_getMetricsViewNames(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Enables a metrics view.
        /// @param name The metrics view name.
        /// @param current The Current object of the incoming request.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual void enableMetricsView(std::string name, const Ice::Current& current) = 0;

        /// @private
        void _iceD_enableMetricsView(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Disables a metrics view.
        /// @param name The metrics view name.
        /// @param current The Current object of the incoming request.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual void disableMetricsView(std::string name, const Ice::Current& current) = 0;

        /// @private
        void _iceD_disableMetricsView(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Gets the metrics objects for the given metrics view.
        /// @param view The name of the metrics view.
        /// @param[out] timestamp The local time of the process when the metrics objects were retrieved.
        /// @param current The Current object of the incoming request.
        /// @return The metrics view data, a dictionary of metric maps for each metrics class configured with the view.
        /// The @p timestamp allows the client to compute averages which are not dependent of the invocation latency for
        /// this operation.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual MetricsView getMetricsView(std::string view, std::int64_t& timestamp, const Ice::Current& current) = 0;

        /// @private
        void _iceD_getMetricsView(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Gets the metrics failures associated with the given @p view and @p map.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param current The Current object of the incoming request.
        /// @return The metrics failures associated with the map.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual MetricsFailuresSeq getMapMetricsFailures(std::string view, std::string map, const Ice::Current& current) = 0;

        /// @private
        void _iceD_getMapMetricsFailures(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Gets the metrics failure associated for the given metrics.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param id The ID of the metrics.
        /// @param current The Current object of the incoming request.
        /// @return The metrics failures associated with the metrics.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual MetricsFailures getMetricsFailures(std::string view, std::string map, std::string id, const Ice::Current& current) = 0;

        /// @private
        void _iceD_getMetricsFailures(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Gets the type ID of the associated Slice interface.
        /// @return The string `"::IceMX::MetricsAdmin"`.
        static const char* ice_staticId() noexcept;
    };

    /// A shared pointer to a MetricsAdmin.
    using MetricsAdminPtr = std::shared_ptr<MetricsAdmin>;
}

namespace IceMX
{
    /// The metrics administrative facet interface. This interface allows remote administrative clients to access the
    /// metrics of an application that enabled the Ice administrative facility and configured one or more metrics views.
    /// @remarks The Slice compiler generated this skeleton class from Slice interface `::IceMX::MetricsAdmin`.
    /// @headerfile Ice/Ice.h
    class ICE_API AsyncMetricsAdmin : public virtual Ice::Object
    {
    public:
        /// The associated proxy type.
        using ProxyType = MetricsAdminPrx;

        /// Dispatches an incoming request to one of the member functions of this generated class, based on the operation name carried by the request.
        /// @param request The incoming request.
        /// @param sendResponse The callback to send the response.
        void dispatch(Ice::IncomingRequest& request, std::function<void(Ice::OutgoingResponse)> sendResponse) override;

        [[nodiscard]] std::vector<std::string> ice_ids(const Ice::Current& current) const override;

        [[nodiscard]] std::string ice_id(const Ice::Current& current) const override;

        /// Gets the names of enabled and disabled metrics.
        /// @param response The response callback. It accepts:
        /// - `returnValue` The names of the enabled views.
        /// - `disabledViews` The names of the disabled views.
        /// @param exception The exception callback.
        /// @param current The Current object of the incoming request.
        virtual void getMetricsViewNamesAsync(std::function<void(const ::Ice::StringSeq& returnValue, const ::Ice::StringSeq& disabledViews)> response, std::function<void(std::exception_ptr)> exception, const Ice::Current& current) = 0;

        /// @private
        void _iceD_getMetricsViewNames(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Enables a metrics view.
        /// @param name The metrics view name.
        /// @param response The response callback.
        /// @param exception The exception callback.
        /// @param current The Current object of the incoming request.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual void enableMetricsViewAsync(std::string name, std::function<void()> response, std::function<void(std::exception_ptr)> exception, const Ice::Current& current) = 0;

        /// @private
        void _iceD_enableMetricsView(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Disables a metrics view.
        /// @param name The metrics view name.
        /// @param response The response callback.
        /// @param exception The exception callback.
        /// @param current The Current object of the incoming request.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual void disableMetricsViewAsync(std::string name, std::function<void()> response, std::function<void(std::exception_ptr)> exception, const Ice::Current& current) = 0;

        /// @private
        void _iceD_disableMetricsView(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Gets the metrics objects for the given metrics view.
        /// @param view The name of the metrics view.
        /// @param response The response callback. It accepts:
        /// - `returnValue` The metrics view data, a dictionary of metric maps for each metrics class configured with the view.
        /// The @p timestamp allows the client to compute averages which are not dependent of the invocation latency for
        /// this operation.
        /// - `timestamp` The local time of the process when the metrics objects were retrieved.
        /// @param exception The exception callback.
        /// @param current The Current object of the incoming request.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual void getMetricsViewAsync(std::string view, std::function<void(const MetricsView& returnValue, std::int64_t timestamp)> response, std::function<void(std::exception_ptr)> exception, const Ice::Current& current) = 0;

        /// @private
        void _iceD_getMetricsView(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Gets the metrics failures associated with the given @p view and @p map.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param response The response callback. It accepts:
        /// - The metrics failures associated with the map.
        /// @param exception The exception callback.
        /// @param current The Current object of the incoming request.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual void getMapMetricsFailuresAsync(std::string view, std::string map, std::function<void(const MetricsFailuresSeq& returnValue)> response, std::function<void(std::exception_ptr)> exception, const Ice::Current& current) = 0;

        /// @private
        void _iceD_getMapMetricsFailures(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Gets the metrics failure associated for the given metrics.
        /// @param view The name of the metrics view.
        /// @param map The name of the metrics map.
        /// @param id The ID of the metrics.
        /// @param response The response callback. It accepts:
        /// - The metrics failures associated with the metrics.
        /// @param exception The exception callback.
        /// @param current The Current object of the incoming request.
        /// @throws IceMX::UnknownMetricsView Thrown when the metrics view cannot be found.
        virtual void getMetricsFailuresAsync(std::string view, std::string map, std::string id, std::function<void(const MetricsFailures& returnValue)> response, std::function<void(std::exception_ptr)> exception, const Ice::Current& current) = 0;

        /// @private
        void _iceD_getMetricsFailures(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);

        /// Gets the type ID of the associated Slice interface.
        /// @return The string `"::IceMX::MetricsAdmin"`.
        static const char* ice_staticId() noexcept;
    };

    /// A shared pointer to an AsyncMetricsAdmin.
    using AsyncMetricsAdminPtr = std::shared_ptr<AsyncMetricsAdmin>;
}

namespace Ice
{
    /// @cond INTERNAL
    template<>
    struct StreamableTraits<::IceMX::MetricsFailures>
    {
        static constexpr StreamHelperCategory helper = StreamHelperCategoryStruct;
        static constexpr int minWireSize = 2;
        static constexpr bool fixedLength = false;
    };

    template<>
    struct StreamReader<::IceMX::MetricsFailures>
    {
        /// Unmarshals a ::IceMX::MetricsFailures from the input stream.
        static void read(InputStream* istr, ::IceMX::MetricsFailures& v)
        {
            istr->readAll(v.id, v.failures);
        }
    };
    /// @endcond
}

// NOLINTEND(modernize-concat-nested-namespaces)

#include <Ice/PopDisableWarnings.h>
#endif
