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

@@ -323,7 +323,7 @@ public:
virtual epics::pvData::Timer::shared_pointer getTimer() = 0;
//virtual TransportRegistry::shared_pointer getTransportRegistry() = 0;
virtual std::tr1::shared_ptr<TransportRegistry> getTransportRegistry() = 0;
virtual TransportRegistry* getTransportRegistry() = 0;

View File

@@ -4313,9 +4313,9 @@ public:
return m_timer;
}
virtual TransportRegistry::shared_pointer getTransportRegistry()
virtual TransportRegistry* getTransportRegistry()
{
return m_transportRegistry;
return &m_transportRegistry;
}
virtual Transport::shared_pointer getSearchTransport()
@@ -4422,7 +4422,6 @@ private:
m_timer.reset(new Timer("pvAccess-client timer", lowPriority));
Context::shared_pointer thisPointer = shared_from_this();
m_connector.reset(new BlockingTCPConnector(thisPointer, m_receiveBufferSize, m_connectionTimeout));
m_transportRegistry.reset(new TransportRegistry());
m_responseHandler.reset(new ClientResponseHandler(shared_from_this()));
@@ -4489,7 +4488,7 @@ private:
// wait for all transports to cleanly exit
int tries = 40;
epics::pvData::int32 transportCount;
while ((transportCount = m_transportRegistry->numberOfActiveTransports()) && tries--)
while ((transportCount = m_transportRegistry.numberOfActiveTransports()) && tries--)
epicsThreadSleep(0.025);
if (transportCount)
@@ -4790,7 +4789,7 @@ private:
virtual void configure(epics::pvData::PVStructure::shared_pointer configuration)
{ // remove?
if (m_transportRegistry->numberOfActiveTransports() > 0)
if (m_transportRegistry.numberOfActiveTransports() > 0)
throw std::runtime_error("Configure must be called when there is no transports active.");
PVInt::shared_pointer pvStrategy = dynamic_pointer_cast<PVInt>(configuration->getSubField("strategy"));
@@ -4814,7 +4813,7 @@ private:
virtual void flush()
{
m_transportRegistry->toArray(m_flushTransports);
m_transportRegistry.toArray(m_flushTransports);
TransportRegistry::transportVector_t::const_iterator iter = m_flushTransports.begin();
while (iter != m_flushTransports.end())
(*iter++)->flushSendQueue();
@@ -4897,7 +4896,7 @@ private:
* PVA transport (virtual circuit) registry.
* This registry contains all active transports - connections to PVA servers.
*/
TransportRegistry::shared_pointer m_transportRegistry;
TransportRegistry m_transportRegistry;
/**
* Response handler.

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*/)