From: Claire Mouton Date: Wed, 7 Nov 2012 12:40:06 +0000 (+0000) Subject: Feature #1742 Add a box providing the size of a vector (an example has been added). X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4050e8d379084f375ffc680306f1991d7106697a;p=bbtk.git Feature #1742 Add a box providing the size of a vector (an example has been added). --- diff --git a/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbg b/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbg new file mode 100644 index 0000000..ca85ff1 --- /dev/null +++ b/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbg @@ -0,0 +1,31 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBG BlackBox Diagram file +# - /home/mouton/Creatis/all/creatools_source/bbtk/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbg +# ---------------------------------- + +APP_START +CATEGORY: +DESCRIPTION:Description ?? +AUTHOR:Author ?? +COMPLEXBOX:FALSE +COMPLEXINPUTS:0 +BOXES:2 +BOX +std:GetDoubleVectorSize:Box00 +ISEXEC:FALSE +-48.716935:48.004699:-900.000000 +22.458065:38.004699:-900.000000 +PORT +In:"1 2 3 4 5" +FIN_BOX +BOX +wx:OutputText:Box01 +ISEXEC:TRUE +-50.996090:21.509524:-900.000000 +-5.421090:11.509524:-900.000000 +FIN_BOX +CONNECTIONS:1 +CONNECTION +Box00:VectorSize:Box01:In +NumberOfControlPoints:0 +APP_END diff --git a/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbs b/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbs new file mode 100644 index 0000000..ebade9d --- /dev/null +++ b/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbs @@ -0,0 +1,29 @@ +# ---------------------------------- +# - BBTKGEditor v 1.4 BBS BlackBox Script +# - /home/mouton/Creatis/all/creatools_source/bbtk/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbs +# ---------------------------------- + +# BBTK GEditor Script +# ---------------------- + +include std +include itkvtk +include std +include wx + +author "Author ??" +description "Description ??" +category "" + +new GetDoubleVectorSize Box00 + set Box00.In "1 2 3 4 5" + +new OutputText Box01 + + +connect Box00.VectorSize Box01.In + + + +# Complex input ports +exec Box01 diff --git a/packages/std/src/bbstdGetDoubleVectorSize.cxx b/packages/std/src/bbstdGetDoubleVectorSize.cxx new file mode 100644 index 0000000..2bccfc1 --- /dev/null +++ b/packages/std/src/bbstdGetDoubleVectorSize.cxx @@ -0,0 +1,32 @@ +#include "bbstdGetDoubleVectorSize.h" +#include "bbstdPackage.h" +namespace bbstd +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,GetDoubleVectorSize) +BBTK_BLACK_BOX_IMPLEMENTATION(GetDoubleVectorSize,bbtk::AtomicBlackBox); + +void GetDoubleVectorSize::Process() +{ +// THE MAIN PROCESSING METHOD BODY + int size = bbGetInputIn().size(); + bbSetOutputVectorSize(size); +} + +void GetDoubleVectorSize::bbUserSetDefaultValues() +{ + // THE DEFAULT INPUT/OUTPUT VALUES + bbSetOutputVectorSize(-1); +} + +void GetDoubleVectorSize::bbUserInitializeProcessing() +{ + +} + +void GetDoubleVectorSize::bbUserFinalizeProcessing() +{ + +} +} +// EO namespace bbstd diff --git a/packages/std/src/bbstdGetDoubleVectorSize.h b/packages/std/src/bbstdGetDoubleVectorSize.h new file mode 100644 index 0000000..c3653ff --- /dev/null +++ b/packages/std/src/bbstdGetDoubleVectorSize.h @@ -0,0 +1,33 @@ +#ifndef __bbstdGetDoubleVectorSize_h_INCLUDED__ +#define __bbstdGetDoubleVectorSize_h_INCLUDED__ +#include "bbstd_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +namespace bbstd +{ + +class bbstd_EXPORT GetDoubleVectorSize + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(GetDoubleVectorSize,bbtk::AtomicBlackBox); + BBTK_DECLARE_INPUT(In,std::vector); + BBTK_DECLARE_OUTPUT(VectorSize, double); + BBTK_PROCESS(Process); + void Process(); +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(GetDoubleVectorSize,bbtk::AtomicBlackBox); +BBTK_NAME("GetDoubleVectorSize"); +BBTK_AUTHOR("Claire Mouton"); +BBTK_DESCRIPTION("Retrieves the size of a vector of double."); +BBTK_CATEGORY("std"); +BBTK_INPUT(GetDoubleVectorSize,In,"Input vector.",std::vector,""); +BBTK_OUTPUT(GetDoubleVectorSize,VectorSize,"The vector size.",double,""); +BBTK_END_DESCRIBE_BLACK_BOX(GetDoubleVectorSize); +} +// EO namespace bbstd + +#endif // __bbstdGetDoubleVectorSize_h_INCLUDED__ +