From 46df4c07ca9fc2ea62ff3f3c2a6113ce4a0344c3 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 6 Nov 2017 14:55:05 -0600 Subject: [PATCH] cleanup ServerChannelImpl const-ify and remove descriptive comments --- src/server/pv/serverChannelImpl.h | 85 ++++--------------------------- src/server/serverChannelImpl.cpp | 14 +---- 2 files changed, 13 insertions(+), 86 deletions(-) diff --git a/src/server/pv/serverChannelImpl.h b/src/server/pv/serverChannelImpl.h index 836b63c..bce9c3e 100644 --- a/src/server/pv/serverChannelImpl.h +++ b/src/server/pv/serverChannelImpl.h @@ -9,7 +9,6 @@ #include #include -#include #include namespace epics { @@ -33,109 +32,47 @@ public: const ChannelRequester::shared_pointer& requester, pvAccessID cid, pvAccessID sid, ChannelSecuritySession::shared_pointer const & css); - /* - * Destructor. - */ virtual ~ServerChannelImpl(); - /** - * Get local channel. - * @return local channel. - */ const Channel::shared_pointer& getChannel() const { return _channel; } - /** - * Get channel CID. - * @return channel CID. - */ - pvAccessID getCID() const; + pvAccessID getCID() const { return _cid; } - /** - * Get channel SID. - * @return channel SID. - */ virtual pvAccessID getSID() const OVERRIDE FINAL; - /** - * Get ChannelSecuritySession instance. - * @return the ChannelSecuritySession instance. - */ - ChannelSecuritySession::shared_pointer getChannelSecuritySession() const; + ChannelSecuritySession::shared_pointer getChannelSecuritySession() const + { return _channelSecuritySession; } - /** - * Register request - * @param id request ID. - * @param request request to be registered. - */ void registerRequest(pvAccessID id, Destroyable::shared_pointer const & request); - /** - * Unregister request. - * @param id request ID. - */ void unregisterRequest(pvAccessID id); - /** - * Get request by its ID. - * @param id request ID. - * @return request with given ID, null if there is no request with such ID. - */ + //! may return NULL Destroyable::shared_pointer getRequest(pvAccessID id); - /** - * Destroy server channel. - */ virtual void destroy() OVERRIDE FINAL; - /** - * Prints detailed information about the process variable to the standard output stream. - */ - void printInfo(); + void printInfo() const; - /** - * Prints detailed information about the process variable to the specified output - * stream. - * @param fd the output stream. - */ - void printInfo(FILE *fd); + void printInfo(FILE *fd) const; private: /** * Local channel. */ - Channel::shared_pointer _channel; + const Channel::shared_pointer _channel; - ChannelRequester::shared_pointer _requester; + const ChannelRequester::shared_pointer _requester; - /** - * Channel CID. - */ - pvAccessID _cid; - - /** - * Channel SID. - */ - pvAccessID _sid; + const pvAccessID _cid, _sid; typedef std::map _requests_t; - /** - * Requests. - */ _requests_t _requests; - /** - * Destroy state. - */ bool _destroyed; - /** - * Mutex - */ - epics::pvData::Mutex _mutex; + mutable epics::pvData::Mutex _mutex; - /** - * Channel security session. - */ - ChannelSecuritySession::shared_pointer _channelSecuritySession; + const ChannelSecuritySession::shared_pointer _channelSecuritySession; }; } diff --git a/src/server/serverChannelImpl.cpp b/src/server/serverChannelImpl.cpp index fe7ded1..76b5405 100644 --- a/src/server/serverChannelImpl.cpp +++ b/src/server/serverChannelImpl.cpp @@ -34,21 +34,11 @@ ServerChannelImpl::ServerChannelImpl(Channel::shared_pointer const & channel, } } -pvAccessID ServerChannelImpl::getCID() const -{ - return _cid; -} - pvAccessID ServerChannelImpl::getSID() const { return _sid; } -ChannelSecuritySession::shared_pointer ServerChannelImpl::getChannelSecuritySession() const -{ - return _channelSecuritySession; -} - void ServerChannelImpl::registerRequest(const pvAccessID id, Destroyable::shared_pointer const & request) { Lock guard(_mutex); @@ -112,12 +102,12 @@ ServerChannelImpl::~ServerChannelImpl() REFTRACE_DECREMENT(num_instances); } -void ServerChannelImpl::printInfo() +void ServerChannelImpl::printInfo() const { printInfo(stdout); } -void ServerChannelImpl::printInfo(FILE *fd) +void ServerChannelImpl::printInfo(FILE *fd) const { fprintf(fd,"CLASS : %s\n", typeid(*this).name()); fprintf(fd,"CHANNEL : %s\n", typeid(*_channel).name());