34 #include <QApplication>
35 #include <ctkPluginContext.h>
95 LogicManager* LogicManager::mInstance = NULL;
120 void LogicManager::initializeServices()
122 CX_LOG_INFO() <<
" --- Initialize services for " << qApp->applicationName() <<
"...";
128 mPluginFramework->start();
143 mPluginFramework->loadState();
146 mComponent->create();
153 mComponent->destroy();
155 mComponent = component;
158 mComponent->create();
163 QMetaObject::invokeMethod(
this,
"onRestartWithNewProfile",
164 Qt::QueuedConnection,
165 Q_ARG(QString, uid));
168 void LogicManager::onRestartWithNewProfile(QString uid)
172 this->shutdownServices();
174 this->initializeServices();
177 void LogicManager::shutdownServices()
179 CX_LOG_INFO() <<
" --- Shutting down " << qApp->applicationName() <<
"...";
184 mComponent->destroy();
186 mPluginFramework->stop();
188 this->shutdownService(mSpaceProvider,
"SpaceProvider");
189 this->shutdownService(mStateService,
"StateService");
190 this->shutdownService(mViewService,
"ViewService");
191 this->shutdownService(mTrackingService,
"TrackingService");
192 this->shutdownService(mPatientModelService,
"PatientModelService");
193 this->shutdownService(mVideoService,
"VideoService");
194 this->shutdownService(mSessionStorageService,
"SessionStorageService");
196 this->shutdownService(mPluginFramework,
"PluginFramework");
206 void LogicManager::shutdownService(boost::shared_ptr<T>& service, QString name)
214 return mPatientModelService;
218 return mTrackingService;
222 return mVideoService;
226 return mStateService;
230 return mSpaceProvider;
238 return mSessionStorageService;
242 return mPluginFramework;
258 LogicManager::LogicManager()
262 LogicManager::~LogicManager()
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
cxResource_EXPORT ProfilePtr profile()
boost::shared_ptr< class VideoService > VideoServicePtr
boost::shared_ptr< class ApplicationComponent > ApplicationComponentPtr
boost::shared_ptr< class StateService > StateServicePtr
ctkPluginContext * getPluginContext()
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. ...
cxLogicManager_EXPORT StateServicePtr stateService()
static SessionStorageServicePtr create(ctkPluginContext *pluginContext)
static VideoServicePtr create(ctkPluginContext *pluginContext)
static VisualizationServicePtr create(ctkPluginContext *pluginContext)
boost::shared_ptr< class VisualizationService > ViewServicePtr
void setActiveProfile(QString uid)
static TrackingServicePtr create(ctkPluginContext *pluginContext)
Control the custusx backend.
static PatientModelServicePtr create(ctkPluginContext *pluginContext)
SessionStorageServicePtr getSessionStorageService()
VideoServicePtr getVideoService()
virtual void aboutToStop()=0
static ProfileManager * getInstance()
returns the only instance of this class
static StateServicePtr create(ctkPluginContext *pluginContext)
cxLogicManager_EXPORT SessionStorageServicePtr sessionStorageService()
static LogicManager * getInstance()
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
void restartWithNewProfile(QString uid)
cxLogicManager_EXPORT SpaceProviderPtr spaceProvider()
LogicManager * logicManager()
cxLogicManager_EXPORT ViewServicePtr viewService()
cxLogicManager_EXPORT VideoServicePtr videoService()
cxLogicManager_EXPORT PatientModelServicePtr patientService()
boost::shared_ptr< class PluginFrameworkManager > PluginFrameworkManagerPtr
ViewServicePtr getViewService()
cxLogicManager_EXPORT TrackingServicePtr trackingService()
static PluginFrameworkManagerPtr create()
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()