From 8000ed063777b775843ac40bb800ab183614d68c Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 4 Jun 2018 13:58:22 -0700 Subject: [PATCH] client.h default ctor for ClientProvider Allow an invalid ClientProvider to be created for later assignment. --- src/client/client.cpp | 4 ++++ src/client/pva/client.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/client/client.cpp b/src/client/client.cpp index 0770f84..cdb374b 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -282,6 +282,7 @@ ClientProvider::~ClientProvider() {} std::string ClientProvider::name() const { + if(!impl) throw std::logic_error("Dead Provider"); return impl->provider->getProviderName(); } @@ -289,6 +290,7 @@ ClientChannel ClientProvider::connect(const std::string& name, const ClientChannel::Options& conf) { + if(!impl) throw std::logic_error("Dead Provider"); Guard G(impl->mutex); Impl::channels_t::key_type K(name, conf); Impl::channels_t::iterator it(impl->channels.find(K)); @@ -309,6 +311,7 @@ ClientProvider::connect(const std::string& name, bool ClientProvider::disconnect(const std::string& name, const ClientChannel::Options& conf) { + if(!impl) throw std::logic_error("Dead Provider"); Guard G(impl->mutex); Impl::channels_t::iterator it(impl->channels.find(std::make_pair(name, conf))); @@ -320,6 +323,7 @@ bool ClientProvider::disconnect(const std::string& name, void ClientProvider::disconnect() { + if(!impl) throw std::logic_error("Dead Provider"); Guard G(impl->mutex); impl->channels.clear(); } diff --git a/src/client/pva/client.h b/src/client/pva/client.h index 556e5ab..840b90b 100644 --- a/src/client/pva/client.h +++ b/src/client/pva/client.h @@ -475,6 +475,8 @@ class epicsShareClass ClientProvider friend epicsShareFunc ::std::ostream& operator<<(::std::ostream& strm, const ClientProvider& op); public: + //! Construct a null provider. All methods throw. May later be assigned from a valid ClientProvider + ClientProvider() {} /** Use named provider. * * @param providerName ChannelProvider name, may be prefixed with "clients:" or "servers:" to query