From 681297e10b666e13cc463f6fbb16236f36c3266c Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Tue, 12 Jul 2005 22:28:02 +0000 Subject: Reference counting and smart pointers. --- src/messaging/serviceFactory.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'src/messaging/serviceFactory.cpp') diff --git a/src/messaging/serviceFactory.cpp b/src/messaging/serviceFactory.cpp index ea1752dd..a706b0ba 100644 --- a/src/messaging/serviceFactory.cpp +++ b/src/messaging/serviceFactory.cpp @@ -37,11 +37,6 @@ serviceFactory::serviceFactory() serviceFactory::~serviceFactory() { - for (std::vector ::const_iterator it = m_services.begin() ; - it != m_services.end() ; ++it) - { - delete (*it); - } } @@ -52,17 +47,17 @@ serviceFactory* serviceFactory::getInstance() } -service* serviceFactory::create - (session* sess, const string& protocol, authenticator* auth) +ref serviceFactory::create + (ref sess, const string& protocol, ref auth) { return (getServiceByProtocol(protocol)->create(sess, auth)); } -service* serviceFactory::create - (session* sess, const utility::url& u, authenticator* auth) +ref serviceFactory::create + (ref sess, const utility::url& u, ref auth) { - service* serv = create(sess, u.getProtocol(), auth); + ref serv = create(sess, u.getProtocol(), auth); sess->getProperties()[serv->getInfos().getPropertyPrefix() + "server.address"] = u.getHost(); @@ -84,11 +79,11 @@ service* serviceFactory::create } -const serviceFactory::registeredService* serviceFactory::getServiceByProtocol(const string& protocol) const +ref serviceFactory::getServiceByProtocol(const string& protocol) const { const string name(utility::stringUtils::toLower(protocol)); - for (std::vector ::const_iterator it = m_services.begin() ; + for (std::vector >::const_iterator it = m_services.begin() ; it != m_services.end() ; ++it) { if ((*it)->getName() == name) @@ -105,17 +100,17 @@ const int serviceFactory::getServiceCount() const } -const serviceFactory::registeredService* serviceFactory::getServiceAt(const int pos) const +ref serviceFactory::getServiceAt(const int pos) const { return (m_services[pos]); } -const std::vector serviceFactory::getServiceList() const +const std::vector > serviceFactory::getServiceList() const { - std::vector res; + std::vector > res; - for (std::vector ::const_iterator it = m_services.begin() ; + for (std::vector >::const_iterator it = m_services.begin() ; it != m_services.end() ; ++it) { res.push_back(*it); -- cgit v1.2.3