Main Page   Modules   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages  

ConfigurationVariable.cpp

Go to the documentation of this file.
00001 #include "ConfigurationVariable.h"
00002 #include "DefaultVariable.h"
00003 #include "Sct/SctParameters.h"
00004 
00005 namespace SctData {
00006 
00007 ConfigurationVariable::ConfigurationVariable(unsigned int typeVal, string variableName, string strategyDescription) : typeVal(typeVal), variableName(variableName), strategyDescription(strategyDescription) {
00008     getMap()[typeVal] = shared_ptr<ConfigurationVariable>(this);
00009 }
00010 
00011 map<unsigned short, shared_ptr<ConfigurationVariable> >& ConfigurationVariable::getMap() throw() {
00012     static VariableTypeMap* map = new VariableTypeMap();
00013     return *map;
00014 }
00015 
00016 bool ConfigurationVariable::operator== (const ConfigurationVariable& var) const throw() {
00017     return typeVal == var.typeVal;
00018 }
00019 
00020 string ConfigurationVariable::getClassName() const throw() {
00021     return "SctData::ConfigurationVariable";
00022 }
00023     
00024 string ConfigurationVariable::getVariableName() const throw() {
00025     return variableName;
00026 }
00027 
00028 string ConfigurationVariable::getStrategyDescription() const throw() {
00029     return strategyDescription;
00030 }
00031 
00032 double ConfigurationVariable::getChipLogicalPoint(const ModuleConfiguration& config, unsigned int chip) const throw() {
00033     return getChipLogicalPoint(getChipActualPoint(config, chip), config, chip);
00034 }
00035 
00036 void ConfigurationVariable::setChipLogicalPoint(double logicalPt, ModuleConfiguration& config, unsigned int chip) const throw() {
00037     setChipActualPoint(getChipActualPoint(logicalPt, config, chip), config, chip);
00038 }
00039 
00040 double ConfigurationVariable::getModuleLogicalPoint(const ModuleConfiguration& config) const throw() {
00041     return getChipLogicalPoint(config, 0);
00042 }
00043 
00044 void ConfigurationVariable::setModuleLogicalPoint(double logicalPt, ModuleConfiguration& config) const throw() {
00045     for (unsigned int i=0; i<Sct::nChipModule; ++i) {
00046     setChipLogicalPoint(logicalPt, config, i);
00047     }
00048 }
00049 
00050 unsigned short ConfigurationVariableIOHelper::getTypeRep(const ConfigurationVariable& var) throw(){
00051     return var.typeVal;
00052 }
00053 
00054 shared_ptr<ConfigurationVariable> ConfigurationVariableIOHelper::getFromTypeRep(unsigned short typeRep) throw() {
00055     if (ConfigurationVariable::getMap().count(typeRep) == 0) {
00056     //Create a new default variable which will automagically add itself to the map
00058     new DefaultVariable(typeRep);
00059     }
00060     return ConfigurationVariable::getMap()[typeRep];
00061 }
00062     
00063 }

Generated on Mon Dec 15 19:36:00 2003 for SCT DAQ/DCS Software by doxygen1.3-rc3