Commit 5c0c9121 authored by Flavien BRIDAULT-LOUCHEZ's avatar Flavien BRIDAULT-LOUCHEZ
Browse files

Removed SigSlotConnection::sptr. This was a nonsense to use a shared pointer on

such a small helper class.

--HG--
branch : fw4spl_0.11.0
parent 4fd7c4a3
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2015.
* FW4SPL - Copyright (C) IRCAD, 2009-2016.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -14,7 +14,6 @@
#include <fwData/Image.hpp>
#include <fwServices/IService.hpp>
#include <fwServices/helper/SigSlotConnection.hpp>
#include "Tuto02DataServiceBasicCtrl/config.hpp"
......@@ -23,7 +22,6 @@ namespace Tuto02DataServiceBasicCtrl
/**
* @brief This class is started when the bundles is loaded.
* @class Plugin
*/
class TUTO02DATASERVICEBASICCTRL_CLASS_API Plugin : public ::fwRuntime::Plugin
{
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2015.
* FW4SPL - Copyright (C) IRCAD, 2009-2016.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -17,11 +17,8 @@ namespace ctrlSelection
{
/**
* @class IManagerSrv
* @brief Base class for manager.
* A manager starts, stops or swaps services on object contained in a composite when it receives specific message.
*
* @date 2007-2009.
*/
class CTRLSELECTION_CLASS_API IManagerSrv : public ::fwServices::IService
{
......@@ -46,7 +43,7 @@ protected:
*/
CTRLSELECTION_API virtual void swapping() throw ( ::fwTools::Failed );
typedef std::map< ObjectIdType, ::fwServices::helper::SigSlotConnection::sptr > ObjectConnectionsMapType;
typedef std::map< ObjectIdType, ::fwServices::helper::SigSlotConnection > ObjectConnectionsMapType;
/**
* @brief Manages all connections define in config associated to object.
......@@ -56,7 +53,7 @@ protected:
* @param object Object associated with the id
* @param config configuration for this object
*/
void manageConnections(const std::string &objectId, ::fwData::Object::sptr object, ConfigurationType config);
void manageConnections(const std::string& objectId, ::fwData::Object::sptr object, ConfigurationType config);
/**
* @brief Manages a connection define in config associated to object.
......@@ -65,10 +62,10 @@ protected:
* @param object Object associated with the id
* @param config configuration for a \<connect\> tag associated this object
*/
void manageConnection(const std::string &objectId, ::fwData::Object::sptr object, ConfigurationType config);
void manageConnection(const std::string& objectId, ::fwData::Object::sptr object, ConfigurationType config);
/// Disconnects all registred connection for objectId.
void removeConnections(const std::string &objectId);
void removeConnections(const std::string& objectId);
/**
* @brief Manages all proxies connections define in config associated to object
......@@ -78,10 +75,10 @@ protected:
* @param object Object associated with the id
* @param config configuration for this object
*/
void manageProxies(const std::string &objectId, ::fwData::Object::sptr object, ConfigurationType config);
void manageProxies(const std::string& objectId, ::fwData::Object::sptr object, ConfigurationType config);
/// Disconnects all proxies associated to objectId;
void disconnectProxies(const std::string &objectId);
void disconnectProxies(const std::string& objectId);
/// Registers connection associated to an object. Connections are connected/disconnected when the object is added/removed.
ObjectConnectionsMapType m_objectConnections;
......
......@@ -21,7 +21,6 @@ namespace manager
{
/**
* @class SField
* @brief This services is a manager which starts, stops or swaps services on field contained in a composite when
* it receive specific message (mainly sent by updater).
*/
......@@ -100,7 +99,7 @@ protected:
CTRLSELECTION_API virtual void updating() throw ( ::fwTools::Failed );
/// Implements info method derived from IService. Print classname.
CTRLSELECTION_API virtual void info( std::ostream &_sstream );
CTRLSELECTION_API virtual void info( std::ostream& _sstream );
typedef ::fwRuntime::ConfigurationElement::sptr ConfigurationType;
typedef ::fwData::Object::FieldNameType FieldNameType;
......@@ -125,7 +124,7 @@ protected:
::fwData::Object::sptr m_dummy;
ConfigurationType m_config;
WPTR(::fwServices::IService) m_service;
::fwServices::helper::SigSlotConnection::sptr m_connections;
::fwServices::helper::SigSlotConnection m_connections;
bool m_hasAutoConnection;
};
......
......@@ -24,7 +24,6 @@ namespace manager
{
/**
* @class SwapperSrv
* @brief This services is a manager which starts, stops or swaps services on object contained in a composite when
* it receive specific message (mainly sent by updater).
*/
......@@ -117,7 +116,7 @@ protected:
CTRLSELECTION_API virtual void updating() throw ( ::fwTools::Failed );
/// Implements info method derived from IService. Print classname.
CTRLSELECTION_API virtual void info( std::ostream &_sstream );
CTRLSELECTION_API virtual void info( std::ostream& _sstream );
typedef ::fwRuntime::ConfigurationElement::sptr ConfigurationType;
typedef std::string ObjectIdType;
......@@ -143,7 +142,7 @@ protected:
::fwData::Object::sptr m_dummy;
ConfigurationType m_config;
WPTR(::fwServices::IService) m_service;
::fwServices::helper::SigSlotConnection::sptr m_connections;
::fwServices::helper::SigSlotConnection m_connections;
bool m_hasAutoConnection;
};
......@@ -160,9 +159,9 @@ protected:
void removeObjects(::fwData::Composite::ContainerType objects);
void initOnDummyObject( std::string objectId );
void addObject( const std::string &objectId, ::fwData::Object::sptr object );
void changeObject(const std::string &objectId, ::fwData::Object::sptr object);
void removeObject( const std::string &objectId );
void addObject( const std::string& objectId, ::fwData::Object::sptr object );
void changeObject(const std::string& objectId, ::fwData::Object::sptr object);
void removeObject( const std::string& objectId );
::fwServices::IService::sptr add( ::fwData::Object::sptr obj, ::fwRuntime::ConfigurationElement::sptr _elt );
......
......@@ -19,7 +19,6 @@ namespace updater
{
/**
* @class STranslate
* @brief Update the composite related to this service according to the receiving composite signals and translate the
* composite keys.
*/
......@@ -79,7 +78,7 @@ protected:
CTRLSELECTION_API virtual void updating() throw ( ::fwTools::Failed );
/// Implements info method derived from IService. Print classname.
CTRLSELECTION_API virtual void info( std::ostream &_sstream );
CTRLSELECTION_API virtual void info( std::ostream& _sstream );
private:
......@@ -104,7 +103,7 @@ private:
::fwData::Composite::wptr m_source;
/// Connection to source
::fwServices::helper::SigSlotConnection::sptr m_connection;
::fwServices::helper::SigSlotConnection m_connections;
};
} // updater
......
......@@ -106,7 +106,7 @@ private:
*/
/// store connection from source image to this service.
::fwServices::helper::SigSlotConnection::sptr m_connections;
::fwServices::helper::SigSlotConnection m_connections;
std::string m_sourceImageUid; ///< fwID of the source image;
std::string m_sourceCompoUid; ///< fwID of the composite containing the source image
......
/* ***** BEGIN LICENSE BLOCK *****
* FW4SPL - Copyright (C) IRCAD, 2009-2015.
* FW4SPL - Copyright (C) IRCAD, 2009-2016.
* Distributed under the terms of the GNU Lesser General Public License (LGPL) as
* published by the Free Software Foundation.
* ****** END LICENSE BLOCK ****** */
......@@ -36,7 +36,7 @@ void IManagerSrv::swapping() throw ( ::fwTools::Failed )
//-----------------------------------------------------------------------------
void IManagerSrv::manageConnections(const std::string &objectId, ::fwData::Object::sptr object,
void IManagerSrv::manageConnections(const std::string& objectId, ::fwData::Object::sptr object,
ConfigurationType config)
{
for(ConfigurationType connectCfg : config->find("connect"))
......@@ -47,39 +47,27 @@ void IManagerSrv::manageConnections(const std::string &objectId, ::fwData::Objec
//-----------------------------------------------------------------------------
void IManagerSrv::manageConnection(const std::string &objectId, ::fwData::Object::sptr object, ConfigurationType config)
void IManagerSrv::manageConnection(const std::string& objectId, ::fwData::Object::sptr object, ConfigurationType config)
{
::fwServices::helper::SigSlotConnection::sptr connection;
ObjectConnectionsMapType::iterator iter = m_objectConnections.find(objectId);
if (iter != m_objectConnections.end())
{
connection = iter->second;
}
else
{
connection = ::fwServices::helper::SigSlotConnection::New();
m_objectConnections[objectId] = connection;
}
::fwServices::helper::Config::createConnections(config, connection, object);
::fwServices::helper::Config::createConnections(config, m_objectConnections[objectId], object);
}
//-----------------------------------------------------------------------------
void IManagerSrv::removeConnections(const std::string &objectId)
void IManagerSrv::removeConnections(const std::string& objectId)
{
ObjectConnectionsMapType::iterator iter = m_objectConnections.find(objectId);
if (iter != m_objectConnections.end())
{
::fwServices::helper::SigSlotConnection::sptr connection = iter->second;
connection->disconnect();
::fwServices::helper::SigSlotConnection& connection = iter->second;
connection.disconnect();
}
m_objectConnections.erase(objectId);
}
//-----------------------------------------------------------------------------
void IManagerSrv::manageProxies(const std::string &objectId, ::fwData::Object::sptr object, ConfigurationType config)
void IManagerSrv::manageProxies(const std::string& objectId, ::fwData::Object::sptr object, ConfigurationType config)
{
for(ConfigurationType proxyCfg : config->find("proxy"))
{
......@@ -89,7 +77,7 @@ void IManagerSrv::manageProxies(const std::string &objectId, ::fwData::Object::s
//-----------------------------------------------------------------------------
void IManagerSrv::disconnectProxies(const std::string &objectId)
void IManagerSrv::disconnectProxies(const std::string& objectId)
{
::fwServices::helper::Config::disconnectProxies(objectId, m_proxyCtns);
}
......
......@@ -67,7 +67,7 @@ void SField::updating() throw ( ::fwTools::Failed )
//-----------------------------------------------------------------------------
void SField::info( std::ostream &_sstream )
void SField::info( std::ostream& _sstream )
{
}
......@@ -86,7 +86,7 @@ void SField::stopping() throw ( ::fwTools::Failed )
if( subSrv->m_hasAutoConnection )
{
subSrv->m_connections->disconnect();
subSrv->m_connections.disconnect();
}
subSrv->getService()->stop().wait();
::fwServices::OSR::unregisterService(subSrv->getService());
......@@ -245,11 +245,7 @@ void SField::addField( const FieldNameType& fieldName, ::fwData::Object::sptr fi
if ( cfg->getAttributeValue("autoConnect") == "yes" )
{
subSrv->m_hasAutoConnection = true;
if (!subSrv->m_connections)
{
subSrv->m_connections = ::fwServices::helper::SigSlotConnection::New();
}
subSrv->m_connections->connect( field, srv, srv->getObjSrvConnections() );
subSrv->m_connections.connect( field, srv, srv->getObjSrvConnections() );
}
......@@ -318,9 +314,9 @@ void SField::swapField(const FieldNameType& fieldName, ::fwData::Object::sptr fi
if (subSrv->m_hasAutoConnection)
{
subSrv->m_connections->disconnect();
subSrv->m_connections->connect( field, subSrv->getService(),
subSrv->getService()->getObjSrvConnections() );
subSrv->m_connections.disconnect();
subSrv->m_connections.connect( field, subSrv->getService(),
subSrv->getService()->getObjSrvConnections() );
}
}
else
......@@ -374,7 +370,7 @@ void SField::removeField( const FieldNameType& fieldName )
{
if( subSrv->m_hasAutoConnection )
{
subSrv->m_connections->disconnect();
subSrv->m_connections.disconnect();
}
subSrv->getService()->stop();
......@@ -437,7 +433,6 @@ void SField::initOnDummyObject( const FieldNameType& fieldName )
if ( cfg->getAttributeValue("autoConnect") == "yes" )
{
subSrv->m_hasAutoConnection = true;
subSrv->m_connections = ::fwServices::helper::SigSlotConnection::New();
}
}
m_fieldsSubServices[fieldName] = subVecSrv;
......
......@@ -69,7 +69,7 @@ void SwapperSrv::updating() throw ( ::fwTools::Failed )
//-----------------------------------------------------------------------------
void SwapperSrv::info( std::ostream &_sstream )
void SwapperSrv::info( std::ostream& _sstream )
{
}
......@@ -101,7 +101,7 @@ void SwapperSrv::stopping() throw ( ::fwTools::Failed )
if( subSrv->m_hasAutoConnection )
{
subSrv->m_connections->disconnect();
subSrv->m_connections.disconnect();
}
subSrv->getService()->stop().wait();
::fwServices::OSR::unregisterService(subSrv->getService());
......@@ -222,7 +222,7 @@ void SwapperSrv::addObjects(::fwData::Composite::ContainerType objects)
//-----------------------------------------------------------------------------
void SwapperSrv::addObject( const std::string &objectId, ::fwData::Object::sptr object )
void SwapperSrv::addObject( const std::string& objectId, ::fwData::Object::sptr object )
{
if(!m_managerConfiguration->find("object", "id", objectId).empty())
{
......@@ -246,11 +246,7 @@ void SwapperSrv::addObject( const std::string &objectId, ::fwData::Object::sptr
if ( cfg->getAttributeValue("autoConnect") == "yes" )
{
subSrv->m_hasAutoConnection = true;
if (!subSrv->m_connections)
{
subSrv->m_connections = ::fwServices::helper::SigSlotConnection::New();
}
subSrv->m_connections->connect( object, srv, srv->getObjSrvConnections() );
subSrv->m_connections.connect( object, srv, srv->getObjSrvConnections() );
}
std::string workerKey = cfg->getAttributeValue("worker");
......@@ -300,7 +296,7 @@ void SwapperSrv::changeObjects(::fwData::Composite::ContainerType newObjects,
//-----------------------------------------------------------------------------
void SwapperSrv::changeObject(const std::string &objectId, ::fwData::Object::sptr object)
void SwapperSrv::changeObject(const std::string& objectId, ::fwData::Object::sptr object)
{
std::vector< ConfigurationType > confVec = m_managerConfiguration->find("object", "id", objectId);
for( ConfigurationType cfg : confVec )
......@@ -322,9 +318,9 @@ void SwapperSrv::changeObject(const std::string &objectId, ::fwData::Object::spt
if (subSrv->m_hasAutoConnection)
{
subSrv->m_connections->disconnect();
subSrv->m_connections->connect( object, subSrv->getService(),
subSrv->getService()->getObjSrvConnections() );
subSrv->m_connections.disconnect();
subSrv->m_connections.connect( object, subSrv->getService(),
subSrv->getService()->getObjSrvConnections() );
}
}
else
......@@ -353,7 +349,7 @@ void SwapperSrv::removeObjects( ::fwData::Composite::ContainerType objects )
//-----------------------------------------------------------------------------
void SwapperSrv::removeObject( const std::string &objectId )
void SwapperSrv::removeObject( const std::string& objectId )
{
if(!m_managerConfiguration->find("object", "id", objectId).empty())
{
......@@ -373,7 +369,7 @@ void SwapperSrv::removeObject( const std::string &objectId )
if (subSrv->m_hasAutoConnection)
{
subSrv->m_connections->disconnect();
subSrv->m_connections.disconnect();
}
if(m_dummyStopMode)
{
......@@ -438,7 +434,6 @@ void SwapperSrv::initOnDummyObject( std::string objectId )
if ( cfg->getAttributeValue("autoConnect") == "yes" )
{
subSrv->m_hasAutoConnection = true;
subSrv->m_connections = ::fwServices::helper::SigSlotConnection::New();
}
subVecSrv.push_back(subSrv);
......
......@@ -57,20 +57,18 @@ void STranslate::starting() throw ( ::fwTools::Failed )
{
::fwData::Composite::sptr composite = this->getObject< ::fwData::Composite >();
m_connection = ::fwServices::helper::SigSlotConnection::New();
if (!m_sourceCompositeID.empty())
{
::fwData::Composite::sptr source;
source = ::fwData::Composite::dynamicCast(::fwTools::fwID::getObject(m_sourceCompositeID));
SLM_ASSERT("Source composite is missing '" + m_sourceCompositeID + "'", source);
m_connection->connect(source, this->getSptr(), this->getObjSrvConnections() );
m_connections.connect(source, this->getSptr(), this->getObjSrvConnections() );
for( const ManagedTranslations::value_type & trans : m_managedTranslations )
for( const ManagedTranslations::value_type& trans : m_managedTranslations )
{
const std::string &fromKey = trans.first;
const std::string &toKey = trans.second;
const std::string& fromKey = trans.first;
const std::string& toKey = trans.second;
::fwData::Composite::const_iterator iter = source->find(fromKey);
if (iter != source->end())
......@@ -85,8 +83,7 @@ void STranslate::starting() throw ( ::fwTools::Failed )
void STranslate::stopping() throw ( ::fwTools::Failed )
{
m_connection->disconnect();
m_connection.reset();
m_connections.disconnect();
}
//-----------------------------------------------------------------------------
......@@ -97,7 +94,7 @@ void STranslate::configuring() throw ( ::fwTools::Failed )
if (conf.count("source"))
{
const ::fwServices::IService::ConfigType & sourceCfg = conf.get_child("source");
const ::fwServices::IService::ConfigType& sourceCfg = conf.get_child("source");
m_sourceCompositeID = sourceCfg.get_value<std::string>();
SLM_ASSERT("Source composite is not defined", !m_sourceCompositeID.empty());
}
......@@ -109,7 +106,7 @@ void STranslate::configuring() throw ( ::fwTools::Failed )
m_managedTranslations.clear();
BOOST_FOREACH( const ::fwServices::IService::ConfigType::value_type &v, conf.equal_range("translate") )
{
const ::fwServices::IService::ConfigType &translate = v.second;
const ::fwServices::IService::ConfigType& translate = v.second;
const ::fwServices::IService::ConfigType xmlattr = translate.get_child("<xmlattr>");
SLM_FATAL_IF( "The attribute \"fromKey\" is missing, it represents the key of the object in the source "
......@@ -142,7 +139,7 @@ void STranslate::updating() throw ( ::fwTools::Failed )
//-----------------------------------------------------------------------------
void STranslate::info( std::ostream &_sstream )
void STranslate::info( std::ostream& _sstream )
{
}
......@@ -153,8 +150,8 @@ void STranslate::addObjects(::fwData::Composite::ContainerType objects)
::fwData::Composite::sptr composite = this->getObject< ::fwData::Composite >();
for ( ManagedTranslations::value_type elt : m_managedTranslations )
{
const std::string &fromKey = elt.first;
const std::string &toKey = elt.second;
const std::string& fromKey = elt.first;
const std::string& toKey = elt.second;
::fwData::Composite::ContainerType::iterator iter = objects.find(fromKey);
if (iter != objects.end())
......@@ -173,8 +170,8 @@ void STranslate::changeObjects(::fwData::Composite::ContainerType newObjects,
::fwData::Composite::sptr composite = this->getObject< ::fwData::Composite >();
for ( ManagedTranslations::value_type elt : m_managedTranslations )
{
const std::string &fromKey = elt.first;
const std::string &toKey = elt.second;
const std::string& fromKey = elt.first;
const std::string& toKey = elt.second;
::fwData::Composite::ContainerType::iterator iter = newObjects.find(fromKey);
if (iter != newObjects.end())
......@@ -192,8 +189,8 @@ void STranslate::removeObjects(::fwData::Composite::ContainerType objects)
::fwData::Composite::sptr composite = this->getObject< ::fwData::Composite >();
for ( ManagedTranslations::value_type elt : m_managedTranslations )
{
const std::string &fromKey = elt.first;
const std::string &toKey = elt.second;
const std::string& fromKey = elt.first;
const std::string& toKey = elt.second;
::fwData::Composite::ContainerType::iterator iter = objects.find(fromKey);
if (iter != objects.end())
......
......@@ -145,7 +145,6 @@ void SImageSignalForwarder::configuring() throw ( ::fwTools::Failed )
void SImageSignalForwarder::starting() throw ( ::fwTools::Failed )
{
m_connections = ::fwServices::helper::SigSlotConnection::New();
::fwData::Image::csptr src;
if (!this->isVersion2())
......@@ -170,7 +169,7 @@ void SImageSignalForwarder::starting() throw ( ::fwTools::Failed )
for (auto signalKey: m_managedSignals)
{
m_connections->connect(src, signalKey, this->getSptr(), m_availableConnection[signalKey]);
m_connections.connect(src, signalKey, this->getSptr(), m_availableConnection[signalKey]);
}
}
......@@ -178,7 +177,7 @@ void SImageSignalForwarder::starting() throw ( ::fwTools::Failed )
void SImageSignalForwarder::stopping() throw ( ::fwTools::Failed )
{
m_connections->disconnect();
m_connections.disconnect();
}
//-----------------------------------------------------------------------------
......
......@@ -80,7 +80,7 @@ public:
SCENE2D_API void dispatchInteraction( SPTR(::scene2D::data::Event) _event );
/// Returns the viewport coordinate point mapped to scene coordinates.
SCENE2D_API ::scene2D::data::Coord mapToScene( const ::scene2D::data::Coord & coord ) const;
SCENE2D_API ::scene2D::data::Coord mapToScene( const ::scene2D::data::Coord& coord ) const;
/// Returns what happens to scene's aspect ratio on view resize events
SCENE2D_API Qt::AspectRatioMode getAspectRatioMode() const;
......@@ -347,10 +347,10 @@ private:
::scene2D::data::Coord m_sceneWidth;
/// The scene.
QGraphicsScene * m_scene;
QGraphicsScene* m_scene;
/// The view.
Scene2DGraphicsView * m_view;
Scene2DGraphicsView* m_view;
/// If antialiasing is requested (deactivated by default because of a potential lack of performance)
bool m_antialiasing;
......@@ -359,7 +359,7 @@ private:
Qt::AspectRatioMode m_aspectRatioMode;
/// Signal/ Slot connection
::fwServices::helper::SigSlotConnection::sptr m_connections;
::fwServices::helper::SigSlotConnection m_connections;
typedef std::vector< ::fwRuntime::ConfigurationElement::sptr > ConnectConfigType;
/// vector containing all the connections configurations
......@@ -367,7 +367,7 @@ private:
/// vector containing all the proxy configurations
ConnectConfigType m_proxies;
typedef std::map< std::string, ::fwServices::helper::SigSlotConnection::sptr > ObjectConnectionsMapType;
typedef std::map< std::string, ::fwServices::helper::SigSlotConnection > ObjectConnectionsMapType;
/// map containing the object key/connection relation
ObjectConnectionsMapType m_objectConnections;
......
......@@ -68,7 +68,7 @@ protected:
SCENE2D_API virtual ~IAdaptor() throw();
/// ToDo IM
SCENE2D_API virtual void info(std::ostream &_sstream );
SCENE2D_API virtual void info(std::ostream& _sstream );
/// Not implemented in IAdaptor but in its subclasses
SCENE2D_API void configuring() throw ( ::fwTools::Failed );
......@@ -145,7 +145,7 @@ protected:
typedef std::vector< ::scene2D::adaptor::IAdaptor::wptr > ManagedAdaptorVector;
/// Return all managed adaptor
ManagedAdaptorVector & getRegisteredServices()
ManagedAdaptorVector& getRegisteredServices()
{
return m_managedAdaptors;
}
......@@ -162,7 +162,7 @@ protected:
private:
/// Register automatic connection on object
::fwServices::helper::SigSlotConnection::sptr m_connections;
::fwServices::helper::SigSlotConnection m_connections;
/// All managed adaptors