7 #include "fwServices/registry/ActiveWorkers.hpp" 9 #include "fwCore/util/LazyInstantiator.hpp" 36 return ::fwCore::util::LazyInstantiator< ActiveWorkers >::getInstance();
45 WorkerMapType::const_iterator it =
m_workers.find(key);
52 return ::fwThread::Worker::sptr();
75 m_workers.insert( WorkerMapType::value_type(key, worker) );
FWSERVICES_API ActiveWorkers()
Constructor, does nothing.
Contains fwAtomsFilter::registry details.
WorkerMapType m_workers
Association key <=> worker.
Namespace fwServices is dedicated to (mimic) the dynamic affectation of methods to (pure data) object...
::boost::unique_lock< ReadWriteMutex > WriteLock
Defines a lock of write type for read/write mutex.
virtual FWSERVICES_API ~ActiveWorkers()
Destructor, does nothing.
FWSERVICES_API void clearRegistry()
Unregisters all registered workers, s_DEFAULT_WORKER also.
static FWSERVICES_API void setDefaultWorker(::fwThread::Worker::sptr worker)
Register the default active worker.
static FWSERVICES_API const std::string s_DEFAULT_WORKER
Key of default worker in registry, created and registered by initRegistry method. ...
mutable::fwCore::mt::ReadWriteMutex m_registryMutex
Used to protect the registry access.
FWSERVICES_API void addWorker(const WorkerKeyType &key,::fwThread::Worker::sptr worker)
Registers a worker.
FWSERVICES_API void initRegistry()
Initializes registry, creates and registers the default worker.
static FWSERVICES_API ActiveWorkers::sptr getDefault()
Returns an instance of ActiveWorkers.
::boost::shared_lock< ReadWriteMutex > ReadLock
Defines a lock of read type for read/write mutex.
static FWSERVICES_API::fwThread::Worker::sptr getDefaultWorker()
Get the default registered worker.
FWSERVICES_API::fwThread::Worker::sptr getWorker(const WorkerKeyType &key) const
Get a worker registered with key, if the key does not exist a null sptr is returned.