Exceptions: All of smocore likely now uses exceptions
This commit is contained in:
@@ -13,8 +13,8 @@
|
||||
#include <deviceManager/deviceRole.h>
|
||||
#include <deviceManager/deviceReattacher.h>
|
||||
#include <marionette/marionetteThread.h>
|
||||
#include <spinscale/co/coQutex.h>
|
||||
#include <spinscale/multiOperationResultSet.h>
|
||||
#include <spinscale/co/coQutex.h>
|
||||
#include <spinscale/sharedResourceGroup.h>
|
||||
|
||||
namespace smo {
|
||||
@@ -25,13 +25,6 @@ class DeviceReattacher;
|
||||
class DeviceManager
|
||||
{
|
||||
public:
|
||||
struct DeviceAttachmentIndResult
|
||||
{
|
||||
bool success = false;
|
||||
std::shared_ptr<DeviceRole> deviceRole;
|
||||
std::shared_ptr<DeviceAttachmentSpec> deviceSpec;
|
||||
};
|
||||
|
||||
static DeviceManager& getInstance()
|
||||
{
|
||||
static DeviceManager instance;
|
||||
@@ -52,31 +45,27 @@ public:
|
||||
|
||||
static const std::string stringifyDeviceSpecs(void);
|
||||
|
||||
mrntt::MrnttViralPostingInvoker<DeviceAttachmentIndResult>
|
||||
mrntt::MrnttViralPostingInvoker<std::shared_ptr<DeviceRole>>
|
||||
newDeviceAttachmentSpecIndCReq(const DeviceAttachmentSpec &spec);
|
||||
|
||||
mrntt::MrnttViralPostingInvoker<DeviceAttachmentIndResult>
|
||||
mrntt::MrnttViralPostingInvoker<void>
|
||||
removeDeviceAttachmentSpecCReq(const DeviceAttachmentSpec &spec);
|
||||
|
||||
mrntt::MrnttViralPostingInvoker<stim_buff::StimBuffDeviceOpResult>
|
||||
mrntt::MrnttViralPostingInvoker<void>
|
||||
attachStimBuffDeviceCReq(
|
||||
const std::shared_ptr<DeviceAttachmentSpec>& spec);
|
||||
|
||||
mrntt::MrnttViralPostingInvoker<stim_buff::StimBuffDeviceOpResult>
|
||||
mrntt::MrnttViralPostingInvoker<void>
|
||||
detachStimBuffDeviceCReq(
|
||||
const std::shared_ptr<DeviceAttachmentSpec>& spec);
|
||||
|
||||
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSet>
|
||||
attachAllUnattachedDevicesFromCReq(
|
||||
const std::shared_ptr<std::vector<DeviceAttachmentSpec>> &specs);
|
||||
|
||||
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSet>
|
||||
mrntt::MrnttViralPostingInvoker<void>
|
||||
attachAllUnattachedDevicesFromKnownListCReq();
|
||||
|
||||
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSet>
|
||||
mrntt::MrnttViralPostingInvoker<void>
|
||||
attachAllUnattachedDevicesFromCmdlineCReq();
|
||||
|
||||
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSet>
|
||||
mrntt::MrnttViralPostingInvoker<void>
|
||||
detachAllAttachedDeviceRolesCReq();
|
||||
|
||||
private:
|
||||
@@ -88,6 +77,10 @@ private:
|
||||
DeviceManager(const DeviceManager&) = delete;
|
||||
DeviceManager& operator=(const DeviceManager&) = delete;
|
||||
|
||||
mrntt::MrnttViralPostingInvoker<sscl::MultiOperationResultSetWithException>
|
||||
attachAllUnattachedDevicesFromCReq(
|
||||
const std::shared_ptr<std::vector<DeviceAttachmentSpec>> &specs);
|
||||
|
||||
public:
|
||||
struct Resources
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <optional>
|
||||
#include <boost/asio/deadline_timer.hpp>
|
||||
#include <marionette/marionetteThread.h>
|
||||
#include <spinscale/multiOperationResultSet.h>
|
||||
#include <spinscale/syncCancelerForAsyncWork.h>
|
||||
|
||||
namespace smo {
|
||||
@@ -37,17 +36,17 @@ private:
|
||||
void onTimeout(const boost::system::error_code& error);
|
||||
void holdReattachCReq();
|
||||
|
||||
mrntt::MrnttNonViralPostingInvoker reattachKnownListCReq(
|
||||
sscl::co::ExplicitPostTarget postTarget,
|
||||
mrntt::MrnttNonViralNonPostingInvoker reattachKnownListCReq(
|
||||
std::exception_ptr &exceptionPtr,
|
||||
std::function<void()> callback);
|
||||
|
||||
DeviceManager &parent;
|
||||
// io_context thread for timer and non-posting reattach shell (see ctor).
|
||||
std::shared_ptr<sscl::ComponentThread> ioThread;
|
||||
sscl::SyncCancelerForAsyncWork deviceReattacherCanceler;
|
||||
boost::asio::deadline_timer timer;
|
||||
std::exception_ptr reattachLifetimeExceptionPtr;
|
||||
std::optional<mrntt::MrnttNonViralPostingInvoker> reattachCReqInvoker;
|
||||
std::optional<mrntt::MrnttNonViralNonPostingInvoker> reattachCReqInvoker;
|
||||
bool reattachOpInFlight = false;
|
||||
std::chrono::steady_clock::time_point lastReattachReqTimestamp{};
|
||||
};
|
||||
|
||||
@@ -20,6 +20,9 @@ using MrnttPostingPromise =
|
||||
using MrnttNonViralPostingInvoker =
|
||||
sscl::co::NonViralPostingInvoker<MrnttPostingPromise>;
|
||||
|
||||
using MrnttNonViralNonPostingInvoker =
|
||||
sscl::co::NonViralNonPostingInvoker;
|
||||
|
||||
template <typename T>
|
||||
using MrnttViralPostingInvoker =
|
||||
sscl::co::ViralPostingInvoker<MrnttPostingPromise, T>;
|
||||
|
||||
@@ -41,8 +41,9 @@ public:
|
||||
|
||||
std::optional<std::shared_ptr<StimBuffApiLib>> getStimBuffApiLib(
|
||||
const std::string& libraryPath);
|
||||
std::optional<std::shared_ptr<StimBuffApiLib>> getStimBuffApiLibByApiName(
|
||||
std::optional<std::shared_ptr<StimBuffApiLib>> findStimBuffApiLibByApiName(
|
||||
const std::string& apiName);
|
||||
StimBuffApiLib &getStimBuffApiLibByApiName(const std::string& apiName);
|
||||
void unloadStimBuffApiLib(const std::string& libraryPath);
|
||||
|
||||
void loadAllStimBuffApiLibsFromOptions(
|
||||
|
||||
Reference in New Issue
Block a user