client.h std::ostream printing

This commit is contained in:
Michael Davidsaver
2018-04-10 15:44:18 -07:00
parent 0d40464541
commit 61d43e498d
5 changed files with 90 additions and 0 deletions

View File

@@ -3,6 +3,8 @@
* found in the file LICENSE that is included with the distribution
*/
#include <typeinfo>
#include <epicsMutex.h>
#include <epicsGuard.h>
#include <epicsEvent.h>
@@ -197,6 +199,17 @@ void ClientChannel::removeConnectListener(ConnectCallback* cb)
}
}
void ClientChannel::show(std::ostream& strm) const
{
if(impl) {
strm<<typeid(*impl->channel.get()).name()<<" : ";
impl->channel->printInfo(strm);
} else {
strm<<"NULL Channel";
}
}
static
void register_reftrack()
{
@@ -305,6 +318,43 @@ void ClientProvider::disconnect()
impl->channels.clear();
}
::std::ostream& operator<<(::std::ostream& strm, const Operation& op)
{
if(op.impl) {
op.impl->show(strm);
} else {
strm << "Operation()";
}
return strm;
}
::std::ostream& operator<<(::std::ostream& strm, const ClientChannel& op)
{
if(op.impl) {
strm << "ClientChannel("
<< typeid(*op.impl->channel.get()).name()<<", "
"\"" << op.impl->channel->getChannelName() <<"\", "
"\"" << op.impl->channel->getProvider()->getProviderName() <<"\", "
"connected="<<(op.impl->channel->isConnected()?"true":"false")
<<"\")";
} else {
strm << "ClientChannel()";
}
return strm;
}
::std::ostream& operator<<(::std::ostream& strm, const ClientProvider& op)
{
if(op.impl) {
strm << "ClientProvider("
<< typeid(*op.impl->provider.get()).name()<<", "
"\""<<op.impl->provider->getProviderName()<<"\")";
} else {
strm << "ClientProvider()";
}
return strm;
}
namespace detail {
void registerRefTrack()