X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fstd%2Fsrc%2FbbstdStringToVector.h;h=c31ba56e1a0a8a01da1d05ceb39e933425706a06;hb=6ad84645e7e5971e3a7b166bd3099c06c343010f;hp=bbb6de1b015338642ad7bff91060355b7dca1dfb;hpb=001c522c9cd723fd522afda8a3882607c2565b85;p=bbtk.git diff --git a/packages/std/src/bbstdStringToVector.h b/packages/std/src/bbstdStringToVector.h index bbb6de1..c31ba56 100644 --- a/packages/std/src/bbstdStringToVector.h +++ b/packages/std/src/bbstdStringToVector.h @@ -1,69 +1,71 @@ #ifndef __bbstdStringToVector_INCLUDED_h__ #define __bbstdStringToVector_INCLUDED_h__ -#include "bbtkUserBlackBox.h" +#include "bbtkAtomicBlackBox.h" namespace bbstd { -//================================================================= -// UserBlackBox declaration -template -class StringToVector : public bbtk::UserBlackBox -{ - BBTK_USER_BLACK_BOX_INTERFACE(StringToVector,bbtk::UserBlackBox); + //================================================================= + // 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&); -}; + BBTK_PROCESS(DoIt); + void DoIt(); + T decode_item(const std::string&); + }; + //================================================================= -//================================================================= - -// UserBlackBox description + //================================================================= + // BlackBox description BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(StringToVector); - BBTK_NAME("StringTo"+bbtk::TypeName >()); + 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::TypeName >()); - BBTK_TEMPLATE_INPUT(StringToVector, In,"Input",std::string); - typedef std::vector Tvector; - BBTK_TEMPLATE_OUTPUT(StringToVector, Out,"Output",Tvector); + 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; -} -//================================================================= - - + //================================================================= + + //================================================================= + 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__