1 #include "bbstdStringToVector.h"
2 #include "bbstdPackage.h"
7 //====================================================================
8 BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(StringToVector,
10 //====================================================================
12 //====================================================================
13 // Template specialization of decode_item
14 template <> int8_t StringToVector<int8_t> ::decode_item(const std::string& s)
16 return (int8_t)atoi ( s.c_str() );
19 template <> uint8_t StringToVector<uint8_t> ::decode_item(const std::string& s)
21 return (uint8_t)atoi ( s.c_str() );
24 template <> int16_t StringToVector<int16_t> ::decode_item(const std::string& s)
26 return (int16_t)atoi ( s.c_str() );
29 template <> uint16_t StringToVector<uint16_t> ::decode_item(const std::string& s)
31 return (uint16_t)atoi ( s.c_str() );
34 template <> int32_t StringToVector<int32_t> ::decode_item(const std::string& s)
36 return (int32_t)atoi ( s.c_str() );
39 template <> uint32_t StringToVector<uint32_t> ::decode_item(const std::string& s)
41 return (uint32_t)atoi ( s.c_str() );
44 template <> long StringToVector<long> ::decode_item(const std::string& s)
46 // std::cout << bbGetFullName() << " v="<<s<<std::endl;
47 return (long)atoi ( s.c_str() );
50 template <> float StringToVector<float> ::decode_item(const std::string& s)
52 return (float)atof ( s.c_str() );
55 template <> double StringToVector<double> ::decode_item(const std::string& s)
57 return atof ( s.c_str() );
60 template <> std::string StringToVector<std::string> ::decode_item(const std::string& s)
65 //====================================================================
67 //====================================================================
68 // Add the specialized adaptors to the package
70 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,int8_t);
71 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,uint8_t);
72 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,int16_t);
73 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,uint16_t);
74 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,int32_t);
75 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,uint32_t);
76 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,long);
77 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,float);
78 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,double);
79 typedef std::string string;
80 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,string);
81 //====================================================================