TransportRegistry composed

no need for a seperate allocation and shared_ptr
This commit is contained in:
Michael Davidsaver
2017-05-31 15:48:30 +02:00
parent 3ad27665e8
commit 3fa6a4e4cc
4 changed files with 13 additions and 21 deletions

View File

@@ -37,7 +37,7 @@ public:
Channel::shared_pointer getChannel(pvAccessID id);
Transport::shared_pointer getSearchTransport();
Configuration::const_shared_pointer getConfiguration();
TransportRegistry::shared_pointer getTransportRegistry();
TransportRegistry* getTransportRegistry();
std::map<std::string, std::tr1::shared_ptr<SecurityPlugin> >& getSecurityPlugins();
virtual void newServerDetected();
@@ -203,7 +203,7 @@ private:
* PVA transport (virtual circuit) registry.
* This registry contains all active transports - connections to PVA servers.
*/
TransportRegistry::shared_pointer _transportRegistry;
TransportRegistry _transportRegistry;
/**
* Response handler.

View File

@@ -212,7 +212,6 @@ void ServerContextImpl::initialize()
//osiSockAttach();
_timer.reset(new Timer("pvAccess-server timer", lowerPriority));
_transportRegistry.reset(new TransportRegistry());
ServerContextImpl::shared_pointer thisServerContext = shared_from_this();
_responseHandler.reset(new ServerResponseHandler(thisServerContext));
@@ -284,13 +283,7 @@ void ServerContextImpl::shutdown()
void ServerContextImpl::destroyAllTransports()
{
// not initialized yet
if (!_transportRegistry.get())
{
return;
}
std::auto_ptr<TransportRegistry::transportVector_t> transports = _transportRegistry->toArray();
std::auto_ptr<TransportRegistry::transportVector_t> transports = _transportRegistry.toArray();
if (transports.get() == 0)
return;
@@ -324,7 +317,7 @@ void ServerContextImpl::destroyAllTransports()
}
// now clear all (release)
_transportRegistry->clear();
_transportRegistry.clear();
}
@@ -439,9 +432,9 @@ Timer::shared_pointer ServerContextImpl::getTimer()
return _timer;
}
TransportRegistry::shared_pointer ServerContextImpl::getTransportRegistry()
epics::pvAccess::TransportRegistry* ServerContextImpl::getTransportRegistry()
{
return _transportRegistry;
return &_transportRegistry;
}
Channel::shared_pointer ServerContextImpl::getChannel(pvAccessID /*id*/)