1 #ifndef __bbstdGetVectorElement_INCLUDED_h__
2 #define __bbstdGetVectorElement_INCLUDED_h__
4 #include "bbtkAtomicBlackBox.h"
8 //=================================================================
9 // BlackBox declaration
11 class GetVectorElement : public bbtk::AtomicBlackBox
13 BBTK_TEMPLATE_BLACK_BOX_INTERFACE(GetVectorElement,bbtk::AtomicBlackBox,T);
14 BBTK_DECLARE_INPUT(In,std::vector<T>);
15 BBTK_DECLARE_INPUT(I,int);
16 BBTK_DECLARE_OUTPUT(Out,T);
19 virtual void bbUserConstructor();
21 //=================================================================
23 //=================================================================
24 // BlackBox description
25 BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorElement,bbtk::AtomicBlackBox);
26 BBTK_NAME("Get"+bbtk::HumanTypeName<std::vector<T> >()+"Element");
27 BBTK_AUTHOR("jpr@creatis.insa-lyon.fr");
28 // BBTK_DEFAULT_ADAPTOR();
29 BBTK_DESCRIPTION("Gets the i-th element from the input vector ("+bbtk::TypeName<std::vector<T> >());
30 typedef std::vector<T> Tvector;
31 BBTK_TEMPLATE_INPUT(GetVectorElement, In,"Input",Tvector);
32 BBTK_TEMPLATE_INPUT(GetVectorElement, I, "Input",int);
33 BBTK_TEMPLATE_OUTPUT(GetVectorElement,Out,"Output",T);
34 BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX(GetVectorElement);
35 //=================================================================
37 //=================================================================
39 void GetVectorElement<T>::DoIt()
42 // std::ostringstream oss;
43 int i = bbGetInputI();
44 //oss << bbGetInputIn()[i];
45 //bbSetOutputOut(out.str());
46 bbSetOutputOut(bbGetInputIn()[i]);
48 //=================================================================
50 //=================================================================
52 void GetVectorElement<T>::bbUserConstructor()
56 //=================================================================
60 #endif //__bbstdGetVectorElement_INCLUDED_h__