34 #include <ctkPluginContext.h>
94 LogicManager* LogicManager::mInstance = NULL;
117 void LogicManager::initializeServices()
125 mPluginFramework->start();
140 mPluginFramework->loadState();
143 mComponent->create();
150 mComponent->destroy();
152 mComponent = component;
155 mComponent->create();
160 QMetaObject::invokeMethod(
this,
"onRestartWithNewProfile",
161 Qt::QueuedConnection,
162 Q_ARG(QString, uid));
165 void LogicManager::onRestartWithNewProfile(QString uid)
169 this->shutdownServices();
171 this->initializeServices();
174 void LogicManager::shutdownServices()
178 mComponent->destroy();
180 mPluginFramework->stop();
182 this->shutdownService(mSpaceProvider,
"SpaceProvider");
183 this->shutdownService(mStateService,
"StateService");
184 this->shutdownService(mViewService,
"ViewService");
185 this->shutdownService(mTrackingService,
"TrackingService");
186 this->shutdownService(mPatientModelService,
"PatientModelService");
187 this->shutdownService(mVideoService,
"VideoService");
188 this->shutdownService(mSessionStorageService,
"SessionStorageService");
190 this->shutdownService(mPluginFramework,
"PluginFramework");
199 void LogicManager::shutdownService(boost::shared_ptr<T>& service, QString name)
207 return mPatientModelService;
211 return mTrackingService;
215 return mVideoService;
219 return mStateService;
223 return mSpaceProvider;
231 return mSessionStorageService;
235 return mPluginFramework;
251 LogicManager::LogicManager()
255 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()