// 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/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


/** Interface to collect information about the CPUs installed in the calling system.  This
 *  can provide some basic information about the CPU(s) and get access to features that are
 *  supported by them.
 */
template <>
class omni::core::Generated<omni::platforminfo::ICpuInfo_abi> : public omni::platforminfo::ICpuInfo_abi
{
public:
    OMNI_PLUGIN_INTERFACE("omni::platforminfo::ICpuInfo")

    /** Retrieves the total number of CPU packages installed on the system.
     *
     *  @returns The total number of CPU packages installed in the system.  A CPU package
     *           is a single physical CPU chip that is connected to a physical socket on
     *           the motherboard.
     *
     *  @remarks A system may have multiple CPUs installed if the motherboard supports it.
     *           At least in the Intel (and compatible) case, there are some restrictions
     *           to doing this - all CPUs must be in the same family, share the same core
     *           count, feature set, and bus speed.  Outside of that, the CPUs do not need
     *           to be identical.
     *
     *  @thread_safety This call is thread safe.
     */
    size_t getCpuPackageCount() noexcept;

    /** Retrieves the total number of physical cores across all CPUs in the system.
     *
     *  @returns The total number of physical cores across all CPUs in the system.  This includes
     *           the sum of all physical cores on all CPU packages.  This will not be zero.
     *
     *  @thread_safety This call is thread safe.
     */
    size_t getTotalPhysicalCoreCount() noexcept;

    /** Retrieves the total number of logical cores across all CPUs in the system.
     *
     *  @returns The total number of logical cores across all CPUs in the system.  This includes
     *           the sum of all logical cores on all CPU packages.
     *
     *  @thread_safety This call is thread safe.
     */
    size_t getTotalLogicalCoreCount() noexcept;

    /** Retrieves the number of physical cores per CPU package in the system.
     *
     *  @returns The total number of physical cores per CPU package.  Since all CPU packages
     *           must have the same core counts, this is a common value to all packages.
     *
     *  @thread_safety This call is thread safe.
     */
    size_t getPhysicalCoresPerPackage() noexcept;

    /** Retrieves the number of logical cores per CPU package in the system.
     *
     *  @returns The total number of logical cores per CPU package.  Since all CPU packages
     *           must have the same core counts, this is a common value to all packages.
     *
     *  @thread_safety This call is thread safe.
     */
    size_t getLogicalCoresPerPackage() noexcept;

    /** Checks if a requested feature is supported by the CPU(s) in the system.
     *
     *  @returns `true` if the requested feature is supported.  Returns `false` otherwise.
     *
     *  @remarks See @ref omni::platforminfo::CpuFeature for more information on the features
     *           that can be queried.
     *
     *  @thread_safety This call is thread safe.
     */
    bool isFeatureSupported(omni::platforminfo::CpuFeature feature) noexcept;

    /** Retrieves the friendly name of a CPU in the system.
     *
     *  @param[in] cpuIndex     The zero based index of the CPU package to retrieve the name
     *                          for.  This should be less than the return value of
     *                          ICpuInfo::getCpuPackageCount().
     *  @returns The friendly name of the requested CPU package.  This string should be suitable
     *           for display to the user.  This will contain a rough outline of the processor
     *           model and architecture.  It may or may not contain the clock speed.
     *
     *  @thread_safety This call is thread safe.
     */
    const char* getPrettyName(size_t cpuIndex) noexcept;

    /** Retrieves the identifier of a CPU in the system.
     *
     *  @param[in] cpuIndex     The zero based index of the CPU package to retrieve the identifier
     *                          for.  This should be less than the return value of
     *                          ICpuInfo::getCpuPackageCount().
     *  @returns The identifier string of the requested CPU package.  This string should be
     *           suitable for display to the user.  This will contain information about the
     *           processor family, vendor, and architecture.
     *
     *  @thread_safety This call is thread safe.
     */
    const char* getIdentifier(size_t cpuIndex) noexcept;

    /** Retrieves the vendor string for a CPU package in the system.
     *
     *  @param[in] cpuIndex     The zero based index of the CPU package to retrieve the vendor
     *                          for.  This should be less than the return value of
     *                          ICpuInfo::getCpuPackageCount().
     *  @returns The name of the vendor as reported by the CPU itself.  This may be something
     *           along the lines of "GenuineIntel" or "AuthenticAMD" for x86_64 architectures,
     *           or the name of the CPU implementer for ARM architectures.
     *
     *  @thread_safety This call is thread safe.
     */
    const char* getVendor(size_t cpuIndex) noexcept;

    /** Note: the mask may be 0 if out of range of 64 bits. */
    /** Retrieves a bit mask for the processor cores in a CPU package in the system.
     *
     *  @param[in] cpuIndex     The zero based index of the CPU package to retrieve the identifier
     *                          for.  This should be less than the return value of
     *                          ICpuInfo::getCpuPackageCount().
     *  @returns A mask identifying which CPU cores the given CPU covers.  A set bit indicates
     *           a core that belongs to the given CPU.  A 0 bit indicates either a core from
     *           another package or a non-existent core.  This may also be 0 if more than 64
     *           cores are present in the system or they are out of range of a single 64-bit
     *           value.
     *
     *  @thread_safety This call is thread safe.
     */
    uint64_t getProcessorMask(size_t cpuIndex) noexcept;
};

#endif

#ifndef OMNI_BIND_INCLUDE_INTERFACE_DECL

inline size_t omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::getCpuPackageCount() noexcept
{
    return getCpuPackageCount_abi();
}

inline size_t omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::getTotalPhysicalCoreCount() noexcept
{
    return getTotalPhysicalCoreCount_abi();
}

inline size_t omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::getTotalLogicalCoreCount() noexcept
{
    return getTotalLogicalCoreCount_abi();
}

inline size_t omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::getPhysicalCoresPerPackage() noexcept
{
    return getPhysicalCoresPerPackage_abi();
}

inline size_t omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::getLogicalCoresPerPackage() noexcept
{
    return getLogicalCoresPerPackage_abi();
}

inline bool omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::isFeatureSupported(
    omni::platforminfo::CpuFeature feature) noexcept
{
    return isFeatureSupported_abi(feature);
}

inline const char* omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::getPrettyName(size_t cpuIndex) noexcept
{
    return getPrettyName_abi(cpuIndex);
}

inline const char* omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::getIdentifier(size_t cpuIndex) noexcept
{
    return getIdentifier_abi(cpuIndex);
}

inline const char* omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::getVendor(size_t cpuIndex) noexcept
{
    return getVendor_abi(cpuIndex);
}

inline uint64_t omni::core::Generated<omni::platforminfo::ICpuInfo_abi>::getProcessorMask(size_t cpuIndex) noexcept
{
    return getProcessorMask_abi(cpuIndex);
}

#endif

#undef OMNI_BIND_INCLUDE_INTERFACE_DECL
#undef OMNI_BIND_INCLUDE_INTERFACE_IMPL
