Indentation

This commit is contained in:
2025-09-30 01:15:02 -04:00
parent 9d77e8b345
commit 97d93c670e
+52 -52
View File
@@ -15,70 +15,70 @@ namespace sense_api {
class SenseApiLib class SenseApiLib
{ {
private: private:
friend class SenseApiManager; friend class SenseApiManager;
struct DlCloser struct DlCloser
{ {
void operator()(void* handle) const void operator()(void* handle) const
{ {
if (handle) { if (handle) {
dlclose(handle); dlclose(handle);
} }
} }
}; };
public: public:
SenseApiLib( SenseApiLib(
const std::string& path, void *_dlopen_handle, const std::string& path, void *_dlopen_handle,
SMO_GET_SENSE_API_DESC_FN_TYPEDEF *descFn) SMO_GET_SENSE_API_DESC_FN_TYPEDEF *descFn)
: libraryPath(path), qutex("SenseApiLib-" + path), : libraryPath(path), qutex("SenseApiLib-" + path),
dlopen_handle(_dlopen_handle, DlCloser()), dlopen_handle(_dlopen_handle, DlCloser()),
SMO_GET_SENSE_API_DESC_FN_NAME(descFn) SMO_GET_SENSE_API_DESC_FN_NAME(descFn)
{} {}
void setSenseApiDesc(const SenseApiDesc &desc) void setSenseApiDesc(const SenseApiDesc &desc)
{ {
if (!SenseApiDesc::sanityCheck(desc)) if (!SenseApiDesc::sanityCheck(desc))
{ {
throw std::runtime_error( throw std::runtime_error(
std::string(__func__) + ": Sanity check failed for sense API " std::string(__func__) + ": Sanity check failed for sense API "
"descriptor in library '" + libraryPath + "'"); "descriptor in library '" + libraryPath + "'");
} }
senseApiDesc = desc; senseApiDesc = desc;
} }
public: public:
std::string libraryPath; std::string libraryPath;
Qutex qutex; Qutex qutex;
std::unique_ptr<void, DlCloser> dlopen_handle; std::unique_ptr<void, DlCloser> dlopen_handle;
/* UNIMPLEMENTED: API-specific cmdline options. These affect this specific /* UNIMPLEMENTED: API-specific cmdline options. These affect this specific
* sense api lib's behaviour globally. * sense api lib's behaviour globally.
*/ */
std::vector<std::string> options; std::vector<std::string> options;
/** /**
* @brief Every sense API lib is required to provide a function that returns * @brief Every sense API lib is required to provide a function that returns
* a SenseApiDesc struct. This struct states which API the lib uses to * a SenseApiDesc struct. This struct states which API the lib uses to
* connect Salmanoff to the sense provider it supports. * connect Salmanoff to the sense provider it supports.
* *
* This getter function should be visible to dlsym() so that Salmanoff can * This getter function should be visible to dlsym() so that Salmanoff can
* find it in the lib after loading it, and call it. * find it in the lib after loading it, and call it.
*/ */
std::function<SMO_GET_SENSE_API_DESC_FN_TYPEDEF> std::function<SMO_GET_SENSE_API_DESC_FN_TYPEDEF>
SMO_GET_SENSE_API_DESC_FN_NAME; SMO_GET_SENSE_API_DESC_FN_NAME;
/** /**
* @brief Salmanoff will call the `SMO_GET_SENSE_API_DESC_FN_NAME` getter * @brief Salmanoff will call the `SMO_GET_SENSE_API_DESC_FN_NAME` getter
* function and use the data it provides in order to fill out this * function and use the data it provides in order to fill out this
* descriptor. * descriptor.
*/ */
SenseApiDesc senseApiDesc; SenseApiDesc senseApiDesc;
std::string stringify() const { std::string stringify() const {
std::string result = "Library Path: " + libraryPath + "\n"; std::string result = "Library Path: " + libraryPath + "\n";
result += "Sense API Descriptor: " + senseApiDesc.stringify() + "\n"; result += "Sense API Descriptor: " + senseApiDesc.stringify() + "\n";
return result; return result;
} }
}; };
} // namespace sense_api } // namespace sense_api