omni/kit/exec/core/unstable/Module.h

File members: omni/kit/exec/core/unstable/Module.h

// Copyright (c) 2022-2024, 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.
//

#pragma once

#include <omni/graph/exec/unstable/Module.h>
#include <omni/kit/exec/core/unstable/IExecutionControllerFactory.h>

namespace omni
{
namespace kit
{
namespace exec
{
namespace core
{
namespace unstable
{

#ifndef DOXYGEN_BUILD
namespace detail
{
// overloaded function to handle a clear callback not be given to OMNI_KIT_EXEC_CORE_ON_MODULE_STARTED
void _addClearCallback()
{
}

template <typename Fn>
void _addClearCallback(Fn&& fn)
{
    addClearCallback(std::forward<Fn>(fn));
}

} // namespace detail
#endif

} // namespace unstable
} // namespace core
} // namespace exec
} // namespace kit
} // namespace omni

#define OMNI_KIT_EXEC_CORE_ON_MODULE_STARTED(moduleName_, ...)                                                         \
    OMNI_GRAPH_EXEC_ON_MODULE_STARTED(moduleName_);                                                                    \
    omni::kit::exec::core::unstable::detail::_addClearCallback(__VA_ARGS__);

#define OMNI_KIT_EXEC_CORE_ON_MODULE_UNLOAD()                                                                          \
    OMNI_GRAPH_EXEC_ON_MODULE_UNLOAD();                                                                                \
    omni::kit::exec::core::unstable::getExecutionControllerFactory()->clear(                                           \
        omni::kit::exec::core::unstable::detail::getModuleHash());                                                     \
    omni::kit::exec::core::unstable::removeClearCallbacks();