diff --git a/Core/Code/Controllers/mitkCoreActivator.cpp b/Core/Code/Controllers/mitkCoreActivator.cpp deleted file mode 100644 index 86a0121d77..0000000000 --- a/Core/Code/Controllers/mitkCoreActivator.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#include "mitkRenderingManager.h" -#include "mitkPlanePositionManager.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void HandleMicroServicesMessages(us::MsgType type, const char* msg) -{ - switch (type) - { - case us::DebugMsg: - MITK_DEBUG << msg; - break; - case us::InfoMsg: - MITK_INFO << msg; - break; - case us::WarningMsg: - MITK_WARN << msg; - break; - case us::ErrorMsg: - MITK_ERROR << msg; - break; - } -} - -void AddMitkAutoLoadPaths(const std::string& programPath) -{ - us::ModuleSettings::AddAutoLoadPath(programPath); -#ifdef __APPLE__ - // Walk up three directories since that is where the .dylib files are located - // for build trees. - std::string additionalPath = programPath; - bool addPath = true; - for(int i = 0; i < 3; ++i) - { - std::size_t index = additionalPath.find_last_of('/'); - if (index != std::string::npos) - { - additionalPath = additionalPath.substr(0, index); - } - else - { - addPath = false; - break; - } - } - if (addPath) - { - us::ModuleSettings::AddAutoLoadPath(additionalPath); - } -#endif -} - -class ShaderRepositoryTracker : public us::ServiceTracker -{ - -public: - - ShaderRepositoryTracker() - : Superclass(us::GetModuleContext()) - { - } - - virtual void Close() - { - us::GetModuleContext()->RemoveModuleListener(this, &ShaderRepositoryTracker::HandleModuleEvent); - Superclass::Close(); - } - - virtual void Open() - { - us::GetModuleContext()->AddModuleListener(this, &ShaderRepositoryTracker::HandleModuleEvent); - Superclass::Open(); - } - -private: - - typedef us::ServiceTracker Superclass; - - TrackedType AddingService(const ServiceReferenceType &reference) - { - mitk::IShaderRepository* shaderRepo = Superclass::AddingService(reference); - if (shaderRepo) - { - // Add all existing shaders from modules to the new shader repository. - // If the shader repository is registered in a modules activator, the - // GetLoadedModules() function call below will also return the module - // which is currently registering the repository. The HandleModuleEvent - // method contains code to avoid double registrations due to a fired - // ModuleEvent::LOADED event after the activators Load() method finished. - std::vector modules = us::ModuleRegistry::GetLoadedModules(); - for (std::vector::const_iterator iter = modules.begin(), - endIter = modules.end(); iter != endIter; ++iter) - { - this->AddModuleShaderToRepository(*iter, shaderRepo); - } - - m_ShaderRepositories.push_back(shaderRepo); - } - return shaderRepo; - } - - void RemovedService(const ServiceReferenceType& /*reference*/, TrackedType tracked) - { - m_ShaderRepositories.erase(std::remove(m_ShaderRepositories.begin(), m_ShaderRepositories.end(), tracked), - m_ShaderRepositories.end()); - } - - void HandleModuleEvent(const us::ModuleEvent moduleEvent) - { - if (moduleEvent.GetType() == us::ModuleEvent::LOADED) - { - std::vector shaderRepos; - for (std::map > >::const_iterator shaderMapIter = m_ModuleIdToShaderIds.begin(), - shaderMapEndIter = m_ModuleIdToShaderIds.end(); shaderMapIter != shaderMapEndIter; ++shaderMapIter) - { - if (shaderMapIter->second.find(moduleEvent.GetModule()->GetModuleId()) == shaderMapIter->second.end()) - { - shaderRepos.push_back(shaderMapIter->first); - } - } - AddModuleShadersToRepositories(moduleEvent.GetModule(), shaderRepos); - } - else if (moduleEvent.GetType() == us::ModuleEvent::UNLOADED) - { - RemoveModuleShadersFromRepositories(moduleEvent.GetModule(), m_ShaderRepositories); - } - } - - void AddModuleShadersToRepositories(us::Module* module, const std::vector& shaderRepos) - { - // search and load shader files - std::vector shaderResources = module->FindResources("Shaders", "*.xml", true); - for (std::vector::iterator i = shaderResources.begin(); - i != shaderResources.end(); ++i) - { - if (*i) - { - us::ModuleResourceStream rs(*i); - for (std::vector::const_iterator shaderRepoIter = shaderRepos.begin(), - shaderRepoEndIter = shaderRepos.end(); shaderRepoIter != shaderRepoEndIter; ++shaderRepoIter) - { - int id = (*shaderRepoIter)->LoadShader(rs, i->GetBaseName()); - if (id >= 0) - { - m_ModuleIdToShaderIds[*shaderRepoIter][module->GetModuleId()].push_back(id); - } - } - rs.seekg(0, std::ios_base::beg); - } - } - } - - void AddModuleShaderToRepository(us::Module* module, mitk::IShaderRepository* shaderRepo) - { - std::vector shaderRepos; - shaderRepos.push_back(shaderRepo); - this->AddModuleShadersToRepositories(module, shaderRepos); - } - - void RemoveModuleShadersFromRepositories(us::Module* module, - const std::vector& shaderRepos) - { - for (std::vector::const_iterator shaderRepoIter = shaderRepos.begin(), - shaderRepoEndIter = shaderRepos.end(); shaderRepoIter != shaderRepoEndIter; ++shaderRepoIter) - { - std::map >& moduleIdToShaderIds = m_ModuleIdToShaderIds[*shaderRepoIter]; - std::map >::iterator shaderIdsIter = - moduleIdToShaderIds.find(module->GetModuleId()); - if (shaderIdsIter != moduleIdToShaderIds.end()) - { - for (std::vector::iterator idIter = shaderIdsIter->second.begin(); - idIter != shaderIdsIter->second.end(); ++idIter) - { - (*shaderRepoIter)->UnloadShader(*idIter); - } - moduleIdToShaderIds.erase(shaderIdsIter); - } - } - } - -private: - - // Maps to each shader repository a map containing module ids and related - // shader registration ids - std::map > > m_ModuleIdToShaderIds; - std::vector m_ShaderRepositories; -}; - -/* - * This is the module activator for the "Mitk" module. It registers core services - * like ... - */ -class MitkCoreActivator : public us::ModuleActivator -{ -public: - - void Load(us::ModuleContext* context) - { - // Handle messages from CppMicroServices - us::installMsgHandler(HandleMicroServicesMessages); - - // Add the current application directory to the auto-load paths. - // This is useful for third-party executables. - std::string programPath = mitk::IOUtil::GetProgramPath(); - if (programPath.empty()) - { - MITK_WARN << "Could not get the program path."; - } - else - { - AddMitkAutoLoadPaths(programPath); - } - - //m_RenderingManager = mitk::RenderingManager::New(); - //context->RegisterService(renderingManager.GetPointer()); - m_PlanePositionManager.reset(new mitk::PlanePositionManagerService); - context->RegisterService(m_PlanePositionManager.get()); - - m_CoreDataNodeReader.reset(new mitk::CoreDataNodeReader); - context->RegisterService(m_CoreDataNodeReader.get()); - - m_PropertyAliases.reset(new mitk::PropertyAliases); - context->RegisterService(m_PropertyAliases.get()); - - m_PropertyDescriptions.reset(new mitk::PropertyDescriptions); - context->RegisterService(m_PropertyDescriptions.get()); - - m_PropertyExtensions.reset(new mitk::PropertyExtensions); - context->RegisterService(m_PropertyExtensions.get()); - - m_PropertyFilters.reset(new mitk::PropertyFilters); - context->RegisterService(m_PropertyFilters.get()); - - m_ShaderRepositoryTracker.Open(); - - /* - There IS an option to exchange ALL vtkTexture instances against vtkNeverTranslucentTextureFactory. - This code is left here as a reminder, just in case we might need to do that some time. - - vtkNeverTranslucentTextureFactory* textureFactory = vtkNeverTranslucentTextureFactory::New(); - vtkObjectFactory::RegisterFactory( textureFactory ); - textureFactory->Delete(); - */ - } - - void Unload(us::ModuleContext* ) - { - // The mitk::ModuleContext* argument of the Unload() method - // will always be 0 for the Mitk library. It makes no sense - // to use it at this stage anyway, since all libraries which - // know about the module system have already been unloaded. - - m_ShaderRepositoryTracker.Close(); - } - -private: - - ShaderRepositoryTracker m_ShaderRepositoryTracker; - - //mitk::RenderingManager::Pointer m_RenderingManager; - std::auto_ptr m_PlanePositionManager; - std::auto_ptr m_CoreDataNodeReader; - std::auto_ptr m_PropertyAliases; - std::auto_ptr m_PropertyDescriptions; - std::auto_ptr m_PropertyExtensions; - std::auto_ptr m_PropertyFilters; -}; - -US_EXPORT_MODULE_ACTIVATOR(MitkCore, MitkCoreActivator) - -// Call CppMicroservices initialization code at the end of the file. -// This especially ensures that VTK object factories have already -// been registered (VTK initialization code is injected by implicitly -// include VTK header files at the top of this file). -US_INITIALIZE_MODULE("MitkCore", "MitkCore") diff --git a/Core/Code/Internal/mitkCoreActivator.cpp b/Core/Code/Internal/mitkCoreActivator.cpp index 475df003e3..1d4c2300d2 100644 --- a/Core/Code/Internal/mitkCoreActivator.cpp +++ b/Core/Code/Internal/mitkCoreActivator.cpp @@ -1,443 +1,443 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkCoreActivator.h" // File IO #include #include #include #include #include #include #include #include #include #include #include #include #include #include "mitkLegacyFileWriterService.h" #include // Micro Services #include #include #include #include #include #include #include #include #include #include void HandleMicroServicesMessages(us::MsgType type, const char* msg) { switch (type) { case us::DebugMsg: MITK_DEBUG << msg; break; case us::InfoMsg: MITK_INFO << msg; break; case us::WarningMsg: MITK_WARN << msg; break; case us::ErrorMsg: MITK_ERROR << msg; break; } } void AddMitkAutoLoadPaths(const std::string& programPath) { us::ModuleSettings::AddAutoLoadPath(programPath); #ifdef __APPLE__ // Walk up three directories since that is where the .dylib files are located // for build trees. std::string additionalPath = programPath; bool addPath = true; for(int i = 0; i < 3; ++i) { std::size_t index = additionalPath.find_last_of('/'); if (index != std::string::npos) { additionalPath = additionalPath.substr(0, index); } else { addPath = false; break; } } if (addPath) { us::ModuleSettings::AddAutoLoadPath(additionalPath); } #endif } class ShaderRepositoryTracker : public us::ServiceTracker { public: ShaderRepositoryTracker() : Superclass(us::GetModuleContext()) { } virtual void Close() { us::GetModuleContext()->RemoveModuleListener(this, &ShaderRepositoryTracker::HandleModuleEvent); Superclass::Close(); } virtual void Open() { us::GetModuleContext()->AddModuleListener(this, &ShaderRepositoryTracker::HandleModuleEvent); Superclass::Open(); } private: typedef us::ServiceTracker Superclass; TrackedType AddingService(const ServiceReferenceType &reference) { mitk::IShaderRepository* shaderRepo = Superclass::AddingService(reference); if (shaderRepo) { // Add all existing shaders from modules to the new shader repository. // If the shader repository is registered in a modules activator, the // GetLoadedModules() function call below will also return the module // which is currently registering the repository. The HandleModuleEvent // method contains code to avoid double registrations due to a fired // ModuleEvent::LOADED event after the activators Load() method finished. std::vector modules = us::ModuleRegistry::GetLoadedModules(); for (std::vector::const_iterator iter = modules.begin(), endIter = modules.end(); iter != endIter; ++iter) { this->AddModuleShaderToRepository(*iter, shaderRepo); } m_ShaderRepositories.push_back(shaderRepo); } return shaderRepo; } void RemovedService(const ServiceReferenceType& /*reference*/, TrackedType tracked) { m_ShaderRepositories.erase(std::remove(m_ShaderRepositories.begin(), m_ShaderRepositories.end(), tracked), m_ShaderRepositories.end()); } void HandleModuleEvent(const us::ModuleEvent moduleEvent) { if (moduleEvent.GetType() == us::ModuleEvent::LOADED) { std::vector shaderRepos; for (std::map > >::const_iterator shaderMapIter = m_ModuleIdToShaderIds.begin(), shaderMapEndIter = m_ModuleIdToShaderIds.end(); shaderMapIter != shaderMapEndIter; ++shaderMapIter) { if (shaderMapIter->second.find(moduleEvent.GetModule()->GetModuleId()) == shaderMapIter->second.end()) { shaderRepos.push_back(shaderMapIter->first); } } AddModuleShadersToRepositories(moduleEvent.GetModule(), shaderRepos); } else if (moduleEvent.GetType() == us::ModuleEvent::UNLOADED) { RemoveModuleShadersFromRepositories(moduleEvent.GetModule(), m_ShaderRepositories); } } void AddModuleShadersToRepositories(us::Module* module, const std::vector& shaderRepos) { // search and load shader files std::vector shaderResources = module->FindResources("Shaders", "*.xml", true); for (std::vector::iterator i = shaderResources.begin(); i != shaderResources.end(); ++i) { if (*i) { us::ModuleResourceStream rs(*i); for (std::vector::const_iterator shaderRepoIter = shaderRepos.begin(), shaderRepoEndIter = shaderRepos.end(); shaderRepoIter != shaderRepoEndIter; ++shaderRepoIter) { int id = (*shaderRepoIter)->LoadShader(rs, i->GetBaseName()); if (id >= 0) { m_ModuleIdToShaderIds[*shaderRepoIter][module->GetModuleId()].push_back(id); } } rs.seekg(0, std::ios_base::beg); } } } void AddModuleShaderToRepository(us::Module* module, mitk::IShaderRepository* shaderRepo) { std::vector shaderRepos; shaderRepos.push_back(shaderRepo); this->AddModuleShadersToRepositories(module, shaderRepos); } void RemoveModuleShadersFromRepositories(us::Module* module, const std::vector& shaderRepos) { for (std::vector::const_iterator shaderRepoIter = shaderRepos.begin(), shaderRepoEndIter = shaderRepos.end(); shaderRepoIter != shaderRepoEndIter; ++shaderRepoIter) { std::map >& moduleIdToShaderIds = m_ModuleIdToShaderIds[*shaderRepoIter]; std::map >::iterator shaderIdsIter = moduleIdToShaderIds.find(module->GetModuleId()); if (shaderIdsIter != moduleIdToShaderIds.end()) { for (std::vector::iterator idIter = shaderIdsIter->second.begin(); idIter != shaderIdsIter->second.end(); ++idIter) { (*shaderRepoIter)->UnloadShader(*idIter); } moduleIdToShaderIds.erase(shaderIdsIter); } } } private: // Maps to each shader repository a map containing module ids and related // shader registration ids std::map > > m_ModuleIdToShaderIds; std::vector m_ShaderRepositories; }; class FixedNiftiImageIO : public itk::NiftiImageIO { public: /** Standard class typedefs. */ typedef FixedNiftiImageIO Self; typedef itk::NiftiImageIO Superclass; typedef itk::SmartPointer< Self > Pointer; /** Method for creation through the object factory. */ itkNewMacro(Self) /** Run-time type information (and related methods). */ itkTypeMacro(FixedNiftiImageIO, Superclass) virtual bool SupportsDimension(unsigned long dim) { return dim > 1 && dim < 5; } }; void MitkCoreActivator::Load(us::ModuleContext* context) { // Handle messages from CppMicroServices us::installMsgHandler(HandleMicroServicesMessages); this->m_Context = context; // Add the current application directory to the auto-load paths. // This is useful for third-party executables. std::string programPath = mitk::IOUtil::GetProgramPath(); if (programPath.empty()) { MITK_WARN << "Could not get the program path."; } else { AddMitkAutoLoadPaths(programPath); } m_ShaderRepositoryTracker.reset(new ShaderRepositoryTracker); //m_RenderingManager = mitk::RenderingManager::New(); //context->RegisterService(renderingManager.GetPointer()); m_PlanePositionManager.reset(new mitk::PlanePositionManagerService); context->RegisterService(m_PlanePositionManager.get()); m_PropertyAliases.reset(new mitk::PropertyAliases); context->RegisterService(m_PropertyAliases.get()); m_PropertyDescriptions.reset(new mitk::PropertyDescriptions); context->RegisterService(m_PropertyDescriptions.get()); m_PropertyExtensions.reset(new mitk::PropertyExtensions); context->RegisterService(m_PropertyExtensions.get()); m_PropertyFilters.reset(new mitk::PropertyFilters); context->RegisterService(m_PropertyFilters.get()); m_MimeTypeProvider.reset(new mitk::MimeTypeProvider); m_MimeTypeProvider->Start(); m_MimeTypeProviderReg = context->RegisterService(m_MimeTypeProvider.get()); this->RegisterDefaultMimeTypes(); this->RegisterItkReaderWriter(); this->RegisterVtkReaderWriter(); // Add custom Reader / Writer Services m_FileReaders.push_back(new mitk::PointSetReaderService()); m_FileWriters.push_back(new mitk::PointSetWriterService()); m_FileReaders.push_back(new mitk::RawImageFileReader()); m_ShaderRepositoryTracker->Open(); /* There IS an option to exchange ALL vtkTexture instances against vtkNeverTranslucentTextureFactory. This code is left here as a reminder, just in case we might need to do that some time. vtkNeverTranslucentTextureFactory* textureFactory = vtkNeverTranslucentTextureFactory::New(); vtkObjectFactory::RegisterFactory( textureFactory ); textureFactory->Delete(); */ this->RegisterLegacyWriter(); } void MitkCoreActivator::Unload(us::ModuleContext* ) { for(std::vector::iterator iter = m_FileReaders.begin(), endIter = m_FileReaders.end(); iter != endIter; ++iter) { delete *iter; } for(std::vector::iterator iter = m_FileWriters.begin(), endIter = m_FileWriters.end(); iter != endIter; ++iter) { delete *iter; } for(std::vector::iterator iter = m_FileIOs.begin(), endIter = m_FileIOs.end(); iter != endIter; ++iter) { delete *iter; } for(std::vector::iterator iter = m_LegacyWriters.begin(), endIter = m_LegacyWriters.end(); iter != endIter; ++iter) { delete *iter; } // The mitk::ModuleContext* argument of the Unload() method // will always be 0 for the Mitk library. It makes no sense // to use it at this stage anyway, since all libraries which // know about the module system have already been unloaded. // we need to close the internal service tracker of the // MimeTypeProvider class here. Otherwise it // would hold on to the ModuleContext longer than it is // actually valid. m_MimeTypeProviderReg.Unregister(); m_MimeTypeProvider->Stop(); m_ShaderRepositoryTracker->Close(); } void MitkCoreActivator::RegisterDefaultMimeTypes() { // Register some default mime-types std::vector mimeTypes = mitk::IOMimeTypes::Get(); for (std::vector::const_iterator mimeTypeIter = mimeTypes.begin(), iterEnd = mimeTypes.end(); mimeTypeIter != iterEnd; ++mimeTypeIter) { m_DefaultMimeTypes.push_back(*mimeTypeIter); m_Context->RegisterService(&m_DefaultMimeTypes.back()); } } void MitkCoreActivator::RegisterItkReaderWriter() { std::list allobjects = itk::ObjectFactoryBase::CreateAllInstance("itkImageIOBase"); for (std::list::iterator i = allobjects.begin(), endIter = allobjects.end(); i != endIter; ++i) { itk::ImageIOBase* io = dynamic_cast(i->GetPointer()); // NiftiImageIO does not provide a correct "SupportsDimension()" methods // and the supported read/write extensions are not ordered correctly if (dynamic_cast(io)) continue; if (io) { m_FileIOs.push_back(new mitk::ItkImageIO(io)); } else { MITK_WARN << "Error ImageIO factory did not return an ImageIOBase: " << ( *i )->GetNameOfClass(); } } mitk::ItkImageIO* io = new mitk::ItkImageIO(mitk::CustomMimeType(mitk::IOMimeTypes::NIFTI_MIMETYPE_NAME()), new FixedNiftiImageIO(), 0); m_FileIOs.push_back(io); } void MitkCoreActivator::RegisterVtkReaderWriter() { m_FileIOs.push_back(new mitk::SurfaceVtkXmlIO()); m_FileIOs.push_back(new mitk::SurfaceStlIO()); m_FileIOs.push_back(new mitk::SurfaceVtkLegacyIO()); m_FileIOs.push_back(new mitk::ImageVtkXmlIO()); m_FileIOs.push_back(new mitk::ImageVtkLegacyIO()); } void MitkCoreActivator::RegisterLegacyWriter() { std::list allobjects = itk::ObjectFactoryBase::CreateAllInstance("IOWriter"); for( std::list::iterator i = allobjects.begin(); i != allobjects.end(); ++i) { mitk::FileWriter::Pointer io = dynamic_cast(i->GetPointer()); if(io) { std::string description = std::string("Legacy ") + io->GetNameOfClass() + " Reader"; mitk::IFileWriter* writer = new mitk::LegacyFileWriterService(io, description); m_LegacyWriters.push_back(writer); } else { MITK_ERROR << "Error IOWriter override is not of type mitk::FileWriter: " << (*i)->GetNameOfClass() << std::endl; } } } -US_EXPORT_MODULE_ACTIVATOR(MitkCore, MitkCoreActivator) +US_EXPORT_MODULE_ACTIVATOR(MitkCoreActivator) // Call CppMicroservices initialization code at the end of the file. // This especially ensures that VTK object factories have already // been registered (VTK initialization code is injected by implicitly // include VTK header files at the top of this file). -US_INITIALIZE_MODULE("MitkCore", "MitkCore") +US_INITIALIZE_MODULE diff --git a/Modules/IpPicSupportIO/Internal/mitkIpPicSupportIOActivator.cpp b/Modules/IpPicSupportIO/Internal/mitkIpPicSupportIOActivator.cpp index f21ca7fa7a..2e59c45b68 100644 --- a/Modules/IpPicSupportIO/Internal/mitkIpPicSupportIOActivator.cpp +++ b/Modules/IpPicSupportIO/Internal/mitkIpPicSupportIOActivator.cpp @@ -1,40 +1,40 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include "mitkPicFileReader.h" class US_ABI_LOCAL mitkIpPicSupportIOActivator : public us::ModuleActivator { public: void Load(us::ModuleContext*) { m_Reader = new mitk::PicFileReader(); } void Unload(us::ModuleContext* ) { delete m_Reader; } private: mitk::IFileReader* m_Reader; }; -US_EXPORT_MODULE_ACTIVATOR(MitkIpPicSupportIO, mitkIpPicSupportIOActivator) +US_EXPORT_MODULE_ACTIVATOR(mitkIpPicSupportIOActivator) diff --git a/Modules/OpenCL/mitkOpenCLActivator.cpp b/Modules/OpenCL/mitkOpenCLActivator.cpp index 62eb427f7a..a53f36e5b6 100644 --- a/Modules/OpenCL/mitkOpenCLActivator.cpp +++ b/Modules/OpenCL/mitkOpenCLActivator.cpp @@ -1,33 +1,33 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkOpenCLActivator.h" void OpenCLActivator::Load(us::ModuleContext *context) { // generate context m_ResourceService.reset(new OclResourceServiceImpl); us::ServiceProperties props; context->RegisterService(m_ResourceService.get(), props); } void OpenCLActivator::Unload(us::ModuleContext *) { m_ResourceService.release(); } -US_EXPORT_MODULE_ACTIVATOR(MitkOpenCL, OpenCLActivator ) +US_EXPORT_MODULE_ACTIVATOR(OpenCLActivator ) diff --git a/Modules/Persistence/mitkPersistenceActivator.h b/Modules/Persistence/mitkPersistenceActivator.h index 775c5227c7..3f2036aa2c 100644 --- a/Modules/Persistence/mitkPersistenceActivator.h +++ b/Modules/Persistence/mitkPersistenceActivator.h @@ -1,47 +1,47 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef mitkPersistenceActivator_h #define mitkPersistenceActivator_h #define MBILOG_ENABLE_DEBUG // Microservices #include #include "mitkPersistenceService.h" #include namespace mitk { /// /// installs the PersistenceService /// runs all initial commands (setting env paths etc) /// class PersistenceActivator : public us::ModuleActivator { public: PersistenceActivator(); void Load(us::ModuleContext* context); void Unload(us::ModuleContext* context); virtual ~PersistenceActivator(); private: itk::SmartPointer m_PersistenceService; us::ServiceRegistration m_PersistenceServiceRegistration; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkPersistence, mitk::PersistenceActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::PersistenceActivator) #endif diff --git a/Modules/Python/mitkPythonActivator.cpp b/Modules/Python/mitkPythonActivator.cpp index a9625c7b05..7f7bfe0961 100644 --- a/Modules/Python/mitkPythonActivator.cpp +++ b/Modules/Python/mitkPythonActivator.cpp @@ -1,67 +1,67 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef mitkPythonActivator_h #define mitkPythonActivator_h // Microservices #include #include "usModuleContext.h" #include "mitkPythonService.h" #include namespace mitk { /// /// installs the PythonService /// runs all initial commands (setting env paths etc) /// class PythonActivator : public us::ModuleActivator { public: void Load(us::ModuleContext* context) { MITK_DEBUG << "PythonActivator::Load"; // Registering PythonService as MicroService m_PythonService = itk::SmartPointer(new PythonService()); us::ServiceProperties _PythonServiceProps; _PythonServiceProps["Name"] = std::string("PythonService"); m_PythonServiceRegistration = context->RegisterService(m_PythonService.GetPointer(), _PythonServiceProps); } void Unload(us::ModuleContext* context) { MITK_DEBUG("PythonActivator") << "PythonActivator::Unload"; MITK_DEBUG("PythonActivator") << "m_PythonService GetReferenceCount " << m_PythonService->GetReferenceCount(); m_PythonServiceRegistration.Unregister(); m_PythonService->Delete(); MITK_DEBUG("PythonActivator") << "m_PythonService GetReferenceCount " << m_PythonService->GetReferenceCount(); } virtual ~PythonActivator() { } private: itk::SmartPointer m_PythonService; us::ServiceRegistration m_PythonServiceRegistration; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkPython, mitk::PythonActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::PythonActivator) #endif diff --git a/Modules/SceneSerialization/mitkSceneSerializationActivator.cpp b/Modules/SceneSerialization/mitkSceneSerializationActivator.cpp index 20b5bf90b7..372c12c856 100644 --- a/Modules/SceneSerialization/mitkSceneSerializationActivator.cpp +++ b/Modules/SceneSerialization/mitkSceneSerializationActivator.cpp @@ -1,48 +1,48 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkSceneDataNodeReader.h" #include #include namespace mitk { /* * This is the module activator for the "SceneSerialization" module. */ class SceneSerializationActivator : public us::ModuleActivator { public: void Load(us::ModuleContext* context) { m_SceneDataNodeReader.reset(new mitk::SceneDataNodeReader); context->RegisterService(m_SceneDataNodeReader.get()); } void Unload(us::ModuleContext* ) { } private: std::auto_ptr m_SceneDataNodeReader; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkSceneSerialization, mitk::SceneSerializationActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::SceneSerializationActivator) diff --git a/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp b/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp index 0b34f71687..d5ab04439f 100644 --- a/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp +++ b/Modules/Segmentation/Controllers/mitkSegmentationModuleActivator.cpp @@ -1,49 +1,49 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include #include #include #include "mitkToolManagerProvider.h" namespace mitk { /** \brief Registers services for segmentation module. */ class SegmentationModuleActivator : public us::ModuleActivator { public: void Load(us::ModuleContext* context) { /*register ToolManager provider service*/ m_ToolManagerProvider = mitk::ToolManagerProvider::New(); context->RegisterService(m_ToolManagerProvider); } void Unload(us::ModuleContext*) { } private: mitk::ToolManagerProvider::Pointer m_ToolManagerProvider; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkSegmentation, mitk::SegmentationModuleActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::SegmentationModuleActivator) diff --git a/Modules/Simulation/mitkSimulationActivator.cpp b/Modules/Simulation/mitkSimulationActivator.cpp index f439da010d..3b081b1cd3 100644 --- a/Modules/Simulation/mitkSimulationActivator.cpp +++ b/Modules/Simulation/mitkSimulationActivator.cpp @@ -1,54 +1,54 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include #include #include namespace mitk { class SimulationActivator : public us::ModuleActivator { public: SimulationActivator() { } ~SimulationActivator() { } void Load(us::ModuleContext* context) { m_SimulationService.reset(new SimulationService); context->RegisterService(m_SimulationService.get()); } void Unload(us::ModuleContext*) { m_SimulationService.reset(NULL); } private: SimulationActivator(const SimulationActivator&); SimulationActivator& operator=(const SimulationActivator&); std::auto_ptr m_SimulationService; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkSimulation, mitk::SimulationActivator); +US_EXPORT_MODULE_ACTIVATOR(mitk::SimulationActivator); diff --git a/Modules/ToFHardware/Kinect/mitkKinectActivator.cpp b/Modules/ToFHardware/Kinect/mitkKinectActivator.cpp index 2f4bdff7ab..0eab158987 100644 --- a/Modules/ToFHardware/Kinect/mitkKinectActivator.cpp +++ b/Modules/ToFHardware/Kinect/mitkKinectActivator.cpp @@ -1,85 +1,85 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __mitkKinectActivator_h #define __mitkKinectActivator_h // Microservices #include #include #include //ToF #include "mitkIToFDeviceFactory.h" #include "mitkToFConfig.h" #include "mitkKinectDeviceFactory.h" #include "mitkAbstractToFDeviceFactory.h" namespace mitk { /** * @brief The KinectActivator class This is the module activator for the "mitkKinectModule" * module. It registers services like the IToFDeviceFactory. */ class KinectActivator : public us::ModuleActivator{ public: /** * @brief Load This method is automatically called, when the kinect module * is activated. It will automatically register a KinectDeviceFactory. */ void Load(us::ModuleContext* context) { //Implementing KinectDeviceFactory KinectDeviceFactory* kinectFactory = new KinectDeviceFactory(); us::ServiceProperties kinectFactoryProps; kinectFactoryProps["ToFFactoryName"] =kinectFactory->GetFactoryName(); context->RegisterService(kinectFactory, kinectFactoryProps); kinectFactory->ConnectToFDevice(); m_Factories.push_back( kinectFactory ); } /** * @brief Unload called when the module is unloaded. */ void Unload(us::ModuleContext* ) { } /** @brief Default destructor which deletes all registered factories. Usually, there should never be more than one. */ ~KinectActivator() { if(m_Factories.size() > 0) { for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it) { delete (*it); } } } private: /** * @brief m_Factories List of all registered factories. */ std::list< IToFDeviceFactory* > m_Factories; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkKinect, mitk::KinectActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::KinectActivator) #endif diff --git a/Modules/ToFHardware/KinectV2/mitkKinectV2Activator.cpp b/Modules/ToFHardware/KinectV2/mitkKinectV2Activator.cpp index 50f2f513fa..7fadac1093 100644 --- a/Modules/ToFHardware/KinectV2/mitkKinectV2Activator.cpp +++ b/Modules/ToFHardware/KinectV2/mitkKinectV2Activator.cpp @@ -1,75 +1,75 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __mitkKinectV2Activator_h #define __mitkKinectV2Activator_h // Microservices #include #include #include #include "mitkIToFDeviceFactory.h" #include "mitkToFConfig.h" #include "mitkKinectV2DeviceFactory.h" #include "mitkAbstractToFDeviceFactory.h" /* * This is the module activator for the "mitkKinectV2Module" module. It registers services * like the IToFDeviceFactory. */ namespace mitk { class KinectV2Activator : public us::ModuleActivator { public: void Load(us::ModuleContext* context) { //Implementing KinectDeviceFactory KinectV2DeviceFactory* KinectV2Factory = new KinectV2DeviceFactory(); us::ServiceProperties KinectV2FactoryProps; KinectV2FactoryProps["ToFFactoryName"] =KinectV2Factory->GetFactoryName(); context->RegisterService(KinectV2Factory, KinectV2FactoryProps); KinectV2Factory->ConnectToFDevice(); m_Factories.push_back( KinectV2Factory ); } void Unload(us::ModuleContext* ) { } ~KinectV2Activator() { if(m_Factories.size() > 0) { for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it) { delete (*it); } } } private: std::list< IToFDeviceFactory* > m_Factories; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkKinectV2, mitk::KinectV2Activator) +US_EXPORT_MODULE_ACTIVATOR(mitk::KinectV2Activator) #endif diff --git a/Modules/ToFHardware/MesaSR4000/mitkToDCameraMESASR4000ModuleActivator.cpp b/Modules/ToFHardware/MesaSR4000/mitkToDCameraMESASR4000ModuleActivator.cpp index ba5b031af1..79ef12f86c 100644 --- a/Modules/ToFHardware/MesaSR4000/mitkToDCameraMESASR4000ModuleActivator.cpp +++ b/Modules/ToFHardware/MesaSR4000/mitkToDCameraMESASR4000ModuleActivator.cpp @@ -1,86 +1,86 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __mitkMESASR4000Activator_h #define __mitkMESASR4000Activator_h // Microservices #include #include #include "usModuleContext.h" #include //ToF #include "mitkIToFDeviceFactory.h" #include "mitkToFConfig.h" #include "mitkToFCameraMESASR4000DeviceFactory.h" namespace mitk { /** * @brief The MESASR4000ModuleActivator class This is the module activator for the "MESASR4000Module" * module. It registers services like the IToFDeviceFactory. */ class MESASR4000ModuleActivator : public us::ModuleActivator { public: /** * @brief Load This method is automatically called, when the MESASR4000Module * is activated. It will automatically register a ToFCameraMESASR4000DeviceFactory. */ void Load(us::ModuleContext* context) { //Implementing MESASR4000DeviceFactory ToFCameraMESASR4000DeviceFactory* toFCameraMESASR4000DeviceFactory = new ToFCameraMESASR4000DeviceFactory(); us::ServiceProperties mitkMESASR4000FactoryProps; mitkMESASR4000FactoryProps["ToFFactoryName"] = toFCameraMESASR4000DeviceFactory->GetFactoryName(); context->RegisterService(toFCameraMESASR4000DeviceFactory, mitkMESASR4000FactoryProps); toFCameraMESASR4000DeviceFactory->ConnectToFDevice(); m_Factories.push_back(toFCameraMESASR4000DeviceFactory); } /** * @brief Unload called when the module is unloaded. */ void Unload(us::ModuleContext* ) { } /** * @brief Default destructor which deletes all registered factories. */ ~MESASR4000ModuleActivator() { if(m_Factories.size() > 0) { for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it) { delete (*it); } } } private: /** * @brief m_Factories List of all registered factories. */ std::list< IToFDeviceFactory* > m_Factories; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkMESASR4000, mitk::MESASR4000ModuleActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::MESASR4000ModuleActivator) #endif diff --git a/Modules/ToFHardware/PMD/mitkPMDModuleActivator.cpp b/Modules/ToFHardware/PMD/mitkPMDModuleActivator.cpp index 409ddb945d..6ccf9eb310 100644 --- a/Modules/ToFHardware/PMD/mitkPMDModuleActivator.cpp +++ b/Modules/ToFHardware/PMD/mitkPMDModuleActivator.cpp @@ -1,162 +1,162 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __mitkToFCameraPMDModuleActivator_h #define __mitkToFCameraPMDModuleActivator_h // Microservices #include #include #include //ToF #include "mitkIToFDeviceFactory.h" #include "mitkToFConfig.h" #include "mitkToFPMDConfig.h" #include "mitkToFCameraPMDPlayerDeviceFactory.h" #include "mitkAbstractToFDeviceFactory.h" //The follwing heades only get implemented if the respective Devices are activated through Cmake #ifdef MITK_USE_TOF_PMDCAMCUBE #include "mitkToFCameraPMDCamCubeDeviceFactory.h" #include "mitkToFCameraPMDRawDataCamCubeDeviceFactory.h" #endif #ifdef MITK_USE_TOF_PMDO3 #include "mitkToFCameraPMDO3DeviceFactory.h" #endif #ifdef MITK_USE_TOF_PMDCAMBOARD #include "mitkToFCameraPMDCamBoardDeviceFactory.h" #include "mitkToFCameraPMDRawDataCamBoardDeviceFactory.h" #endif namespace mitk { /** * @brief The PMDModuleActivator class This is the module activator for the "PMDModule" * module. It registers services like the IToFDeviceFactory. */ class PMDModuleActivator : public us::ModuleActivator { public: /** * @brief Load This method is automatically called, when the PMDModule * is activated. It will automatically register factories of activated PMD devices. */ void Load(us::ModuleContext* context) { //The PMD CamBoard-Factory gets activated as soon as the user toggels one the PMD-parameter in Cmake to on #ifdef MITK_USE_TOF_PMDCAMCUBE //Register Cam Cube Factory ToFCameraPMDCamCubeDeviceFactory* toFCameraPMDCamCubeDeviceFactory = new ToFCameraPMDCamCubeDeviceFactory(); us::ServiceProperties camCubeFactoryProps; camCubeFactoryProps["ToFFactoryName"] = toFCameraPMDCamCubeDeviceFactory->GetFactoryName(); context->RegisterService(toFCameraPMDCamCubeDeviceFactory,camCubeFactoryProps); toFCameraPMDCamCubeDeviceFactory->ConnectToFDevice(); //Register PMD Raw Data Cam Cube DeviceFactory ToFCameraPMDRawDataCamCubeDeviceFactory* toFCameraPMDRawDataCamCubeDeviceFactory = new ToFCameraPMDRawDataCamCubeDeviceFactory(); us::ServiceProperties rawCamCubeFactoryProps; rawCamCubeFactoryProps["ToFFactoryName"] = toFCameraPMDRawDataCamCubeDeviceFactory->GetFactoryName(); context->RegisterService(toFCameraPMDRawDataCamCubeDeviceFactory,rawCamCubeFactoryProps); toFCameraPMDRawDataCamCubeDeviceFactory->ConnectToFDevice(); m_Factories.push_back(toFCameraPMDCamCubeDeviceFactory); m_Factories.push_back(toFCameraPMDRawDataCamCubeDeviceFactory); #endif //The PMD O3-Factory gets activated as soon as the user toggels one the PMD-parameter in Cmake to on #ifdef MITK_USE_TOF_PMDO3 //Implementing PMD O3D DeviceFactory ToFCameraPMDO3DeviceFactory* toFCameraPMDO3DeviceFactory = new ToFCameraPMDO3DeviceFactory(); us::ServiceProperties o3FactoryProps; o3FactoryProps["ToFFactoryName"] = toFCameraPMDO3DeviceFactory->GetFactoryName(); context->RegisterService(toFCameraPMDO3DeviceFactory,o3FactoryProps); toFCameraPMDO3DeviceFactory->ConnectToFDevice(); m_Factories.push_back(toFCameraPMDO3DeviceFactory); #endif //The PMD CamBoard-Factory gets activated as soon as the user toggels one the PMD-parameter in Cmake to on #ifdef MITK_USE_TOF_PMDCAMBOARD //Implementing CamBoardDeviceFactory ToFCameraPMDCamBoardDeviceFactory* toFCameraPMDCamBoardDeviceFactory = new ToFCameraPMDCamBoardDeviceFactory(); us::ServiceProperties camBoardFactoryProps; camBoardFactoryProps["ToFFactoryName"] = toFCameraPMDCamBoardDeviceFactory->GetFactoryName(); context->RegisterService(toFCameraPMDCamBoardDeviceFactory, camBoardFactoryProps); toFCameraPMDCamBoardDeviceFactory->ConnectToFDevice(); //Implementing PMD Raw Data Cam Board DeviceFactory ToFCameraPMDRawDataCamBoardDeviceFactory* toFCameraPMDRawDataCamBoardDeviceFactory = new ToFCameraPMDRawDataCamBoardDeviceFactory(); us::ServiceProperties rawCamBoardFactoryProps; rawCamBoardFactoryProps["ToFFactoryName"] = toFCameraPMDRawDataCamBoardDeviceFactory->GetFactoryName(); context->RegisterService(toFCameraPMDRawDataCamBoardDeviceFactory,rawCamBoardFactoryProps); toFCameraPMDRawDataCamBoardDeviceFactory->ConnectToFDevice(); m_Factories.push_back(toFCameraPMDCamBoardDeviceFactory); m_Factories.push_back(toFCameraPMDRawDataCamBoardDeviceFactory); #endif //The PMD Player Device Factory gets activated as soon as the user toggels one of the PMD-parameters in Cmake to on //Registrating the PMD Player DeviceFactory ToFCameraPMDPlayerDeviceFactory* toFCameraPMDPlayerDeviceFactory = new ToFCameraPMDPlayerDeviceFactory(); us::ServiceProperties pMDPlayerFactoryProps; pMDPlayerFactoryProps["ToFFactoryName"] = toFCameraPMDPlayerDeviceFactory->GetFactoryName(); context->RegisterService(toFCameraPMDPlayerDeviceFactory,pMDPlayerFactoryProps); toFCameraPMDPlayerDeviceFactory->ConnectToFDevice(); m_Factories.push_back(toFCameraPMDPlayerDeviceFactory); } /** * @brief Unload called when the module is unloaded. */ void Unload(us::ModuleContext* ) { } /** @brief Default destructor which deletes all registered factories. */ ~PMDModuleActivator() { if(m_Factories.size() > 0) { for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it) { delete (*it); } } } private: /** * @brief m_Factories List of all registered factories. */ std::list< IToFDeviceFactory* > m_Factories; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkPMD, mitk::PMDModuleActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::PMDModuleActivator) #endif diff --git a/Modules/ToFHardware/mitkToFHardwareActivator.cpp b/Modules/ToFHardware/mitkToFHardwareActivator.cpp index 8deff3ef10..c2f24781a6 100644 --- a/Modules/ToFHardware/mitkToFHardwareActivator.cpp +++ b/Modules/ToFHardware/mitkToFHardwareActivator.cpp @@ -1,74 +1,74 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __mitkToFHardwareModuleActivator_h #define __mitkToFHardwareModuleActivator_h // Microservices #include #include #include #include "mitkIToFDeviceFactory.h" #include "mitkToFConfig.h" #include "mitkToFCameraMITKPlayerDeviceFactory.h" /* * This is the module activator for the "ToFHardware" module. It registers services * like the IToFDeviceFactory. */ namespace mitk { class ToFHardwareActivator : public us::ModuleActivator { public: void Load(us::ModuleContext* context) { //Registering MITKPlayerDevice as MicroService ToFCameraMITKPlayerDeviceFactory* toFCameraMITKPlayerDeviceFactory = new ToFCameraMITKPlayerDeviceFactory(); us::ServiceProperties mitkPlayerFactoryProps; mitkPlayerFactoryProps["ToFFactoryName"] = toFCameraMITKPlayerDeviceFactory->GetFactoryName(); context->RegisterService(toFCameraMITKPlayerDeviceFactory, mitkPlayerFactoryProps); //Create an instance of the player toFCameraMITKPlayerDeviceFactory->ConnectToFDevice(); m_Factories.push_back( toFCameraMITKPlayerDeviceFactory ); } void Unload(us::ModuleContext* ) { } ~ToFHardwareActivator() { if(m_Factories.size() > 0) { for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it) { delete (*it); } } } private: std::list< IToFDeviceFactory* > m_Factories; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkToFHardware, mitk::ToFHardwareActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::ToFHardwareActivator) #endif diff --git a/Modules/US/USHardwareTelemed/mitkUSTelemedActivator.h b/Modules/US/USHardwareTelemed/mitkUSTelemedActivator.h index c8a2eaf95c..aba1ffe6a8 100644 --- a/Modules/US/USHardwareTelemed/mitkUSTelemedActivator.h +++ b/Modules/US/USHardwareTelemed/mitkUSTelemedActivator.h @@ -1,53 +1,53 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __mitkUSTelemedActivator_h #define __mitkUSTelemedActivator_h #include "mitkUSTelemedDevice.h" // Microservices #include #include namespace mitk { class USTelemedActivator : public us::ModuleActivator { public: USTelemedActivator(); virtual ~USTelemedActivator(); /** * \brief Telemed device is created and initialized on module load. * Service registration is done during the initialization process. */ void Load(us::ModuleContext* context); /** * \brief Device pointer is removed on module unload. * Service deregistration is done in the device destructor. */ void Unload(us::ModuleContext* context); protected: USTelemedDevice::Pointer m_Device; }; } // namespace mitk -US_EXPORT_MODULE_ACTIVATOR(MitkUSHardwareTelemed, mitk::USTelemedActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::USTelemedActivator) #endif // __mitkUSTelemedActivator_h \ No newline at end of file diff --git a/Modules/US/mitkUSActivator.h b/Modules/US/mitkUSActivator.h index 35d1ac86a1..a481eb7ff2 100644 --- a/Modules/US/mitkUSActivator.h +++ b/Modules/US/mitkUSActivator.h @@ -1,67 +1,67 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __mitkUSActivator_h #define __mitkUSActivator_h #include "mitkUSVideoDevice.h" // Microservices #include #include namespace mitk { /** * \brief Module activator for the US module. * Loads mitk::USVideoDevice objects from hard disk on module load and write * them to hard disk on module unload. * * Pointers to mitk::USDevice objects are held to make sure that they * will not be deleted while the module is loaded. A service event listener is * registered, so that pointers to devices which are registered into micro * service from a plugin for example can be held here, too. */ class USActivator : public us::ModuleActivator { public: USActivator(); virtual ~USActivator(); /** * \brief The mitk::USVideoDevice obejcts are loaded from hard disk and registered into micro service. */ void Load(us::ModuleContext* context); /** * \brief Registered mitk::USVideoDevice objects are stored to hard disk an deregistered from micro service. */ void Unload(us::ModuleContext* context); protected: /** *\brief Listens to ServiceRegistry changes and updates the list of mitk::USDevice object accordingly. */ void OnServiceEvent(const us::ServiceEvent event); us::ModuleContext* m_Context; std::vector m_Devices; }; } // namespace mitk -US_EXPORT_MODULE_ACTIVATOR(MitkUS, mitk::USActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::USActivator) #endif // __mitkUSActivator_h diff --git a/Modules/USUI/mitkUSUIActivator.h b/Modules/USUI/mitkUSUIActivator.h index 1b21583cac..a4e4e59a14 100644 --- a/Modules/USUI/mitkUSUIActivator.h +++ b/Modules/USUI/mitkUSUIActivator.h @@ -1,65 +1,65 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef __mitkUSUIActivator_h #define __mitkUSUIActivator_h #include "QmitkUSAbstractCustomWidget.h" // Microservices #include #include class QmitkUSControlsCustomVideoDeviceWidget; namespace mitk { class USUICustomWidgetFactory; /** * \brief Module activator for the USUI module. * Registers custom widget for mitk::USVideoDevice as microservice. */ class USUIActivator : public us::ModuleActivator { public: USUIActivator(); virtual ~USUIActivator(); /** * Custom video device widget is registered as a micro service on module * load. A plugin can get this widget then when using a * mitk::USVideoDevice. */ void Load(us::ModuleContext* context); /** * Custom video device widget is deregistered from micro service on module * unload. */ void Unload(us::ModuleContext* context); protected: us::ServiceRegistration m_ServiceRegistration; USUICustomWidgetFactory* m_CustomWidgetFactory; QmitkUSControlsCustomVideoDeviceWidget* m_CustomVideoDeviceWidget; }; } // namespace mitk -US_EXPORT_MODULE_ACTIVATOR(MitkUSUI, mitk::USUIActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::USUIActivator) #endif // __mitkUSUIActivator_h diff --git a/Modules/VtkShaders/mitkVtkShadersActivator.cpp b/Modules/VtkShaders/mitkVtkShadersActivator.cpp index adb17dc1c5..61f76d33b3 100644 --- a/Modules/VtkShaders/mitkVtkShadersActivator.cpp +++ b/Modules/VtkShaders/mitkVtkShadersActivator.cpp @@ -1,59 +1,59 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include #include #include #include #include #include #include namespace mitk { class VtkShadersActivator : public us::ModuleActivator { public: VtkShadersActivator() { } ~VtkShadersActivator() { } void Load(us::ModuleContext* context) { m_VtkShaderRepository.reset(new VtkShaderRepository); context->RegisterService(m_VtkShaderRepository.get()); } void Unload(us::ModuleContext*) { m_VtkShaderRepository.reset(NULL); } private: VtkShadersActivator(const VtkShadersActivator&); VtkShadersActivator& operator=(const VtkShadersActivator&); std::auto_ptr m_VtkShaderRepository; }; } -US_EXPORT_MODULE_ACTIVATOR(MitkVtkShaders, mitk::VtkShadersActivator) +US_EXPORT_MODULE_ACTIVATOR(mitk::VtkShadersActivator)