13 #include <QApplication> 14 #include <ctkPluginContext.h> 38 LogicManager* LogicManager::mInstance = NULL;
68 void LogicManager::initializeServices()
70 CX_LOG_INFO() <<
" --- Initialize services for " << qApp->applicationName() <<
"...";
74 mPluginFramework->loadState();
82 void LogicManager::basicSetup()
88 mPluginFramework->start();
89 mPluginFramework->setSearchPaths(QStringList());
91 this->createLegacyStoredServices();
94 void LogicManager::createLegacyStoredServices()
113 mComponent->destroy();
115 mComponent = component;
118 mComponent->create();
123 QMetaObject::invokeMethod(
this,
"onRestartWithNewProfile",
124 Qt::QueuedConnection,
125 Q_ARG(QString, uid));
128 void LogicManager::onRestartWithNewProfile(QString uid)
137 this->shutdownServices();
139 this->initializeServices();
142 void LogicManager::shutdownServices()
144 CX_LOG_INFO() <<
" --- Shutting down " << qApp->applicationName() <<
"...";
149 mComponent->destroy();
151 mPluginFramework->stop();
153 this->shutdownLegacyStoredServices();
154 mPluginFramework.reset();
162 void LogicManager::shutdownLegacyStoredServices()
164 this->shutdownService(mSpaceProvider,
"SpaceProvider");
165 this->shutdownService(mStateService,
"StateService");
166 this->shutdownService(mViewService,
"ViewService");
167 this->shutdownService(mTrackingService,
"TrackingService");
168 this->shutdownService(mPatientModelService,
"PatientModelService");
169 this->shutdownService(mVideoService,
"VideoService");
170 this->shutdownService(mSessionStorageService,
"SessionStorageService");
175 void LogicManager::shutdownService(boost::shared_ptr<T>& service, QString name)
183 return mPatientModelService;
187 return mTrackingService;
191 return mVideoService;
195 return mStateService;
199 return mSpaceProvider;
207 return mSessionStorageService;
211 return mPluginFramework;
227 LogicManager::LogicManager()
231 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.