1 #include "bbstdVectorToString.h"
2 #include "bbstdPackage.h"
7 //====================================================================
8 BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION(VectorToString,
10 //====================================================================
15 //====================================================================
16 // Template specialization of encode_item
17 template <> int8_t VectorToString<int8_t> ::encode_item(const std::string& s)
19 return (int8_t)atoi ( s.c_str() );
22 template <> uint8_t VectorToString<uint8_t> ::encode_item(const std::string& s)
24 return (uint8_t)atoi ( s.c_str() );
27 template <> int16_t VectorToString<int16_t> ::encode_item(const std::string& s)
29 return (int16_t)atoi ( s.c_str() );
32 template <> uint16_t VectorToString<uint16_t> ::encode_item(const std::string& s)
34 return (uint16_t)atoi ( s.c_str() );
37 template <> int32_t VectorToString<int32_t> ::encode_item(const std::string& s)
39 return (int32_t)atoi ( s.c_str() );
42 template <> uint32_t VectorToString<uint32_t> ::encode_item(const std::string& s)
44 return (uint32_t)atoi ( s.c_str() );
47 template <> long VectorToString<long> ::encode_item(const std::string& s)
49 return (long)atoi ( s.c_str() );
52 template <> float VectorToString<float> ::encode_item(const std::string& s)
54 return (float)atof ( s.c_str() );
57 template <> double VectorToString<double> ::encode_item(const std::string& s)
59 return atof ( s.c_str() );
62 template <> std::string VectorToString<std::string> ::encode_item(const std::string& s)
68 //====================================================================
70 //====================================================================
71 // Add the specialized adaptors to the package
73 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,int8_t);
74 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,uint8_t);
75 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,int16_t);
76 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,uint16_t);
77 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,int32_t);
78 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,uint32_t);
79 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,long);
80 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,float);
81 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,double);
82 typedef std::string string;
83 BBTK_ADD_TEMPLATE_BLACK_BOX_TO_PACKAGE(std,VectorToString,string);
84 //====================================================================