mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-16 01:51:45 +00:00
SDK: Add ctors to adopt existing DDS API objects
This commit is contained in:
@@ -59,7 +59,6 @@ struct DDSSession::Impl
|
||||
explicit Impl(DDSEnvironment env)
|
||||
: fEnv(std::move(env))
|
||||
, fRMSPlugin(DDSRMSPlugin::localhost)
|
||||
, fDDSService()
|
||||
, fDDSCustomCmd(fDDSService)
|
||||
, fId(to_string(fSession.create()))
|
||||
, fStopOnDestruction(false)
|
||||
@@ -74,7 +73,6 @@ struct DDSSession::Impl
|
||||
explicit Impl(Id existing, DDSEnvironment env)
|
||||
: fEnv(std::move(env))
|
||||
, fRMSPlugin(DDSRMSPlugin::localhost)
|
||||
, fDDSService()
|
||||
, fDDSCustomCmd(fDDSService)
|
||||
, fId(std::move(existing))
|
||||
, fStopOnDestruction(false)
|
||||
@@ -90,6 +88,20 @@ struct DDSSession::Impl
|
||||
});
|
||||
}
|
||||
|
||||
explicit Impl(dds::tools_api::CSession nativeSession, DDSEnv env)
|
||||
: fEnv(std::move(env))
|
||||
, fRMSPlugin(DDSRMSPlugin::localhost)
|
||||
, fSession(std::move(nativeSession))
|
||||
, fDDSCustomCmd(fDDSService)
|
||||
, fId(to_string(fSession.getSessionID()))
|
||||
, fStopOnDestruction(false)
|
||||
{
|
||||
// Sanity check
|
||||
if (!fSession.IsRunning()) {
|
||||
throw std::runtime_error("Given CSession must be running");
|
||||
}
|
||||
}
|
||||
|
||||
~Impl()
|
||||
{
|
||||
if (fStopOnDestruction) {
|
||||
@@ -118,11 +130,15 @@ struct DDSSession::Impl
|
||||
};
|
||||
|
||||
DDSSession::DDSSession(DDSEnvironment env)
|
||||
: fImpl(std::make_shared<Impl>(env))
|
||||
: fImpl(std::make_shared<Impl>(std::move(env)))
|
||||
{}
|
||||
|
||||
DDSSession::DDSSession(Id existing, DDSEnvironment env)
|
||||
: fImpl(std::make_shared<Impl>(std::move(existing), env))
|
||||
: fImpl(std::make_shared<Impl>(std::move(existing), std::move(env)))
|
||||
{}
|
||||
|
||||
DDSSession::DDSSession(dds::tools_api::CSession nativeSession, DDSEnv env)
|
||||
: fImpl(std::make_shared<Impl>(std::move(nativeSession), std::move(env)))
|
||||
{}
|
||||
|
||||
auto DDSSession::GetEnv() const -> DDSEnvironment { return fImpl->fEnv; }
|
||||
|
Reference in New Issue
Block a user