1 #ifndef _ots_DataManagerSingleton_h_
2 #define _ots_DataManagerSingleton_h_
4 #include "otsdaq-core/DataManager/DataManager.h"
11 class ConfigurationTree;
18 static void deleteInstance (std::string instanceUID)
21 if(theInstances_.find(instanceUID) != theInstances_.end())
23 delete theInstances_[instanceUID];
24 theInstances_.erase(theInstances_.find(instanceUID));
29 static C* getInstance (
const ConfigurationTree& configurationTree,
const std::string& supervisorConfigurationPath,
const std::string& instanceUID)
31 if ( theInstances_.find(instanceUID) == theInstances_.end())
33 __MOUT__ <<
"Creating supervisor application: " << instanceUID <<
" POINTER: " << theInstances_[instanceUID] << std::endl;
34 theInstances_[instanceUID] =
static_cast<DataManager*
>(
new C(configurationTree, supervisorConfigurationPath));
35 std::cout << __COUT_HDR_FL__ <<
"Creating supervisor application: " << instanceUID <<
" POINTER: " << theInstances_[instanceUID] << std::endl;
38 __MOUT__ <<
"An instance of " << instanceUID <<
" already exists so your input parameters are ignored!" << std::endl;
40 return static_cast<C*
>(theInstances_[instanceUID]);
43 static DataManager* getInstance (std::string instanceUID)
45 if ( theInstances_.find(instanceUID) == theInstances_.end())
47 __MOUT__ <<
"Can't find supervisor application " << instanceUID << std::endl;
48 __SS__ <<
"An instance of the class MUST already exists so I am crashing!" << std::endl;
49 __MOUT__ <<
"\n" << ss.str();
51 throw std::runtime_error(ss.str());
54 __MOUT__ <<
"An instance of " << instanceUID <<
" already exists so your input parameters are ignored!" << std::endl;
56 return theInstances_[instanceUID];
61 static std::map<std::string, DataManager*> theInstances_;