#ifndef __bbstdStringToVector_INCLUDED_h__ #define __bbstdStringToVector_INCLUDED_h__ #include "bbtkAtomicBlackBox.h" namespace bbstd { //================================================================= // BlackBox declaration template class StringToVector : public bbtk::AtomicBlackBox { BBTK_USER_BLACK_BOX_INTERFACE(StringToVector,bbtk::AtomicBlackBox); BBTK_DECLARE_INPUT(In,std::string); BBTK_DECLARE_OUTPUT(Out,std::vector); BBTK_PROCESS(DoIt); void DoIt(); T decode_item(const std::string&); }; //================================================================= //================================================================= // BlackBox description BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(StringToVector); BBTK_NAME("StringTo"+bbtk::HumanTypeName >()); BBTK_AUTHOR("laurent.guigues@creatis.insa-lyon.fr"); BBTK_CATEGORY("adaptor"); BBTK_DEFAULT_ADAPTOR(); BBTK_DESCRIPTION("Converts the content of the input string to a " +bbtk::HumanTypeName >() +" ("+bbtk::TypeName >()+")"); BBTK_TEMPLATE_INPUT(StringToVector, In,"Input",std::string); typedef std::vector Tvector; BBTK_TEMPLATE_OUTPUT(StringToVector, Out,"Output",Tvector); BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(StringToVector); //================================================================= //================================================================= template void StringToVector::DoIt() { // std::cout << "StringToVector<"<()<<">::DoIt()"<decode_item( str.substr(lastPos, pos - lastPos) ) ); // std::cout << this->bbGetOutputOut().back() << std::endl; // Skip delimiters. Note the "not_of" lastPos = str.find_first_not_of(delimiters, pos); // Find next "non-delimiter" pos = str.find_first_of(delimiters, lastPos); } // std::cout << "s=" << this->bbGetOutputOut().size() << std::endl; } //================================================================= } // namespace bbstd #endif //__bbstdStringToVector_INCLUDED_h__