omni/log/ILog.gen.h

File members: omni/log/ILog.gen.h

// Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
//
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto. Any use, reproduction, disclosure or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA CORPORATION is strictly prohibited.
//
// --------- Warning: This is a build system generated file. ----------
//

#include <omni/core/OmniAttr.h>
#include <omni/core/Interface.h>
#include <omni/core/ResultError.h>

#include <functional>
#include <utility>
#include <type_traits>

#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL

template <>
class omni::core::Generated<omni::log::ILogMessageConsumer_abi> : public omni::log::ILogMessageConsumer_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::log::ILogMessageConsumer")

    void onMessage(const char* channel,
                   omni::log::Level level,
                   const char* moduleName,
                   const char* fileName,
                   const char* functionName,
                   uint32_t lineNumber,
                   const char* msg,
                   carb::thread::ProcessId pid,
                   carb::thread::ThreadId tid,
                   uint64_t timestamp) noexcept;
};

template <>
class omni::core::Generated<omni::log::ILogChannelUpdateConsumer_abi> : public omni::log::ILogChannelUpdateConsumer_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::log::ILogChannelUpdateConsumer")

    void onChannelUpdate(omni::core::ObjectParam<omni::log::ILog> log,
                         omni::core::ObjectParam<omni::str::IReadOnlyCString> name,
                         omni::log::ChannelUpdateReason reason) noexcept;
};

template <>
class omni::core::Generated<omni::log::ILog_abi> : public omni::log::ILog_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::log::ILog")

    void log(const char* channel,
             omni::log::Level level,
             const char* moduleName,
             const char* fileName,
             const char* functionName,
             uint32_t lineNumber,
             const char* str,
             uint32_t strCharCount) noexcept;

    void logf(const char* channel,
              omni::log::Level level,
              const char* moduleName,
              const char* fileName,
              const char* functionName,
              uint32_t lineNumber,
              const char* format,
              ...) noexcept;

    void addMessageConsumer(omni::core::ObjectParam<omni::log::ILogMessageConsumer> consumer) noexcept;

    void removeMessageConsumer(omni::core::ObjectParam<omni::log::ILogMessageConsumer> consumer) noexcept;

    void setLevel(omni::log::Level level) noexcept;

    omni::log::Level getLevel() noexcept;

    void setEnabled(bool isEnabled) noexcept;

    bool isEnabled() noexcept;

    bool setAsync(bool logAsync) noexcept;

    bool isAsync() noexcept;

    void addChannel(const char* name, omni::log::Level* level, const char* description) noexcept;

    void removeChannel(const char* name, omni::log::Level* level) noexcept;

    void setChannelLevel(const char* name, omni::log::Level level, omni::log::SettingBehavior behavior) noexcept;

    omni::core::Result getChannelLevel(const char* name,
                                       omni::log::Level* outLevel,
                                       omni::log::SettingBehavior* outBehavior) noexcept;

    void setChannelEnabled(const char* name, bool isEnabled, omni::log::SettingBehavior behavior) noexcept;

    omni::core::Result getChannelEnabled(const char* name,
                                         bool* outIsEnabled,
                                         omni::log::SettingBehavior* outBehavior) noexcept;

    void setChannelDescription(const char* name, const char* description) noexcept;

    omni::core::Result getChannelDescription(const char* name, omni::str::IReadOnlyCString** outDescription) noexcept;

    bool isLoggingAtLevel(const char* name, omni::log::Level level) noexcept;

    void flush() noexcept;

    void addChannelUpdateConsumer(omni::core::ObjectParam<omni::log::ILogChannelUpdateConsumer> consumer) noexcept;

    void removeChannelUpdateConsumer(omni::core::ObjectParam<omni::log::ILogChannelUpdateConsumer> consumer) noexcept;

    omni::core::ObjectPtr<omni::log::ILogMessageConsumer> addMessageConsumer(
        std::function<void(const char* channel,
                           omni::log::Level level,
                           const char* moduleName,
                           const char* fileName,
                           const char* functionName,
                           uint32_t lineNumber,
                           const char* msg,
                           carb::thread::ProcessId pid,
                           carb::thread::ThreadId tid,
                           uint64_t timestamp)> fun) noexcept;

    omni::core::ObjectPtr<omni::log::ILogChannelUpdateConsumer> addChannelUpdateConsumer(
        std::function<void(omni::log::ILog* log, omni::str::IReadOnlyCString* name, omni::log::ChannelUpdateReason reason)>
            fun) noexcept;
};

#endif

#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL

