1 #ifndef _ots_DataManagerSingleton_h_
2 #define _ots_DataManagerSingleton_h_
7 #include "otsdaq/DataManager/DataManager.h"
11 class ConfigurationTree;
18 static void deleteInstance(std::string instanceUID)
22 if(theInstances_.find(instanceUID) != theInstances_.end())
24 delete theInstances_[instanceUID];
25 theInstances_.erase(theInstances_.find(instanceUID));
30 static C* getInstance(
const ConfigurationTree& configurationTree,
const std::string& supervisorConfigurationPath,
const std::string& instanceUID)
32 if(theInstances_.find(instanceUID) == theInstances_.end())
34 __COUT__ <<
"Creating supervisor application UID: " << instanceUID <<
" POINTER: " << theInstances_[instanceUID] << std::endl;
35 theInstances_[instanceUID] =
static_cast<DataManager*
>(
new C(configurationTree, supervisorConfigurationPath));
36 __COUT__ <<
"Creating supervisor application UID: " << instanceUID <<
" POINTER: " << theInstances_[instanceUID] << std::endl;
39 __COUT__ <<
"An instance of application UID " << instanceUID <<
" already exists so your input parameters are ignored!" << std::endl;
41 return static_cast<C*
>(theInstances_[instanceUID]);
44 static DataManager* getInstance(std::string instanceUID)
46 if(theInstances_.find(instanceUID) == theInstances_.end())
48 __COUT__ <<
"Can't find supervisor application UID " << instanceUID << std::endl;
50 __SS__ <<
"An instance of the class MUST already exists so I am crashing!" << std::endl;
54 __COUT__ <<
"An instance of application UID " << instanceUID <<
" already exists so your input parameters are ignored!" << std::endl;
56 return theInstances_[instanceUID];
62 static std::map<std::string, DataManager*> theInstances_;