AssertUtils.h#
Fully qualified name: carb/assert/AssertUtils.h
File members: carb/assert/AssertUtils.h
// SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: LicenseRef-NvidiaProprietary
//
// NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
// property and proprietary rights in and to this material, related
// documentation and any modifications thereto. Any use, reproduction,
// disclosure or distribution of this material and related documentation
// without an express license agreement from NVIDIA CORPORATION or
// its affiliates is strictly prohibited.
#pragma once
#include "../Framework.h"
#define CARB_ASSERT_GLOBALS()
namespace carb
{
namespace assert
{
inline void registerAssertForClient() noexcept
{
g_carbAssert = getFramework()->tryAcquireInterface<IAssert>();
}
inline void deregisterAssertForClient() noexcept
{
g_carbAssert = nullptr;
}
inline bool disableDialog(bool disable)
{
if (g_carbAssert)
{
return !!(g_carbAssert->setAssertionFlags(disable ? fAssertSkipDialog : 0, disable ? 0 : fAssertSkipDialog) &
fAssertSkipDialog);
}
return false;
}
inline bool useBreakpoint(bool enabled)
{
if (g_carbAssert)
{
return !(g_carbAssert->setAssertionFlags(enabled ? 0 : fAssertSkipBreakpoint, enabled ? fAssertSkipBreakpoint : 0) &
fAssertSkipBreakpoint);
}
return true;
}
inline bool showToConsole(bool enabled)
{
if (g_carbAssert)
{
return !(g_carbAssert->setAssertionFlags(enabled ? 0 : fAssertNoConsole, enabled ? fAssertNoConsole : 0) &
fAssertNoConsole);
}
return true;
}
inline uint64_t getFailureCount()
{
return g_carbAssert ? g_carbAssert->getAssertionFailureCount() : 0;
}
} // namespace assert
} // namespace carb