6ef86eea05
This language is used broadly to specify how to attach (and thus also how to detach) devices to/from Salmanoff. The next bit of work we'll do is split off the DSL parsing from the management of the list of parsed binary attached spec objects. We'll be creating a PipeDeviceAttachmentParser, and later on when we support URDF, we'll create a URDFDeviceAttachmentParser.
67 lines
1.8 KiB
C++
67 lines
1.8 KiB
C++
#ifndef SENSE_API_MANAGER_H
|
|
#define SENSE_API_MANAGER_H
|
|
|
|
#include <config.h>
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <string>
|
|
#include <optional>
|
|
#include <functional>
|
|
#include <senseApis/senseApiLib.h>
|
|
#include <user/deviceAttachmentSpec.h>
|
|
|
|
namespace smo {
|
|
namespace sense_api {
|
|
|
|
class SenseApiManager
|
|
{
|
|
public:
|
|
static SenseApiManager& getInstance()
|
|
{
|
|
static SenseApiManager instance;
|
|
return instance;
|
|
}
|
|
|
|
SenseApiLib& loadSenseApiLib(const std::string& libraryPath);
|
|
std::optional<std::shared_ptr<SenseApiLib>> getSenseApiLib(
|
|
const std::string& libraryPath);
|
|
std::optional<std::shared_ptr<SenseApiLib>> getSenseApiLibByApiName(
|
|
const std::string& apiName);
|
|
void unloadSenseApiLib(const std::string& libraryPath);
|
|
|
|
void initializeSenseApiLib(SenseApiLib& lib);
|
|
void finalizeSenseApiLib(SenseApiLib& lib);
|
|
|
|
void loadAllSenseApiLibsFromOptions(void);
|
|
void unloadAllSenseApiLibs(void);
|
|
void initializeAllSenseApiLibs(void);
|
|
void finalizeAllSenseApiLibs(void);
|
|
|
|
void attachAllSenseDevicesFromSpecs(void);
|
|
void attachSenseDevice(
|
|
const std::shared_ptr<device::DeviceAttachmentSpec>& spec);
|
|
void detachSenseDevice(
|
|
const std::shared_ptr<device::DeviceAttachmentSpec>& spec);
|
|
void detachAllSenseDevices(void);
|
|
|
|
std::string stringifyLibs() const;
|
|
|
|
private:
|
|
SenseApiManager() = default;
|
|
~SenseApiManager() = default;
|
|
|
|
SenseApiManager(const SenseApiManager&) = delete;
|
|
SenseApiManager& operator=(const SenseApiManager&) = delete;
|
|
|
|
std::vector<std::shared_ptr<SenseApiLib>> senseApiLibs;
|
|
|
|
public:
|
|
static std::optional<std::string> searchForLibInSmoSearchPaths(
|
|
const std::string& libraryPath);
|
|
};
|
|
|
|
} // namespace sense_api
|
|
} // namespace smo
|
|
|
|
#endif // SENSE_API_MANAGER_H
|