diff --git a/src/factory/ChannelAccessFactory.cpp b/src/factory/ChannelAccessFactory.cpp index 05b1e90..4b5ca16 100644 --- a/src/factory/ChannelAccessFactory.cpp +++ b/src/factory/ChannelAccessFactory.cpp @@ -162,7 +162,7 @@ void providerRegInit(void*) { providerRegGbl = new providerRegGbl_t; registerRefCounter("ServerContextImpl", &ServerContextImpl::num_instances); - registerRefCounter("ServerChannelImpl", &ServerChannelImpl::num_instances); + registerRefCounter("ServerChannel", &ServerChannel::num_instances); registerRefCounter("BlockingTCPTransportCodec", &detail::BlockingTCPTransportCodec::num_instances); registerRefCounter("ChannelProvider (ABC)", &ChannelProvider::num_instances); registerRefCounter("Channel (ABC)", &Channel::num_instances); diff --git a/src/remote/codec.cpp b/src/remote/codec.cpp index 413201c..a51b6ba 100644 --- a/src/remote/codec.cpp +++ b/src/remote/codec.cpp @@ -39,6 +39,7 @@ #include #include #include +#include using namespace std; using namespace epics::pvData; diff --git a/src/remote/pv/codec.h b/src/remote/pv/codec.h index e6913bd..156a0cf 100644 --- a/src/remote/pv/codec.h +++ b/src/remote/pv/codec.h @@ -67,6 +67,9 @@ namespace epics { namespace pvAccess { + +class ServerChannel; + namespace detail { #ifdef PVA_CODEC_USE_ATOMIC @@ -540,13 +543,13 @@ public: void registerChannel( pvAccessID sid, - ServerChannel::shared_pointer const & channel); + std::tr1::shared_ptr const & channel); void unregisterChannel(pvAccessID sid); - ServerChannel::shared_pointer getChannel(pvAccessID sid); + std::tr1::shared_ptr getChannel(pvAccessID sid); - void getChannels(std::vector& channels) const; + void getChannels(std::vector >& channels) const; size_t getChannelCount() const; @@ -596,7 +599,7 @@ private: */ pvAccessID _lastChannelSID; - typedef std::map _channels_t; + typedef std::map > _channels_t; /** * Channel table (SID -> channel mapping). */ diff --git a/src/remote/pv/remote.h b/src/remote/pv/remote.h index 3cb00db..4ed36d7 100644 --- a/src/remote/pv/remote.h +++ b/src/remote/pv/remote.h @@ -435,24 +435,6 @@ public: }; -class ServerChannel { -public: - POINTER_DEFINITIONS(ServerChannel); - - virtual ~ServerChannel() {} - /** - * Get channel SID. - * @return channel SID. - */ - virtual pvAccessID getSID() const = 0; - - /** - * Destroy server channel. - * This method MUST BE called if overriden. - */ - virtual void destroy() = 0; -}; - /** * A request that expects an response. * Responses identified by its I/O ID. diff --git a/src/server/baseChannelRequester.cpp b/src/server/baseChannelRequester.cpp index 6bf4d10..cfe3b43 100644 --- a/src/server/baseChannelRequester.cpp +++ b/src/server/baseChannelRequester.cpp @@ -26,7 +26,7 @@ const int32 BaseChannelRequester::NULL_REQUEST = -1; BaseChannelRequester::BaseChannelRequester( ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, + ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport) : _ioid(ioid), diff --git a/src/server/pv/baseChannelRequester.h b/src/server/pv/baseChannelRequester.h index 5dd00d3..30e1103 100644 --- a/src/server/pv/baseChannelRequester.h +++ b/src/server/pv/baseChannelRequester.h @@ -15,10 +15,12 @@ namespace epics { namespace pvAccess { +class ServerChannel; + class BaseChannelRequester : virtual public epics::pvData::Requester, public Destroyable { public: - BaseChannelRequester(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + BaseChannelRequester(ServerContextImpl::shared_pointer const & context, std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport); virtual ~BaseChannelRequester() {}; @@ -41,7 +43,7 @@ public: protected: const pvAccessID _ioid; Transport::shared_pointer _transport; - ServerChannelImpl::shared_pointer _channel; + std::tr1::shared_ptr _channel; epics::pvData::Mutex _mutex; private: ServerContextImpl::shared_pointer _context; diff --git a/src/server/pv/responseHandlers.h b/src/server/pv/responseHandlers.h index d55bede..cae4681 100644 --- a/src/server/pv/responseHandlers.h +++ b/src/server/pv/responseHandlers.h @@ -293,12 +293,12 @@ public: typedef std::tr1::shared_ptr const_shared_pointer; protected: ServerChannelGetRequesterImpl(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport); void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest); public: static ChannelGetRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport, epics::pvData::PVStructure::shared_pointer const & pvRequest); virtual ~ServerChannelGetRequesterImpl() {} @@ -349,12 +349,12 @@ public: typedef std::tr1::shared_ptr const_shared_pointer; protected: ServerChannelPutRequesterImpl(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport); void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest); public: static ChannelPutRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest); virtual ~ServerChannelPutRequesterImpl() {} @@ -403,12 +403,12 @@ public: typedef std::tr1::shared_ptr const_shared_pointer; protected: ServerChannelPutGetRequesterImpl(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport); void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest); public: static ChannelPutGetRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest); virtual ~ServerChannelPutGetRequesterImpl() {} @@ -472,12 +472,12 @@ public: typedef std::tr1::shared_ptr const_shared_pointer; protected: ServerMonitorRequesterImpl(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport); void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest); public: static MonitorRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest); virtual ~ServerMonitorRequesterImpl() {} @@ -525,12 +525,12 @@ public: typedef std::tr1::shared_ptr const_shared_pointer; protected: ServerChannelArrayRequesterImpl(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport); void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest); public: static ChannelArrayRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest); virtual ~ServerChannelArrayRequesterImpl() {} @@ -627,12 +627,12 @@ public: typedef std::tr1::shared_ptr const_shared_pointer; protected: ServerChannelProcessRequesterImpl(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport); void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest); public: static ChannelProcessRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport, epics::pvData::PVStructure::shared_pointer const & pvRequest); virtual ~ServerChannelProcessRequesterImpl() {} @@ -679,7 +679,7 @@ public: typedef std::tr1::shared_ptr const_shared_pointer; ServerGetFieldRequesterImpl(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport); virtual ~ServerGetFieldRequesterImpl() {} @@ -741,12 +741,12 @@ public: typedef std::tr1::shared_ptr const_shared_pointer; protected: ServerChannelRPCRequesterImpl(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport); void activate(epics::pvData::PVStructure::shared_pointer const & pvRequest); public: static ChannelRPCRequester::shared_pointer create(ServerContextImpl::shared_pointer const & context, - ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, + std::tr1::shared_ptr const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,epics::pvData::PVStructure::shared_pointer const & pvRequest); virtual ~ServerChannelRPCRequesterImpl() {} diff --git a/src/server/pv/serverChannelImpl.h b/src/server/pv/serverChannelImpl.h index bce9c3e..d7b5c5c 100644 --- a/src/server/pv/serverChannelImpl.h +++ b/src/server/pv/serverChannelImpl.h @@ -14,10 +14,10 @@ namespace epics { namespace pvAccess { -class ServerChannelImpl : public ServerChannel +class ServerChannel { public: - POINTER_DEFINITIONS(ServerChannelImpl); + POINTER_DEFINITIONS(ServerChannel); static size_t num_instances; @@ -28,17 +28,17 @@ public: * @param sid channel SID. * @param css channel security session. */ - ServerChannelImpl(Channel::shared_pointer const & channel, + ServerChannel(Channel::shared_pointer const & channel, const ChannelRequester::shared_pointer& requester, pvAccessID cid, pvAccessID sid, ChannelSecuritySession::shared_pointer const & css); - virtual ~ServerChannelImpl(); + ~ServerChannel(); const Channel::shared_pointer& getChannel() const { return _channel; } pvAccessID getCID() const { return _cid; } - virtual pvAccessID getSID() const OVERRIDE FINAL; + pvAccessID getSID() const { return _sid; } ChannelSecuritySession::shared_pointer getChannelSecuritySession() const { return _channelSecuritySession; } @@ -50,7 +50,7 @@ public: //! may return NULL Destroyable::shared_pointer getRequest(pvAccessID id); - virtual void destroy() OVERRIDE FINAL; + void destroy(); void printInfo() const; diff --git a/src/server/responseHandlers.cpp b/src/server/responseHandlers.cpp index 58ac17a..e5a4222 100644 --- a/src/server/responseHandlers.cpp +++ b/src/server/responseHandlers.cpp @@ -813,7 +813,7 @@ void ServerChannelRequesterImpl::channelCreated(const Status& status, Channel::s pvAccessID sid = transport->preallocateChannelSID(); try { - serverChannel.reset(new ServerChannelImpl(channel, shared_from_this(), _cid, sid, _css)); + serverChannel.reset(new ServerChannel(channel, shared_from_this(), _cid, sid, _css)); // ack allocation and register transport->registerChannel(sid, serverChannel); @@ -877,10 +877,10 @@ void ServerChannelRequesterImpl::channelStateChange(Channel::shared_pointer cons if(detail::BlockingServerTCPTransportCodec::shared_pointer transport = _transport.lock()) { - ServerChannelImpl::shared_pointer channel; + ServerChannel::shared_pointer channel; { Lock guard(_mutex); - channel= dynamic_pointer_cast(_serverChannel.lock()); + channel= dynamic_pointer_cast(_serverChannel.lock()); } if (!channel) @@ -938,7 +938,7 @@ void ServerChannelRequesterImpl::send(ByteBuffer* buffer, TransportSendControl* // OK else { - ServerChannelImpl::shared_pointer serverChannelImpl = dynamic_pointer_cast(serverChannel); + ServerChannel::shared_pointer serverChannelImpl = dynamic_pointer_cast(serverChannel); control->startMessage((int8)CMD_CREATE_CHANNEL, 2*sizeof(int32)/sizeof(int8)); buffer->putInt(serverChannelImpl->getCID()); buffer->putInt(serverChannelImpl->getSID()); @@ -965,7 +965,7 @@ void ServerDestroyChannelHandler::handleResponse(osiSockAddr* responseFrom, const pvAccessID cid = payloadBuffer->getInt(); // get channel by SID - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (channel.get() == NULL) { if (!transport->isClosed()) @@ -1007,7 +1007,7 @@ void ServerGetHandler::handleResponse(osiSockAddr* responseFrom, // mode const int8 qosCode = payloadBuffer->getByte(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (channel.get() == NULL) { BaseChannelRequester::sendFailureMessage((int8)CMD_GET, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus); @@ -1095,13 +1095,13 @@ void ServerGetHandler::handleResponse(osiSockAddr* responseFrom, throw; \ } -ServerChannelGetRequesterImpl::ServerChannelGetRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport) : +ServerChannelGetRequesterImpl::ServerChannelGetRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport) : BaseChannelRequester(context, channel, ioid, transport) { } -ChannelGetRequester::shared_pointer ServerChannelGetRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport, +ChannelGetRequester::shared_pointer ServerChannelGetRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport, PVStructure::shared_pointer const & pvRequest) { // TODO use std::make_shared @@ -1262,7 +1262,7 @@ void ServerPutHandler::handleResponse(osiSockAddr* responseFrom, // mode const int8 qosCode = payloadBuffer->getByte(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (!channel.get()) { BaseChannelRequester::sendFailureMessage((int8)CMD_PUT, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus); @@ -1355,13 +1355,13 @@ void ServerPutHandler::handleResponse(osiSockAddr* responseFrom, } } -ServerChannelPutRequesterImpl::ServerChannelPutRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, +ServerChannelPutRequesterImpl::ServerChannelPutRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport): BaseChannelRequester(context, channel, ioid, transport) { } -ChannelPutRequester::shared_pointer ServerChannelPutRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, +ChannelPutRequester::shared_pointer ServerChannelPutRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport, PVStructure::shared_pointer const & pvRequest) { // TODO use std::make_shared @@ -1532,7 +1532,7 @@ void ServerPutGetHandler::handleResponse(osiSockAddr* responseFrom, // mode const int8 qosCode = payloadBuffer->getByte(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (!channel.get()) { BaseChannelRequester::sendFailureMessage((int8)CMD_PUT_GET, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus); @@ -1638,13 +1638,13 @@ void ServerPutGetHandler::handleResponse(osiSockAddr* responseFrom, } } -ServerChannelPutGetRequesterImpl::ServerChannelPutGetRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, +ServerChannelPutGetRequesterImpl::ServerChannelPutGetRequesterImpl(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport): BaseChannelRequester(context, channel, ioid, transport), _channelPutGet(), _pvPutStructure(), _pvGetStructure() { } -ChannelPutGetRequester::shared_pointer ServerChannelPutGetRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, +ChannelPutGetRequester::shared_pointer ServerChannelPutGetRequesterImpl::create(ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,PVStructure::shared_pointer const & pvRequest) { // TODO use std::make_shared @@ -1856,7 +1856,7 @@ void ServerMonitorHandler::handleResponse(osiSockAddr* responseFrom, // mode const int8 qosCode = payloadBuffer->getByte(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (!channel.get()) { BaseChannelRequester::sendFailureMessage((int8)CMD_MONITOR, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus); @@ -1953,14 +1953,14 @@ void ServerMonitorHandler::handleResponse(osiSockAddr* responseFrom, } ServerMonitorRequesterImpl::ServerMonitorRequesterImpl( - ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport): BaseChannelRequester(context, channel, ioid, transport), _channelMonitor(), _structure(), _unlisten(false) { } MonitorRequester::shared_pointer ServerMonitorRequesterImpl::create( - ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,PVStructure::shared_pointer const & pvRequest) { // TODO use std::make_shared @@ -2150,7 +2150,7 @@ void ServerArrayHandler::handleResponse(osiSockAddr* responseFrom, // mode const int8 qosCode = payloadBuffer->getByte(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (!channel.get()) { BaseChannelRequester::sendFailureMessage((int8)CMD_ARRAY, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus); @@ -2278,14 +2278,14 @@ void ServerArrayHandler::handleResponse(osiSockAddr* responseFrom, } ServerChannelArrayRequesterImpl::ServerChannelArrayRequesterImpl( - ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport): BaseChannelRequester(context, channel, ioid, transport) { } ChannelArrayRequester::shared_pointer ServerChannelArrayRequesterImpl::create( - ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,PVStructure::shared_pointer const & pvRequest) { // TODO use std::make_shared @@ -2479,7 +2479,7 @@ void ServerDestroyRequestHandler::handleResponse(osiSockAddr* responseFrom, const pvAccessID sid = payloadBuffer->getInt(); const pvAccessID ioid = payloadBuffer->getInt(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (!channel.get()) { failureResponse(transport, ioid, BaseChannelRequester::badCIDStatus); @@ -2519,7 +2519,7 @@ void ServerCancelRequestHandler::handleResponse(osiSockAddr* responseFrom, const pvAccessID sid = payloadBuffer->getInt(); const pvAccessID ioid = payloadBuffer->getInt(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (!channel.get()) { failureResponse(transport, ioid, BaseChannelRequester::badCIDStatus); @@ -2567,7 +2567,7 @@ void ServerProcessHandler::handleResponse(osiSockAddr* responseFrom, // mode const int8 qosCode = payloadBuffer->getByte(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (!channel.get()) { BaseChannelRequester::sendFailureMessage((int8)CMD_PROCESS, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus); @@ -2626,14 +2626,14 @@ void ServerProcessHandler::handleResponse(osiSockAddr* responseFrom, } ServerChannelProcessRequesterImpl::ServerChannelProcessRequesterImpl( - ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport): BaseChannelRequester(context, channel, ioid, transport), _channelProcess() { } ChannelProcessRequester::shared_pointer ServerChannelProcessRequesterImpl::create( - ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport,PVStructure::shared_pointer const & pvRequest) { // TODO use std::make_shared @@ -2744,7 +2744,7 @@ void ServerGetFieldHandler::handleResponse(osiSockAddr* responseFrom, const pvAccessID sid = payloadBuffer->getInt(); const pvAccessID ioid = payloadBuffer->getInt(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (!channel.get()) { getFieldFailureResponse(transport, ioid, BaseChannelRequester::badCIDStatus); @@ -2777,7 +2777,7 @@ void ServerGetFieldHandler::getFieldFailureResponse(Transport::shared_pointer co } ServerGetFieldRequesterImpl::ServerGetFieldRequesterImpl( - ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport) : BaseChannelRequester(context, channel, ioid, transport), _field() { @@ -2827,7 +2827,7 @@ void ServerRPCHandler::handleResponse(osiSockAddr* responseFrom, // mode const int8 qosCode = payloadBuffer->getByte(); - ServerChannelImpl::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); + ServerChannel::shared_pointer channel = static_pointer_cast(casTransport->getChannel(sid)); if (!channel.get()) { BaseChannelRequester::sendFailureMessage((int8)CMD_RPC, transport, ioid, qosCode, BaseChannelRequester::badCIDStatus); @@ -2895,7 +2895,7 @@ void ServerRPCHandler::handleResponse(osiSockAddr* responseFrom, } ServerChannelRPCRequesterImpl::ServerChannelRPCRequesterImpl( - ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport): BaseChannelRequester(context, channel, ioid, transport), _channelRPC(), _pvResponse() @@ -2904,7 +2904,7 @@ ServerChannelRPCRequesterImpl::ServerChannelRPCRequesterImpl( } ChannelRPCRequester::shared_pointer ServerChannelRPCRequesterImpl::create( - ServerContextImpl::shared_pointer const & context, ServerChannelImpl::shared_pointer const & channel, + ServerContextImpl::shared_pointer const & context, ServerChannel::shared_pointer const & channel, const pvAccessID ioid, Transport::shared_pointer const & transport, PVStructure::shared_pointer const & pvRequest) { // TODO use std::make_shared diff --git a/src/server/serverChannelImpl.cpp b/src/server/serverChannelImpl.cpp index 76b5405..5ef7295 100644 --- a/src/server/serverChannelImpl.cpp +++ b/src/server/serverChannelImpl.cpp @@ -14,12 +14,12 @@ using namespace epics::pvData; namespace epics { namespace pvAccess { -size_t ServerChannelImpl::num_instances; +size_t ServerChannel::num_instances; -ServerChannelImpl::ServerChannelImpl(Channel::shared_pointer const & channel, - const ChannelRequester::shared_pointer &requester, - pvAccessID cid, pvAccessID sid, - ChannelSecuritySession::shared_pointer const & css): +ServerChannel::ServerChannel(Channel::shared_pointer const & channel, + const ChannelRequester::shared_pointer &requester, + pvAccessID cid, pvAccessID sid, + ChannelSecuritySession::shared_pointer const & css): _channel(channel), _requester(requester), _cid(cid), @@ -34,19 +34,14 @@ ServerChannelImpl::ServerChannelImpl(Channel::shared_pointer const & channel, } } -pvAccessID ServerChannelImpl::getSID() const -{ - return _sid; -} - -void ServerChannelImpl::registerRequest(const pvAccessID id, Destroyable::shared_pointer const & request) +void ServerChannel::registerRequest(const pvAccessID id, Destroyable::shared_pointer const & request) { Lock guard(_mutex); if(_destroyed) throw std::logic_error("Can't registerRequest() for destory'd server channel"); _requests[id] = request; } -void ServerChannelImpl::unregisterRequest(const pvAccessID id) +void ServerChannel::unregisterRequest(const pvAccessID id) { Lock guard(_mutex); _requests_t::iterator iter = _requests.find(id); @@ -56,7 +51,7 @@ void ServerChannelImpl::unregisterRequest(const pvAccessID id) } } -Destroyable::shared_pointer ServerChannelImpl::getRequest(const pvAccessID id) +Destroyable::shared_pointer ServerChannel::getRequest(const pvAccessID id) { Lock guard(_mutex); _requests_t::iterator iter = _requests.find(id); @@ -67,7 +62,7 @@ Destroyable::shared_pointer ServerChannelImpl::getRequest(const pvAccessID id) return Destroyable::shared_pointer(); } -void ServerChannelImpl::destroy() +void ServerChannel::destroy() { Lock guard(_mutex); @@ -96,18 +91,18 @@ void ServerChannelImpl::destroy() _channel->destroy(); } -ServerChannelImpl::~ServerChannelImpl() +ServerChannel::~ServerChannel() { destroy(); REFTRACE_DECREMENT(num_instances); } -void ServerChannelImpl::printInfo() const +void ServerChannel::printInfo() const { printInfo(stdout); } -void ServerChannelImpl::printInfo(FILE *fd) const +void ServerChannel::printInfo(FILE *fd) const { fprintf(fd,"CLASS : %s\n", typeid(*this).name()); fprintf(fd,"CHANNEL : %s\n", typeid(*_channel).name()); diff --git a/src/server/serverContext.cpp b/src/server/serverContext.cpp index c7e29fc..9db0871 100644 --- a/src/server/serverContext.cpp +++ b/src/server/serverContext.cpp @@ -465,7 +465,7 @@ void ServerContextImpl::printInfo(ostream& str, int lvl) for(channels_t::const_iterator it(channels.begin()), end(channels.end()); it!=end; ++it) { - const ServerChannelImpl *channel(static_cast(it->get())); + const ServerChannel *channel(static_cast(it->get())); const Channel::shared_pointer& providerChan(channel->getChannel()); if(!providerChan) continue;