00001 #ifndef MODULECONFIGURATION_H
00002 #define MODULECONFIGURATION_H
00003
00004 #include <vector>
00005 #include <boost/shared_ptr.hpp>
00006 #include <CommonWithDsp/sctStructure.h>
00007 #include "Sct/Streamable.h"
00008 #include "Sct/SctParameters.h"
00009 #include "ChipConfiguration.h"
00010
00011 using std::vector;
00012 using boost::shared_ptr;
00013
00014 namespace SctData {
00015
00029 class ModuleConfiguration : public virtual Sct::Streamable {
00030
00031 public:
00035 ModuleConfiguration() throw();
00036 virtual ~ModuleConfiguration() throw();
00037
00041 ModuleConfiguration(const ModuleConfiguration& config) throw();
00042
00046 ModuleConfiguration& operator=(const ModuleConfiguration& config) throw();
00047
00048
00049 virtual std::string getClassName() const throw();
00050
00051
00052 ChipConfiguration& getChipConfiguration(const unsigned int chip) throw();
00053 const ChipConfiguration& getChipConfiguration(const unsigned int chip) const throw();
00054
00060 bool isPresent() const throw();
00066 bool isActive() const throw();
00068 void setActive(bool active) throw();
00070 bool usingPrimaryClock() const throw();
00071 void setUsingPrimaryClock(bool usePrimaryClock) throw();
00072
00074 bool channelIsMasked(const unsigned int ichannel) const throw();
00076 void maskChannel(const unsigned int ichannel) throw();
00078
00088 char getGroupId() const throw();
00090 void setGroupId(const char) throw();
00091 private:
00092 ABCDModule configuration;
00093 vector<shared_ptr<ChipConfiguration> > chipConfigs;
00094 friend class ModuleConfigurationIOHelper;
00095 };
00096
00097 class ModuleConfigurationIOHelper {
00098 public:
00099 static ABCDModule& getABCDModule(ModuleConfiguration& config) throw() {return config.configuration;}
00100 static const ABCDModule& getABCDModule(const ModuleConfiguration& config) throw() {return config.configuration;}
00101 };
00102
00103
00104
00105 inline bool ModuleConfiguration::isPresent() const throw() {
00106 return configuration.present == 0 ? false : true;
00107 }
00108
00109 inline bool ModuleConfiguration::isActive() const throw() {
00110 return configuration.active == 0 ? false : true;
00111 }
00112
00113 inline void ModuleConfiguration::setActive(bool active) throw() {
00114 configuration.active = active ? 1 : 0;
00115 }
00116
00117 inline bool ModuleConfiguration::usingPrimaryClock() const throw() {
00118 return configuration.select == 0 ? false : true;
00119 }
00120
00121 inline void ModuleConfiguration::setUsingPrimaryClock(bool usePrimaryClock) throw() {
00122 configuration.select = usePrimaryClock ? 1 : 0;
00123 }
00124
00125 inline char ModuleConfiguration::getGroupId() const throw(){
00126 return configuration.groupId;
00127 }
00128
00129 inline void ModuleConfiguration::setGroupId(const char id) throw(){
00130 configuration.groupId=id;
00131 }
00132 }
00133 #endif //#ifndef MODULECONFIGURATION_H
00134