// 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 inspection requests.
template <>
class omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi> : public omni::inspect::IInspectJsonSerializer_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::inspect::IInspectJsonSerializer")

    /** 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.
     *
     * @param[in] filePath Absolute location of the file to be written.
     */
    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 Path to the output file, or nullptr if output is going to a string
     */
    const char* getOutputLocation() noexcept;

    /** Get the current output as a string. If the output is being sent to a file path then read the file at that path
     * and return the contents of the file (with the usual caveats about file size).
     *
     * @returns String representation of the output so far
     */
    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;

    /** Write out a JSON key for an object property.
     *
     * @param[in] key    The string value for the key. This can be nullptr.
     * @param[in] keyLen The length of @ref key, excluding the null terminator.
     * @returns whether or not validation succeeded.
     */
    bool writeKeyWithLength(const char* key, size_t keyLen) noexcept;

    /** Write out a JSON key for an object property.
     *
     * @param[in] key The key name for this property. This may be nullptr.
     * @returns whether or not validation succeeded.
     */
    bool writeKey(const char* key) noexcept;

    /** Write out a JSON null value.
     *
     * @returns whether or not validation succeeded.
     */
    bool writeNull() noexcept;

    /** Write out a JSON boolean value.
     *
     * @param[in] value The boolean value.
     * @returns whether or not validation succeeded.
     */
    bool writeBool(bool value) noexcept;

    /** Write out a JSON integer value.
     *
     * @param[in] value The integer value.
     * @returns whether or not validation succeeded.
     */
    bool writeInt(int32_t value) noexcept;

    /** Write out a JSON unsigned integer value.
     *
     * @param[in] value The unsigned integer value.
     * @returns whether or not validation succeeded.
     */
    bool writeUInt(uint32_t value) noexcept;

    /** Write out a JSON 64-bit integer value.
     *
     * @param[in] value The 64-bit integer value.
     * @returns whether or not validation succeeded.
     * @note 64 bit integers will be written as a string of they are too long
     * to be stored as a number that's interoperable with javascript's
     * double precision floating point format.
     */
    bool writeInt64(int64_t value) noexcept;

    /** Write out a JSON 64-bit unsigned integer value.
     *
     * @param[in] value The 64-bit unsigned integer value.
     * @returns whether or not validation succeeded.
     * @note 64 bit integers will be written as a string of they are too long
     * to be stored as a number that's interoperable with javascript's
     * double precision floating point format.
     */
    bool writeUInt64(uint64_t value) noexcept;

    /** Write out a JSON pointer value as an unsigned int 64.
     * Not available through the Python bindings as Python has no concept of pointers. Use either writeUInt64()
     * or writeBase64Encoded() to write out binary data.
     *
     * @param[in] value The pointer value.
     * @returns whether or not validation succeeded.
     * @note Pointers will be written as a string of they are too long
     * to be stored as a number that's interoperable with javascript's
     * double precision floating point format.
     */
    bool writePointer(const void* value) noexcept;

    /** Write out a JSON double (aka number) value.
     *
     * @param[in] value The double value.
     * @returns whether or not validation succeeded.
     */
    bool writeDouble(double value) noexcept;

    /** Write out a JSON float (aka number) value.
     *
     * @param[in] value The double value.
     * @returns whether or not validation succeeded.
     */
    bool writeFloat(float value) noexcept;

    /** Write out a JSON string value.
     *
     * @param[in] value The string value. This can be nullptr if @p len is 0.
     * @param[in] len   The length of @p value, excluding the null terminator.
     * @returns whether or not validation succeeded.
     */
    bool writeStringWithLength(const char* value, size_t len) noexcept;

    /** Write out a JSON string value.
     *
     * @param[in] value The string value. This can be nullptr.
     * @returns whether or not validation succeeded.
     */
    bool writeString(const char* value) noexcept;

    /** Write a binary blob into the output JSON as a base64 encoded string.
     *
     * @param[in] value The binary blob to write in.
     * @param[in] size   The number of bytes of data in @p value.
     * @returns whether or not validation succeeded.
     * @remarks This will take the input bytes and encode it in base64, then store that as base64 data in a string.
     */
    bool writeBase64Encoded(const void* value, size_t size) noexcept;

    /** Begin a JSON array.
     *
     * @returns whether or not validation succeeded.
     * @note This may throw a std::bad_alloc or a std::length_error if the stack of scopes gets too large
     */
    bool openArray() noexcept;

    /** Finish writing a JSON array.
     *
     * @returns whether or not validation succeeded.
     */
    bool closeArray() noexcept;

    /** Begin a JSON object.
     *
     * @returns whether or not validation succeeded.
     */
    bool openObject() noexcept;

    /** Finish writing a JSON object.
     *
     * @returns whether or not validation succeeded.
     */
    bool closeObject() noexcept;

    /** Finishes writing the entire JSON dictionary.
     *
     * @returns whether or not validation succeeded.
     */
    bool finish() noexcept;
};

#endif

#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL

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

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

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

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

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

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeKeyWithLength(const char* key,
                                                                                                 size_t keyLen) noexcept
{
    return writeKeyWithLength_abi(key, keyLen);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeKey(const char* key) noexcept
{
    return writeKey_abi(key);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeNull() noexcept
{
    return writeNull_abi();
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeBool(bool value) noexcept
{
    return writeBool_abi(value);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeInt(int32_t value) noexcept
{
    return writeInt_abi(value);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeUInt(uint32_t value) noexcept
{
    return writeUInt_abi(value);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeInt64(int64_t value) noexcept
{
    return writeInt64_abi(value);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeUInt64(uint64_t value) noexcept
{
    return writeUInt64_abi(value);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writePointer(const void* value) noexcept
{
    return writePointer_abi(value);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeDouble(double value) noexcept
{
    return writeDouble_abi(value);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeFloat(float value) noexcept
{
    return writeFloat_abi(value);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeStringWithLength(const char* value,
                                                                                                    size_t len) noexcept
{
    return writeStringWithLength_abi(value, len);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeString(const char* value) noexcept
{
    return writeString_abi(value);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::writeBase64Encoded(const void* value,
                                                                                                 size_t size) noexcept
{
    return writeBase64Encoded_abi(value, size);
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::openArray() noexcept
{
    return openArray_abi();
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::closeArray() noexcept
{
    return closeArray_abi();
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::openObject() noexcept
{
    return openObject_abi();
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::closeObject() noexcept
{
    return closeObject_abi();
}

inline bool omni::core::Generated<omni::inspect::IInspectJsonSerializer_abi>::finish() noexcept
{
    return finish_abi();
}

#endif

#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
