Files
salmanoff/stimBuffApis/lcameraBuff/tests/hilSmoCallbacksStub.cpp
T
hayodea 63532a6ee2 Resolve device selector on detach and add YuvStimProducer state tests.
Detach finds the shared producer via lcameraDev_resolveDeviceSelectorCReq
then removes buffers by attach identity; unit tests cover quale guards.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 11:04:22 -04:00

96 lines
2.4 KiB
C++

#include <hilSmoCallbacksStub.h>
#include <opts.h>
#include <user/comparatorApiDesc.h>
#include <spinscale/componentThread.h>
namespace lcamera_buff_tests {
namespace {
std::optional<std::string> searchForLibInSmoSearchPathsStub(
const std::string& libraryPath)
{
(void)libraryPath;
const char *overridePath = std::getenv("LCAMERADEV_LIB_PATH");
if (overridePath != nullptr && std::string(overridePath).size() > 0) {
return overridePath;
}
return std::nullopt;
}
std::shared_ptr<sscl::ComponentThread> componentThreadGetSelfStub()
{
return sscl::ComponentThread::getSelf();
}
OptionParser& optionParserGetOptionsStub()
{
return OptionParser::getOptions();
}
void releaseUseHostPtrBufferStub(
std::shared_ptr<smo::compute::ClBuffer> buffer)
{
(void)buffer;
}
std::shared_ptr<smo::compute::ComputeDevice> computeManagerGetDeviceStub()
{
return nullptr;
}
void computeManagerReleaseDeviceStub(
std::shared_ptr<smo::compute::ComputeDevice> device)
{
(void)device;
}
std::shared_ptr<smo::cologex::ExportedComparatorTypeDesc>
comparatorManagerGetComparatorTypeStub(smo::cologex::ComparatorTypeId typeId)
{
(void)typeId;
return nullptr;
}
std::unique_ptr<smo::cologex::Comparator> comparatorGetNewInstanceStub(
const std::shared_ptr<smo::cologex::ExportedComparatorTypeDesc>& comparatorType)
{
(void)comparatorType;
return nullptr;
}
const smo::stim_buff::SmoCallbacks hilCallbacks = {
.searchForLibInSmoSearchPaths = searchForLibInSmoSearchPathsStub,
.ComponentThread_getSelf = componentThreadGetSelfStub,
.OptionParser_getOptions = optionParserGetOptionsStub,
.ComputeManager_createUseHostPtrBuffer = createUseHostPtrBufferStub,
.ComputeManager_releaseUseHostPtrBuffer = releaseUseHostPtrBufferStub,
.ComputeManager_getDevice = computeManagerGetDeviceStub,
.ComputeManager_releaseDevice = computeManagerReleaseDeviceStub,
.ComparatorManager_getComparatorType =
comparatorManagerGetComparatorTypeStub,
.Comparator_getNewInstance = comparatorGetNewInstanceStub,
};
} // namespace
std::shared_ptr<smo::compute::ClBuffer> createUseHostPtrBufferStub(
void* hostPtr,
size_t size,
cl_mem_flags flags)
{
static const std::vector<std::shared_ptr<smo::compute::ComputeDevice>>
emptyDevices;
return std::make_shared<smo::compute::ClBuffer>(
hostPtr, size, flags, emptyDevices);
}
const smo::stim_buff::SmoCallbacks& hilSmoCallbacksStub()
{
return hilCallbacks;
}
} // namespace lcamera_buff_tests