inline void omni::core::Generated<omni::log::ILogMessageConsumer_abi>::onMessage(const char* channel,
                                                                                 omni::log::Level level,
                                                                                 const char* moduleName,
                                                                                 const char* fileName,
                                                                                 const char* functionName,
                                                                                 uint32_t lineNumber,
                                                                                 const char* msg,
                                                                                 carb::thread::ProcessId pid,
                                                                                 carb::thread::ThreadId tid,
                                                                                 uint64_t timestamp) noexcept
{
    onMessage_abi(channel, level, moduleName, fileName, functionName, lineNumber, msg, pid, tid, timestamp);
}

inline void omni::core::Generated<omni::log::ILogChannelUpdateConsumer_abi>::onChannelUpdate(
    omni::core::ObjectParam<omni::log::ILog> log,
    omni::core::ObjectParam<omni::str::IReadOnlyCString> name,
    omni::log::ChannelUpdateReason reason) noexcept
{
    onChannelUpdate_abi(log.get(), name.get(), reason);
}

inline void omni::core::Generated<omni::log::ILog_abi>::log(const char* channel,
                                                            omni::log::Level level,
                                                            const char* moduleName,
                                                            const char* fileName,
                                                            const char* functionName,
                                                            uint32_t lineNumber,
                                                            const char* str,
                                                            uint32_t strCharCount) noexcept
{
    log_abi(channel, level, moduleName, fileName, functionName, lineNumber, str, strCharCount);
}

inline void omni::core::Generated<omni::log::ILog_abi>::logf(const char* channel,
                                                             omni::log::Level level,
                                                             const char* moduleName,
                                                             const char* fileName,
                                                             const char* functionName,
                                                             uint32_t lineNumber,
                                                             const char* format,
                                                             ...) noexcept
{
    va_list arg_list_;
    va_start(arg_list_, format);
    logf_abi(channel, level, moduleName, fileName, functionName, lineNumber, format, arg_list_);
    va_end(arg_list_);
}

inline void omni::core::Generated<omni::log::ILog_abi>::addMessageConsumer(
    omni::core::ObjectParam<omni::log::ILogMessageConsumer> consumer) noexcept
{
    addMessageConsumer_abi(consumer.get());
}

inline void omni::core::Generated<omni::log::ILog_abi>::removeMessageConsumer(
    omni::core::ObjectParam<omni::log::ILogMessageConsumer> consumer) noexcept
{
    removeMessageConsumer_abi(consumer.get());
}

inline void omni::core::Generated<omni::log::ILog_abi>::setLevel(omni::log::Level level) noexcept
{
    setLevel_abi(level);
}

inline omni::log::Level omni::core::Generated<omni::log::ILog_abi>::getLevel() noexcept
{
    return getLevel_abi();
}

inline void omni::core::Generated<omni::log::ILog_abi>::setEnabled(bool isEnabled) noexcept
{
    setEnabled_abi(isEnabled);
}

inline bool omni::core::Generated<omni::log::ILog_abi>::isEnabled() noexcept
{
    return isEnabled_abi();
}

inline bool omni::core::Generated<omni::log::ILog_abi>::setAsync(bool logAsync) noexcept
{
    return setAsync_abi(logAsync);
}

inline bool omni::core::Generated<omni::log::ILog_abi>::isAsync() noexcept
{
    return isAsync_abi();
}

inline void omni::core::Generated<omni::log::ILog_abi>::addChannel(const char* name,
                                                                   omni::log::Level* level,
                                                                   const char* description) noexcept
{
    addChannel_abi(name, level, description);
}

inline void omni::core::Generated<omni::log::ILog_abi>::removeChannel(const char* name, omni::log::Level* level) noexcept
{
    removeChannel_abi(name, level);
}

inline void omni::core::Generated<omni::log::ILog_abi>::setChannelLevel(const char* name,
                                                                        omni::log::Level level,
                                                                        omni::log::SettingBehavior behavior) noexcept
{
    setChannelLevel_abi(name, level, behavior);
}

inline omni::core::Result omni::core::Generated<omni::log::ILog_abi>::getChannelLevel(
    const char* name, omni::log::Level* outLevel, omni::log::SettingBehavior* outBehavior) noexcept
{
    return getChannelLevel_abi(name, outLevel, outBehavior);
}

inline void omni::core::Generated<omni::log::ILog_abi>::setChannelEnabled(const char* name,
                                                                          bool isEnabled,
                                                                          omni::log::SettingBehavior behavior) noexcept
{
    setChannelEnabled_abi(name, isEnabled, behavior);
}

inline omni::core::Result omni::core::Generated<omni::log::ILog_abi>::getChannelEnabled(
    const char* name, bool* outIsEnabled, omni::log::SettingBehavior* outBehavior) noexcept
{
    return getChannelEnabled_abi(name, outIsEnabled, outBehavior);
}

