#include <bbstdStringToVector.h>
Public Member Functions | |
template<> | |
int8_t | decode_item (const std::string &s) |
template<> | |
uint8_t | decode_item (const std::string &s) |
template<> | |
int16_t | decode_item (const std::string &s) |
template<> | |
uint16_t | decode_item (const std::string &s) |
template<> | |
int32_t | decode_item (const std::string &s) |
template<> | |
uint32_t | decode_item (const std::string &s) |
template<> | |
long | decode_item (const std::string &s) |
template<> | |
float | decode_item (const std::string &s) |
template<> | |
double | decode_item (const std::string &s) |
template<> | |
std::string | decode_item (const std::string &s) |
Private Member Functions | |
BBTK_TEMPLATE_BLACK_BOX_INTERFACE (StringToVector, bbtk::AtomicBlackBox, T) | |
BBTK_DECLARE_INPUT (In, std::string) | |
BBTK_DECLARE_OUTPUT (Out, std::vector< T >) | |
BBTK_PROCESS (DoIt) | |
void | DoIt () |
T | decode_item (const std::string &) |
Definition at line 42 of file bbstdStringToVector.h.
bbstd::StringToVector< T >::BBTK_TEMPLATE_BLACK_BOX_INTERFACE | ( | StringToVector< T > | , | |
bbtk::AtomicBlackBox | , | |||
T | ||||
) | [private] |
bbstd::StringToVector< T >::BBTK_DECLARE_INPUT | ( | In | , | |
std::string | ||||
) | [private] |
bbstd::StringToVector< T >::BBTK_DECLARE_OUTPUT | ( | Out | , | |
std::vector< T > | ||||
) | [private] |
bbstd::StringToVector< T >::BBTK_PROCESS | ( | DoIt | ) | [private] |
void bbstd::StringToVector< T >::DoIt | ( | ) | [inline, private] |
Definition at line 70 of file bbstdStringToVector.h.
References bbstd::StringToVector< T >::decode_item().
00071 { 00072 // std::cout << "StringToVector<"<<bbtk::TypeName<T>()<<">::DoIt()"<<std::endl; 00073 00074 typedef T type; 00075 std::string delimiters(" ,;"); 00076 std::string str(bbGetInputIn()); 00077 // std::cout << "'"<< str << "'"<<std::endl; 00078 // Skip delimiters at beginning. 00079 std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); 00080 // Find first "non-delimiter". 00081 std::string::size_type pos = str.find_first_of(delimiters, lastPos); 00082 bbmOutputOut.clear(); 00083 while (std::string::npos != pos || std::string::npos != lastPos) 00084 { 00085 // Found a token, add it to the vector. 00086 bbmOutputOut.push_back( 00087 this->decode_item( str.substr(lastPos, pos - lastPos) ) ); 00088 // std::cout << this->bbGetOutputOut().back() << std::endl; 00089 // Skip delimiters. Note the "not_of" 00090 lastPos = str.find_first_not_of(delimiters, pos); 00091 // Find next "non-delimiter" 00092 pos = str.find_first_of(delimiters, lastPos); 00093 } 00094 // std::cout << "s=" << this->bbGetOutputOut().size() << std::endl; 00095 }
T bbstd::StringToVector< T >::decode_item | ( | const std::string & | ) | [private] |
Referenced by bbstd::StringToVector< T >::DoIt().
int8_t bbstd::StringToVector< int8_t >::decode_item | ( | const std::string & | s | ) | [inline] |
uint8_t bbstd::StringToVector< uint8_t >::decode_item | ( | const std::string & | s | ) | [inline] |
int16_t bbstd::StringToVector< int16_t >::decode_item | ( | const std::string & | s | ) | [inline] |
uint16_t bbstd::StringToVector< uint16_t >::decode_item | ( | const std::string & | s | ) | [inline] |
int32_t bbstd::StringToVector< int32_t >::decode_item | ( | const std::string & | s | ) | [inline] |
uint32_t bbstd::StringToVector< uint32_t >::decode_item | ( | const std::string & | s | ) | [inline] |
long bbstd::StringToVector< long >::decode_item | ( | const std::string & | s | ) | [inline] |
Definition at line 75 of file bbstdStringToVector.cxx.
00076 { 00077 // std::cout << bbGetFullName() << " v="<<s<<std::endl; 00078 return (long)atoi ( s.c_str() ); 00079 }
float bbstd::StringToVector< float >::decode_item | ( | const std::string & | s | ) | [inline] |
double bbstd::StringToVector< double >::decode_item | ( | const std::string & | s | ) | [inline] |
std::string bbstd::StringToVector< std::string >::decode_item | ( | const std::string & | s | ) | [inline] |