00001 #include "otsdaq-core/ConfigurationPluginDataFormats/FESlowControlsConfiguration.h"
00002 #include "otsdaq-core/Macros/ConfigurationPluginMacros.h"
00003
00004 #include "otsdaq-core/ConfigurationInterface/ConfigurationManager.h"
00005
00006 #include <iostream>
00007
00008 using namespace ots;
00009
00010
00011 FESlowControlsConfiguration::FESlowControlsConfiguration(void)
00012 : ConfigurationBase("FESlowControlsConfiguration")
00013 {
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 }
00040
00041
00042 FESlowControlsConfiguration::~FESlowControlsConfiguration(void)
00043 {
00044 }
00045
00046
00047 void FESlowControlsConfiguration::init(ConfigurationManager *configManager)
00048 {
00049
00050 __MOUT__ << "*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*" << std::endl;
00051 __MOUT__ << configManager->__SELF_NODE__ << std::endl;
00052
00053
00054
00055
00056 std::string childType;
00057 auto childrenMap = configManager->__SELF_NODE__.getChildren();
00058 for(auto &childPair: childrenMap)
00059 {
00060
00061 __MOUT__ << childPair.first << std::endl;
00062 childPair.second.getNode(colNames_.colDataType_).getValue(childType);
00063 __MOUT__ << "childType=" << childType << std::endl;
00064
00065 if(childType[childType.size()-1] == 'b')
00066 {
00067 unsigned int sz;
00068 sscanf(&childType[0],"%u",&sz);
00069 if(sz < 1 || sz > 64)
00070 {
00071 __SS__ << "Data type '" << childType << "' for UID=" <<
00072 childPair.first << " is invalid. " <<
00073 " The bit size given was " << sz <<
00074 " and it must be between 1 and 64." << std::endl;
00075 __MOUT_ERR__ << "\n" << ss.str();
00076 throw std::runtime_error(ss.str());
00077 }
00078 }
00079 else if(childType != "char" &&
00080 childType != "short" &&
00081 childType != "int" &&
00082 childType != "unsigned int" &&
00083 childType != "long long " &&
00084 childType != "unsigned long long" &&
00085 childType != "float" &&
00086 childType != "double")
00087 {
00088 __SS__ << "Data type '" << childType << "' for UID=" <<
00089 childPair.first << " is invalid. " <<
00090 "Valid data types (w/size in bytes) are as follows: " <<
00091 "#b (# bits)" <<
00092 ", char (" << sizeof(char) <<
00093 "B), unsigned char (" << sizeof(unsigned char) <<
00094 "B), short (" << sizeof(short) <<
00095 "B), unsigned short (" << sizeof(unsigned short) <<
00096 "B), int (" << sizeof(int) <<
00097 "B), unsigned int (" << sizeof(unsigned int) <<
00098 "B), long long (" << sizeof(long long) <<
00099 "B), unsigned long long (" << sizeof(unsigned long long) <<
00100 "B), float (" << sizeof(float) <<
00101 "B), double (" << sizeof(double) <<
00102 "B)." << std::endl;
00103 __MOUT_ERR__ << "\n" << ss.str();
00104 throw std::runtime_error(ss.str());
00105 }
00106 }
00107 }
00108
00109 DEFINE_OTS_CONFIGURATION(FESlowControlsConfiguration)