omni::core::ModuleExports
Defined in omni/core/ModuleExports.h
-
struct ModuleExports
Entities exported by a module for both use and population by omni::core::ITypeFactory.
Rather than a fixed data structure to communicate which functions a DLL exports, Omniverse modules use a data driven approach to convey both what functionality the module brings to the table and the needs of the module in order to operate correctly.
The data members in this structure, while public, should be treated as opaque. Hiding the data members (i.e. making them private) would violate C++11’s “standard layout” requirements, thus making this struct not ABI safe .
Avoid calling methods of this struct directly. Rather call the helper macros. For example, call OMNI_MODULE_ON_MODULE_LOAD() rather than ModuleExports::addOnModuleLoad(). Calling the former allows future implementations leeway to make your awesome-futuristic interface compatible with older carb.dll’s.
Unless otherwise noted, pointers provided to this object are expected to be valid for the lifetime of the module.
See also
Omniverse Native Interfaces for an overview of plugin loading (explicit module loading).
Public Functions
-
inline Result checkVersion(uint16_t moduleMagic, uint16_t moduleVersion)
Returns kResultSuccess if the given version is supported, an error otherwise.
This method is called from the module.
-
inline Result add(const ModuleExportEntry *entry)
Adds the given export entry. Return
false
if there is not enough space.
-
inline ModuleExportEntry *find(const char *type)
Returns a pointer to the first entry of the given type. Return
nullptr
if no such entry exists.
-
inline Result requireExport(const char *type)
Finds the first entry of the given type and sets it as “required”. Returns an error if no such entry could be found.
-
inline Result addOnModuleLoad(OnModuleLoadFn *fn, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_ON_MODULE_LOAD.
-
inline Result addOnModuleStarted(OnModuleStartedFn *fn, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_ON_MODULE_STARTED.
-
inline Result addOnModuleCanUnload(OnModuleCanUnloadFn *fn, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_ON_MODULE_CAN_UNLOAD.
-
inline Result addOnModuleUnload(OnModuleUnloadFn *fn, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_ON_MODULE_UNLOAD.
-
inline Result addITypeFactory(ITypeFactory **typeFactory, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_SET_EXPORTS.
-
inline Result addILog(log::ILog **log, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_SET_EXPORTS.
-
inline Result addLogChannel(const char *channelName, int32_t *level, const char *description, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_LOG_ADD_CHANNEL.
-
inline Result addIStructuredLog(omni::structuredlog::IStructuredLog **strucLog, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_SET_EXPORTS.
-
inline Result addStructuredLogSchema(omni::structuredlog::SchemaAddFn fn, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_ADD_STRUCTURED_LOG_SCHEMA().
-
inline Result addCarbClientName(const char *clientName, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_SET_EXPORTS.
-
inline Result addCarbFramework(carb::Framework **carbFramework, const carb::Version &ver, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_SET_EXPORTS.
-
inline Result addCarbIAssert(carb::assert::IAssert **assert, const carb::InterfaceDesc &interfaceDesc, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_SET_EXPORTS.
-
inline Result addCarbILogging(carb::logging::ILogging **logging, detail::CarbLogFn *logFn, detail::CarbLogLevelFn *logLevelFn, int32_t *logLevel, const carb::InterfaceDesc &interfaceDesc, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_SET_EXPORTS.
-
inline Result addCarbIProfiler(std::atomic<carb::profiler::IProfiler*> *profiler, const carb::InterfaceDesc &interfaceDesc, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_SET_EXPORTS.
-
inline Result addCarbIL10n(carb::l10n::IL10n **localization, detail::CarbLocalizeStringFn *localizationFn, const carb::InterfaceDesc &interfaceDesc, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_SET_EXPORTS.
-
inline Result addGetModuleDependencies(GetModuleDependenciesFn *fn, ModuleExportEntryFlag flags = fModuleExportEntryFlagNone)
See OMNI_MODULE_GET_MODULE_DEPENDENCIES.
Public Members
-
uint16_t magic
Magic number. Used for sanity checking. Should be kModuleExportsMagic.
-
uint16_t version
Version of this structure. Changing this will break most modules.
Version 1 of this structure defines a key/value database of module capabilities and requirements.
Adding or removing a key from this database does not warrant a version bump. Rather a version bump is required if:
Any field in this struct change its meaning.
Fields are removed from this struct (hint: never remove a field, rather, deprecate it).
The “keys” in the key/value pairs are designed such that a “key” has a known value. A “key“‘s meaning can never change. If a change is desired, a new key is created.
-
uint32_t byteCount
Size of this structure. Here the size is
sizeof(ModuleExports)
+ any extra space allocated at the end of this struct for ModuleExportEntry’s.
-
uint8_t *exportsBegin
Pointer to the first byte of the first ModuleExportEntry.
-
uint8_t *exportsEnd
Pointer to the byte after the end of the last ModuleExportEntry. The module is expected to update this field.
-
inline Result checkVersion(uint16_t moduleMagic, uint16_t moduleVersion)