inline void omni::core::Generated<omni::log::ILog_abi>::setChannelDescription(const char* name,
                                                                              const char* description) noexcept
{
    setChannelDescription_abi(name, description);
}

inline omni::core::Result omni::core::Generated<omni::log::ILog_abi>::getChannelDescription(
    const char* name, omni::str::IReadOnlyCString** outDescription) noexcept
{
    return getChannelDescription_abi(name, outDescription);
}

inline bool omni::core::Generated<omni::log::ILog_abi>::isLoggingAtLevel(const char* name, omni::log::Level level) noexcept
{
    return isLoggingAtLevel_abi(name, level);
}

inline void omni::core::Generated<omni::log::ILog_abi>::flush() noexcept
{
    flush_abi();
}

inline void omni::core::Generated<omni::log::ILog_abi>::addChannelUpdateConsumer(
    omni::core::ObjectParam<omni::log::ILogChannelUpdateConsumer> consumer) noexcept
{
    addChannelUpdateConsumer_abi(consumer.get());
}

inline void omni::core::Generated<omni::log::ILog_abi>::removeChannelUpdateConsumer(
    omni::core::ObjectParam<omni::log::ILogChannelUpdateConsumer> consumer) noexcept
{
    removeChannelUpdateConsumer_abi(consumer.get());
}

inline omni::core::ObjectPtr<omni::log::ILogMessageConsumer> omni::core::Generated<omni::log::ILog_abi>::addMessageConsumer(
    std::function<void(const char* channel,
                       omni::log::Level level,
                       const char* moduleName,
                       const char* fileName,
                       const char* functionName,
                       uint32_t lineNumber,
                       const char* msg,
                       carb::thread::ProcessId pid,
                       carb::thread::ThreadId tid,
                       uint64_t timestamp)> fun) noexcept
{

    class Consumer : public omni::core::Implements<omni::log::ILogMessageConsumer>
    {
    public:
        virtual void onMessage_abi(const char* channel,
                                   omni::log::Level level,
                                   const char* moduleName,
                                   const char* fileName,
                                   const char* functionName,
                                   uint32_t lineNumber,
                                   const char* msg,
                                   carb::thread::ProcessId pid,
                                   carb::thread::ThreadId tid,
                                   uint64_t timestamp) noexcept override
        {
            m_function(channel, level, moduleName, fileName, functionName, lineNumber, msg, pid, tid, timestamp);
        }

        Consumer(std::function<void(const char* channel,
                                    omni::log::Level level,
                                    const char* moduleName,
                                    const char* fileName,
                                    const char* functionName,
                                    uint32_t lineNumber,
                                    const char* msg,
                                    carb::thread::ProcessId pid,
                                    carb::thread::ThreadId tid,
                                    uint64_t timestamp)> cb)
            : m_function(std::move(cb))
        {
        }

    private:
        std::function<void(const char* channel,
                           omni::log::Level level,
                           const char* moduleName,
                           const char* fileName,
                           const char* functionName,
                           uint32_t lineNumber,
                           const char* msg,
                           carb::thread::ProcessId pid,
                           carb::thread::ThreadId tid,
                           uint64_t timestamp)>
            m_function;
    };

    auto consumer{ omni::core::steal(new Consumer{ std::move(fun) }) };
    addMessageConsumer_abi(consumer.get());
    return consumer;
}

inline omni::core::ObjectPtr<omni::log::ILogChannelUpdateConsumer> omni::core::Generated<omni::log::ILog_abi>::addChannelUpdateConsumer(
    std::function<void(omni::log::ILog* log, omni::str::IReadOnlyCString* name, omni::log::ChannelUpdateReason reason)> fun) noexcept
{

    class Consumer : public omni::core::Implements<omni::log::ILogChannelUpdateConsumer>
    {
    public:
        virtual void onChannelUpdate_abi(omni::log::ILog* log,
                                         omni::str::IReadOnlyCString* name,
                                         omni::log::ChannelUpdateReason reason) noexcept override
        {
            m_function(log, name, reason);
        }

        Consumer(std::function<
                 void(omni::log::ILog* log, omni::str::IReadOnlyCString* name, omni::log::ChannelUpdateReason reason)> cb)
            : m_function(std::move(cb))
        {
        }

    private:
        std::function<void(omni::log::ILog* log, omni::str::IReadOnlyCString* name, omni::log::ChannelUpdateReason reason)>
            m_function;
    };

    auto consumer{ omni::core::steal(new Consumer{ std::move(fun) }) };
    addChannelUpdateConsumer_abi(consumer.get());
    return consumer;
}

#endif

#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL