client.h default ctor for ClientProvider

Allow an invalid ClientProvider to be created
for later assignment.
This commit is contained in:
Michael Davidsaver
2018-06-04 13:58:22 -07:00
parent c8292caf91
commit 8000ed0637
2 changed files with 6 additions and 0 deletions

View File

@@ -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();
}