Add a new plugin / extension mechanism called a resource provider along with retrofitting VFS on top of it.
A resource provider provides a mechanism for MuJoCo to read from filesystems other than the OS filesystem or the Virtual File System (VFS). PiperOrigin-RevId: 525394983 Change-Id: I077ff5a7e2e76806b48b6defb531280aadc8b169
This commit is contained in:
committed by
Copybara-Service
parent
b25728cc2e
commit
fe3dccfd1d
@@ -28,15 +28,33 @@ MJAPI void mjp_defaultPlugin(mjpPlugin* plugin);
|
||||
// globally register a plugin (thread-safe), return new slot id
|
||||
MJAPI int mjp_registerPlugin(const mjpPlugin* plugin);
|
||||
|
||||
// globally register a resource provider (thread-safe), return new slot id
|
||||
MJAPI int mjp_registerResourceProvider(const mjpResourceProvider* provider);
|
||||
|
||||
// globally unregister a resource provider (thread-safe)
|
||||
MJAPI void mjp_unregisterResourceProvider(int slot);
|
||||
|
||||
// return the number of globally registered plugins
|
||||
MJAPI int mjp_pluginCount();
|
||||
|
||||
// return the number of globally registered resource providers
|
||||
MJAPI int mjp_resourceProviderCount();
|
||||
|
||||
// look up a plugin by name, optionally also get its registered slot number
|
||||
MJAPI const mjpPlugin* mjp_getPlugin(const char* name, int* slot);
|
||||
|
||||
// set default resource provider definition
|
||||
MJAPI void mjp_defaultResourceProvider(mjpResourceProvider* provider);
|
||||
|
||||
// look up a resource provider that matches its prefix against the given resource name
|
||||
MJAPI const mjpResourceProvider* mjp_getResourceProvider(const char* resource_name);
|
||||
|
||||
// look up a plugin by slot number
|
||||
MJAPI const mjpPlugin* mjp_getPluginAtSlot(int slot);
|
||||
|
||||
// look up a resource provider by slot number
|
||||
MJAPI const mjpResourceProvider* mjp_getResourceProviderAtSlot(int slot);
|
||||
|
||||
// return a config attribute of a plugin instance
|
||||
// NULL: invalid plugin instance ID or attribute name
|
||||
MJAPI const char* mj_getPluginConfig(const mjModel* m, int plugin_id, const char* attrib);
|
||||
@@ -51,10 +69,13 @@ MJAPI void mj_loadAllPluginLibraries(const char* directory, mjfPluginLibraryLoad
|
||||
// MuJoCo-internal functions beyond this point.
|
||||
// "Unsafe" suffix indicates that improper use of these functions may result in data races.
|
||||
//
|
||||
// The unsafe functions assume that called mjp_pluginCount has already been called, and that it is
|
||||
// safe to assume that all plugins up to `count` have been completely written into the global table.
|
||||
// The unsafe functions assume that mjp_pluginCount has already been called, and that all plugins
|
||||
// up to `count` have been completely written into the global table.
|
||||
// =================================================================================================
|
||||
|
||||
// internal version of mjp_registerResourceProvider without prechecks on reserved prefixes
|
||||
MJAPI int mjp_registerResourceProviderInternal(const mjpResourceProvider* provider);
|
||||
|
||||
// look up a plugin by name, assuming that mjp_pluginCount has already been called
|
||||
const mjpPlugin* mjp_getPluginUnsafe(const char* name, int* slot, int nslot);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user