13 #include <QApplication> 14 #include <ctkPluginContext.h> 39 LogicManager* LogicManager::mInstance = NULL;
69 void LogicManager::initializeServices()
71 CX_LOG_INFO() <<
" --- Initialize services for " << qApp->applicationName() <<
"...";
75 mPluginFramework->loadState();
84 void LogicManager::basicSetup()
90 mPluginFramework->start();
91 mPluginFramework->setSearchPaths(QStringList());
93 this->createLegacyStoredServices();
96 void LogicManager::createLegacyStoredServices()
116 mComponent->destroy();
118 mComponent = component;
121 mComponent->create();
126 QMetaObject::invokeMethod(
this,
"onRestartWithNewProfile",
127 Qt::QueuedConnection,
128 Q_ARG(QString, uid));
131 void LogicManager::onRestartWithNewProfile(QString uid)
140 this->shutdownServices();
142 this->initializeServices();
145 void LogicManager::shutdownServices()
149 CX_LOG_ERROR() <<
"Trying to shutdown logicmanager when it already shutdown. Aborting shutdown, fix code.";
153 CX_LOG_INFO() <<
" --- Shutting down " << qApp->applicationName() <<
"...";
158 mComponent->destroy();
160 mPluginFramework->stop();
162 this->shutdownLegacyStoredServices();
163 mPluginFramework.reset();
172 void LogicManager::shutdownLegacyStoredServices()
174 this->shutdownService(mSpaceProvider,
"SpaceProvider");
175 this->shutdownService(mStateService,
"StateService");
176 this->shutdownService(mViewService,
"ViewService");
177 this->shutdownService(mTrackingService,
"TrackingService");
178 this->shutdownService(mPatientModelService,
"PatientModelService");
179 this->shutdownService(mVideoService,
"VideoService");
180 this->shutdownService(mSessionStorageService,
"SessionStorageService");
185 void LogicManager::shutdownService(boost::shared_ptr<T>& service, QString name)
193 return mPatientModelService;
197 return mTrackingService;
201 return mVideoService;
205 return mStateService;
209 return mSpaceProvider;
217 return mSessionStorageService;
227 return mPluginFramework;
243 LogicManager::LogicManager()
247 LogicManager::~LogicManager()
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
cxResource_EXPORT ProfilePtr profile()
boost::shared_ptr< class VideoService > VideoServicePtr
boost::shared_ptr< class ApplicationComponent > ApplicationComponentPtr
void restartServicesWithProfile(QString uid)
boost::shared_ptr< class StateService > StateServicePtr
ctkPluginContext * getPluginContext()
static void initializeBasic()
boost::shared_ptr< class TrackingService > TrackingServicePtr
TrackingServicePtr getTrackingService()
static void shutdown()
shutdown service, destroy static object if none holds a reference.
static void initialize()
Initialize logging, static object is guaranteed to exist at least until shutdown. ...
static SessionStorageServicePtr create(ctkPluginContext *pluginContext)
static ProfileManager * getInstance(QString defaultProfile=QString("Laboratory"))
returns the only instance of this class
static VideoServicePtr create(ctkPluginContext *pluginContext)
void setActiveProfile(QString uid)
static TrackingServicePtr create(ctkPluginContext *pluginContext)
Control the custusx backend.
static PatientModelServicePtr create(ctkPluginContext *pluginContext)
SessionStorageServicePtr getSessionStorageService()
VideoServicePtr getVideoService()
static StateServicePtr create(ctkPluginContext *pluginContext)
static LogicManager * getInstance()
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
void restartWithNewProfile(QString uid)
LogicManager * logicManager()
boost::shared_ptr< class PluginFrameworkManager > PluginFrameworkManagerPtr
ViewServicePtr getViewService()
static ViewServicePtr create(ctkPluginContext *pluginContext)
static PluginFrameworkManagerPtr create()
virtual void aboutToStop()=0
void setApplicationComponent(ApplicationComponentPtr component)
PluginFrameworkManagerPtr getPluginFramework()
void requireUnique(int use_count, QString objectName)
SpaceProviderPtr getSpaceProvider()
boost::shared_ptr< class SessionStorageService > SessionStorageServicePtr
static void initialize(ApplicationComponentPtr component=ApplicationComponentPtr())
PatientModelServicePtr getPatientModelService()
StateServicePtr getStateService()
Namespace for all CustusX production code.