00001 // Copyright CERN 2012 - Developed in collaboration with GSI 00002 00003 #ifndef ARRAY_UTILITIES_H_ 00004 #define ARRAY_UTILITIES_H_ 00005 00006 #include <fesa-core/DataStore/Converter.h> 00007 #include <fesa-core/Utilities/StringUtilities.h> 00008 00009 #include <string> 00010 #include <vector> 00011 00012 namespace fesa 00013 { 00014 00019 template<typename T> 00020 class ArrayUtilities 00021 { 00022 public: 00023 00027 ArrayUtilities(); 00028 00034 void fillArray(const std::string& arrayElements, T* array); 00035 00036 }; 00037 00038 template<typename T> 00039 ArrayUtilities<T>::ArrayUtilities() 00040 { 00041 } 00042 00043 template<typename T> 00044 void ArrayUtilities<T>::fillArray(const std::string& arrayElements, T* array) 00045 { 00046 std::vector<std::string> elements; 00047 StringUtilities::getElements(arrayElements, elements); 00048 Converter<T> converter; 00049 for (uint32_t i = 0; i < elements.size(); i++) 00050 { 00051 converter.stringToValue(elements.at(i), &(array[i])); 00052 } 00053 } 00054 00055 } // fesa 00056 00057 #include <fesa-core/DataStore/ConverterSignedChar.h> 00058 #include <fesa-core/DataStore/ConverterBool.h> 00059 00060 #endif // ARRAY_UTILITIES_H_