1 #include "bbstdStringToVector.h"
2 #include "bbstdPackage.h"
7 //====================================================================
8 BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION(StringToVector,
10 //====================================================================
15 //====================================================================
16 // Template specialization of decode_item
17 template <> int8_t StringToVector<int8_t> ::decode_item(const std::string& s)
19 return (int8_t)atoi ( s.c_str() );
22 template <> uint8_t StringToVector<uint8_t> ::decode_item(const std::string& s)
24 return (uint8_t)atoi ( s.c_str() );
27 template <> int16_t StringToVector<int16_t> ::decode_item(const std::string& s)
29 return (int16_t)atoi ( s.c_str() );
32 template <> uint16_t StringToVector<uint16_t> ::decode_item(const std::string& s)
34 return (uint16_t)atoi ( s.c_str() );
37 template <> int32_t StringToVector<int32_t> ::decode_item(const std::string& s)
39 return (int32_t)atoi ( s.c_str() );
42 template <> uint32_t StringToVector<uint32_t> ::decode_item(const std::string& s)
44 return (uint32_t)atoi ( s.c_str() );
47 template <> long StringToVector<long> ::decode_item(const std::string& s)
49 // std::cout << bbGetFullName() << " v="<<s<<std::endl;
50 return (long)atoi ( s.c_str() );
53 template <> float StringToVector<float> ::decode_item(const std::string& s)
55 return (float)atof ( s.c_str() );
58 template <> double StringToVector<double> ::decode_item(const std::string& s)
60 return atof ( s.c_str() );
63 template <> std::string StringToVector<std::string> ::decode_item(const std::string& s)
68 //====================================================================
70 //====================================================================
71 // Add the specialized adaptors to the package
73 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,int8_t);
74 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,uint8_t);
75 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,int16_t);
76 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,uint16_t);
77 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,int32_t);
78 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,uint32_t);
79 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,long);
80 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,float);
81 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,double);
82 typedef std::string string;
83 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,StringToVector,string);
84 //====================================================================