00001 //Copyright GSI 2012 00002 #include <fesa-core-gsi/RealTime/RealTimeLabObjectFactory.h> 00003 #include <fesa-core/RealTime/AbstractEventSource.h> 00004 #include <fesa-core/Core/AbstractEquipment.h> 00005 #include <fesa-core-gsi/RealTime/TimingEventSource.h> 00006 #include <fesa-core-gsi/RealTime/TimingEventSourceSCU.h> 00007 #include <fesa-core-gsi/RealTime/TimingSimulationEventSource.h> 00008 00009 00010 namespace fesaGSI 00011 { 00012 00013 RealTimeLabObjectFactory* RealTimeLabObjectFactory::theInstance_ = NULL; 00014 00015 RealTimeLabObjectFactory::RealTimeLabObjectFactory() 00016 { 00017 00018 } 00019 00020 RealTimeLabObjectFactory::~RealTimeLabObjectFactory() 00021 { 00022 00023 } 00024 00025 fesa::AbstractEventSource* RealTimeLabObjectFactory::createTimingEventSource(const std::string& name) 00026 { 00027 00028 //TODO put check if(we are on SCU) here, without the use of appl. arguments 00029 // const fesa::ProcessConfiguration* configuration = fesa::AbstractEquipment::getInstance()->getProcessConfiguration(); 00030 // int argc = configuration->getArgc(); 00031 // char** argv = configuration->getArgv(); 00032 // for (int i = 0; i < argc; i++) 00033 // { 00034 // if (strcasecmp(argv[i],"-SCU") == 0) 00035 // { 00036 // std::cout << "Creating TimingEventSource (SCU-Timing) ..." << std::endl; 00037 // return new TimingEventSourceSCU(); 00038 // } 00039 // } 00040 // std::cout << "Creating TimingEventSource (CERN-Timing) ..." << std::endl; 00041 00042 return new TimingEventSource(); 00043 } 00044 00045 fesa::AbstractEventSource* RealTimeLabObjectFactory::createTimingSimulationEventSource(const std::string& name) 00046 { 00047 const fesa::ProcessConfiguration* configuration = fesa::AbstractEquipment::getInstance()->getProcessConfiguration(); 00048 const std::string file = configuration->getStringValue(fesa::PropertyTag::TIMING_SIMULATION); 00049 return new TimingSimulationEventSource(name,file,fesa::TimingSimulationSource); 00050 } 00051 00052 RealTimeLabObjectFactory* RealTimeLabObjectFactory::getInstance() 00053 { 00054 if (theInstance_ == NULL) 00055 theInstance_ = new RealTimeLabObjectFactory(); 00056 return theInstance_; 00057 } 00058 00059 }// end namespace