// Copyright (c) 2021-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. ----------
//

//! @file
//!
//! @brief This file was generated by <i>omni.bind</i>.

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

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

#ifndef OMNI_BIND_INCLUDE_INTERFACE_IMPL


//! Base class for object serialization requests.
template <>
class omni::core::Generated<omni::inspect::IInspectSerializer_abi> : public omni::inspect::IInspectSerializer_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::inspect::IInspectSerializer")

    /** Write a fixed string to the serializer output location
     *
     * @param[in] toWrite String to be written to the serializer
     */
    void writeString(const char* toWrite) noexcept;

    /** Write a printf-style formatted string to the serializer output location
     *
     * @param[in] fmt Formatting string in the printf() style
     * @param[in] args Variable list of arguments to the formatting string
     */
    void write(const char* fmt, ...) noexcept;

    /** Set the output location of the serializer data to be a specified file path.
     * Doesn't actually do anything with it until data is being written though.
     * Recognizes the special file paths "cout", "stdout", "cerr", and "stderr" as the standard output streams.
     *
     * @param[in] filePath New location of the output file
     */
    void setOutputToFilePath(const char* filePath) noexcept;

    /** Set the output location of the serializer data to be a local string.
     * No check is made to ensure that the string size doesn't get too large so when in doubt use a file path.
     */
    void setOutputToString() noexcept;

    /** Get the current location of the output data.
     *
     * @returns Current file path where the output is going. nullptr means the output is going to a string.
     */
    const char* getOutputLocation() noexcept;

    /** Get the current output as a string.
     *
     * @returns The output that has been sent to the serializer. If the output is being sent to a file path then read
     * the file at that path and return the contents of the file. If the output is being sent to stdout or stderr
     * then nothing is returned as that output is unavailable after flushing.
     */
    const char* asString() noexcept;

    /** Clear the contents of the serializer output, either emptying the file or clearing the string, depending on
     * where the current output is directed.
     */
    void clear() noexcept;
};

#endif

#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL

inline void omni::core::Generated<omni::inspect::IInspectSerializer_abi>::writeString(const char* toWrite) noexcept
{
    writeString_abi(toWrite);
}

inline void omni::core::Generated<omni::inspect::IInspectSerializer_abi>::write(const char* fmt, ...) noexcept
{
    va_list arg_list_;
    va_start(arg_list_, fmt);
    write_abi(fmt, arg_list_);
    va_end(arg_list_);
}

inline void omni::core::Generated<omni::inspect::IInspectSerializer_abi>::setOutputToFilePath(const char* filePath) noexcept
{
    setOutputToFilePath_abi(filePath);
}

inline void omni::core::Generated<omni::inspect::IInspectSerializer_abi>::setOutputToString() noexcept
{
    setOutputToString_abi();
}

inline const char* omni::core::Generated<omni::inspect::IInspectSerializer_abi>::getOutputLocation() noexcept
{
    return getOutputLocation_abi();
}

inline const char* omni::core::Generated<omni::inspect::IInspectSerializer_abi>::asString() noexcept
{
    return asString_abi();
}

inline void omni::core::Generated<omni::inspect::IInspectSerializer_abi>::clear() noexcept
{
    clear_abi();
}

#endif

#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
