34 #include <QApplication> 35 #include <ctkPluginContext.h> 59 LogicManager* LogicManager::mInstance = NULL;
89 void LogicManager::initializeServices()
91 CX_LOG_INFO() <<
" --- Initialize services for " << qApp->applicationName() <<
"...";
95 mPluginFramework->loadState();
103 void LogicManager::basicSetup()
109 mPluginFramework->start();
110 mPluginFramework->setSearchPaths(QStringList());
112 this->createLegacyStoredServices();
115 void LogicManager::createLegacyStoredServices()
134 mComponent->destroy();
136 mComponent = component;
139 mComponent->create();
144 QMetaObject::invokeMethod(
this,
"onRestartWithNewProfile",
145 Qt::QueuedConnection,
146 Q_ARG(QString, uid));
149 void LogicManager::onRestartWithNewProfile(QString uid)
158 this->shutdownServices();
160 this->initializeServices();
163 void LogicManager::shutdownServices()
165 CX_LOG_INFO() <<
" --- Shutting down " << qApp->applicationName() <<
"...";
170 mComponent->destroy();
172 mPluginFramework->stop();
174 this->shutdownLegacyStoredServices();
175 mPluginFramework.reset();
183 void LogicManager::shutdownLegacyStoredServices()
185 this->shutdownService(mSpaceProvider,
"SpaceProvider");
186 this->shutdownService(mStateService,
"StateService");
187 this->shutdownService(mViewService,
"ViewService");
188 this->shutdownService(mTrackingService,
"TrackingService");
189 this->shutdownService(mPatientModelService,
"PatientModelService");
190 this->shutdownService(mVideoService,
"VideoService");
191 this->shutdownService(mSessionStorageService,
"SessionStorageService");
196 void LogicManager::shutdownService(boost::shared_ptr<T>& service, QString name)
204 return mPatientModelService;
208 return mTrackingService;
212 return mVideoService;
216 return mStateService;
220 return mSpaceProvider;
228 return mSessionStorageService;
232 return mPluginFramework;
248 LogicManager::LogicManager()
252 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.