]> Creatis software - bbtk.git/blob - packages/std/src/bbstdVectorToString.cxx
=== MAJOR RELEASE ====
[bbtk.git] / packages / std / src / bbstdVectorToString.cxx
1 #include "bbstdVectorToString.h"
2 #include "bbstdPackage.h"
3
4
5 namespace bbstd
6 {
7   //====================================================================
8   BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION(VectorToString,
9                                          bbtk::AtomicBlackBox);
10   //====================================================================
11   
12   
13   
14   /*
15   //====================================================================
16   // Template specialization of encode_item
17   template <> int8_t VectorToString<int8_t> ::encode_item(const std::string& s)
18   {
19     return (int8_t)atoi ( s.c_str() );
20   }
21   
22   template <> uint8_t VectorToString<uint8_t> ::encode_item(const std::string& s)
23   {
24     return (uint8_t)atoi ( s.c_str() );
25 }
26
27 template <> int16_t VectorToString<int16_t> ::encode_item(const std::string& s)
28 {
29   return (int16_t)atoi ( s.c_str() );
30 }
31
32 template <> uint16_t VectorToString<uint16_t> ::encode_item(const std::string& s)
33 {
34   return (uint16_t)atoi ( s.c_str() );
35 }
36
37 template <> int32_t VectorToString<int32_t> ::encode_item(const std::string& s)
38 {
39   return (int32_t)atoi ( s.c_str() );
40 }
41
42 template <> uint32_t VectorToString<uint32_t> ::encode_item(const std::string& s) 
43 {
44   return (uint32_t)atoi ( s.c_str() );
45 }
46
47 template <> long VectorToString<long> ::encode_item(const std::string& s)
48 {
49   return (long)atoi ( s.c_str() );
50 }
51
52 template <> float VectorToString<float> ::encode_item(const std::string& s)
53 {
54   return (float)atof ( s.c_str() );
55 }
56
57 template <> double VectorToString<double> ::encode_item(const std::string& s)
58 {
59   return atof ( s.c_str() );
60 }
61
62 template <> std::string VectorToString<std::string> ::encode_item(const std::string& s)
63 {
64   return s;
65 }
66   */
67
68 //====================================================================
69
70 //====================================================================
71 // Add the specialized adaptors to the package
72
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 //====================================================================
85
86 } // namespace bbstd