SynchronizationLabObjectFactory.cpp

Go to the documentation of this file.
00001 //Copyright GSI 2012
00002 #include <sstream>
00003 #include <fesa-core/Synchronization/SynchronizationLabObjectFactory.h>
00004 #include <fesa-core-gsi/Exception/GSIException.h>
00005 
00006 #include <fesa-core-gsi/Synchronization/GSICycleDescriptor.h>
00007 #include <fesa-core-gsi/Synchronization/GSISimulatedCycleDescriptor.h>
00008 
00009 #include <fesa-core-gsi/Synchronization/TimingContext.h>
00010 #include <fesa-core-gsi/Synchronization/TimingSimulationContext.h>
00011 
00012 #include <fesa-core/Core/AbstractEquipment.h>
00013 
00014 namespace fesa
00015 {
00016 
00017 SynchronizationLabObjectFactory* SynchronizationLabObjectFactory::instance_ = NULL;
00018 
00019 SynchronizationLabObjectFactory::SynchronizationLabObjectFactory()
00020 {
00021 
00022 }
00023 SynchronizationLabObjectFactory::~SynchronizationLabObjectFactory()
00024 {
00025 
00026 }
00027 
00028 SynchronizationLabObjectFactory* SynchronizationLabObjectFactory::getInstance()
00029 {
00030 
00031     if (instance_ == NULL)
00032         instance_ = new fesa::SynchronizationLabObjectFactory();
00033     return instance_;
00034 
00035 }
00036 
00037 CycleDescriptor* SynchronizationLabObjectFactory::createOrGetEventCycleDescriptor(const std::string& timingDomain, const std::string& timingCriterion)
00038 {
00039     return createCycleDescriptor(timingDomain, timingCriterion);
00040 }
00041 
00042 CycleDescriptor* SynchronizationLabObjectFactory::createCycleDescriptorLab(const std::string& timingDomain,
00043                                                                            const std::string& timingCriterion) // Possible name formats: PSB.USER(timingDescriptorName) or PSB.USER.AD (cycleSelector)
00044 {
00045     const fesa::ProcessConfiguration* configuration =  AbstractEquipment::getInstance()->getProcessConfiguration();
00046     if(configuration->isDefined(fesa::PropertyTag::TIMING_SIMULATION))
00047     {
00048         const std::string file = configuration->getStringValue(fesa::PropertyTag::TIMING_SIMULATION);
00049         return new fesaGSI::GSISimulatedCycleDescriptor(timingDomain, timingCriterion, file);
00050     }
00051     return new fesaGSI::GSICycleDescriptor(timingDomain, timingCriterion);
00052 }
00053 
00054 void fesa::SynchronizationLabObjectFactory::releaseInstance()
00055 {
00056     if (instance_ != NULL)
00057     {
00058         delete instance_;
00059         instance_ = NULL;
00060     }
00061 }
00062 
00063 MultiplexingContext* SynchronizationLabObjectFactory::createTimingContext(long long cycleStamp,  const std::string& cycleName)
00064 {
00065     return (new fesaGSI::TimingContext(cycleStamp, cycleName));
00066 }
00067 
00068 } // fesa

Generated on 25 Jan 2013 for fesa-core-gsi by  doxygen 1.6.1