Add ComparatorApiManager with SmoCallbacks hooks and startup load.
Register comparator types via a dedicated manager and expose lookup/create hooks through SmoCallbacks so stimbuff libs can resolve comparators at load time. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <algorithm>
|
||||
#include <stimBuffApis/stimBuffApiManager.h>
|
||||
#include <stimBuffApis/stimBuffApiLib.h>
|
||||
#include <comparatorLibs/comparatorApiManager.h>
|
||||
#include <loadableLib/loadableLibraryManager.h>
|
||||
#include <body/bodyThread.h>
|
||||
#include <componentThread.h>
|
||||
@@ -73,6 +74,20 @@ std::optional<std::string> searchForLibInSmoSearchPathsHook(
|
||||
.searchForLibInSmoSearchPaths(libraryPath);
|
||||
}
|
||||
|
||||
std::shared_ptr<cologex::ExportedComparatorTypeDesc>
|
||||
ComparatorManager_getComparatorTypeHook(cologex::ComparatorTypeId typeId)
|
||||
{
|
||||
return comparator_lib::ComparatorApiManager::getInstance()
|
||||
.getComparatorType(typeId);
|
||||
}
|
||||
|
||||
std::unique_ptr<cologex::Comparator> Comparator_getNewInstanceHook(
|
||||
const std::shared_ptr<cologex::ExportedComparatorTypeDesc>& comparatorType)
|
||||
{
|
||||
return comparator_lib::ComparatorApiManager::getInstance()
|
||||
.getNewComparatorInstance(comparatorType);
|
||||
}
|
||||
|
||||
/* Hooks to be provided to stimBuffApiLibs, enabling them to call into Salmanoff
|
||||
* code.
|
||||
*/
|
||||
@@ -86,7 +101,10 @@ SmoCallbacks smoCallbacks =
|
||||
.ComputeManager_releaseUseHostPtrBuffer =
|
||||
ComputeManager_releaseUseHostPtrBuffer,
|
||||
.ComputeManager_getDevice = ComputeManager_getDevice,
|
||||
.ComputeManager_releaseDevice = ComputeManager_releaseDevice
|
||||
.ComputeManager_releaseDevice = ComputeManager_releaseDevice,
|
||||
.ComparatorManager_getComparatorType =
|
||||
ComparatorManager_getComparatorTypeHook,
|
||||
.Comparator_getNewInstance = Comparator_getNewInstanceHook
|
||||
};
|
||||
|
||||
/* Static file-scope threading model object for senseApi libraries */
|
||||
@@ -96,6 +114,11 @@ SmoThreadingModelDesc smoThreadingModelDesc = {
|
||||
|
||||
} // namespace
|
||||
|
||||
const SmoCallbacks& getSmoCallbacks()
|
||||
{
|
||||
return smoCallbacks;
|
||||
}
|
||||
|
||||
StimBuffApiLib& StimBuffApiManager::loadStimBuffApiLib(
|
||||
const std::string& libraryPath,
|
||||
const std::shared_ptr<sscl::ComponentThread>& componentThread)
|
||||
|
||||
Reference in New Issue
Block a user