]> Creatis software - bbtk.git/commitdiff
Feature #1742 Add a box providing the size of a vector (an example has been added).
authorClaire Mouton <Claire.Mouton@creatis.insa-lyon.fr>
Wed, 7 Nov 2012 12:40:06 +0000 (12:40 +0000)
committerClaire Mouton <Claire.Mouton@creatis.insa-lyon.fr>
Wed, 7 Nov 2012 12:40:06 +0000 (12:40 +0000)
packages/std/bbs/appli/exampleGetDoubleVectorSize.bbg [new file with mode: 0644]
packages/std/bbs/appli/exampleGetDoubleVectorSize.bbs [new file with mode: 0644]
packages/std/src/bbstdGetDoubleVectorSize.cxx [new file with mode: 0644]
packages/std/src/bbstdGetDoubleVectorSize.h [new file with mode: 0644]

diff --git a/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbg b/packages/std/bbs/appli/exampleGetDoubleVectorSize.bbg
new file mode 100644 (file)
index 0000000..ca85ff1
--- /dev/null
@@ -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:<VOID>
+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 (file)
index 0000000..ebade9d
--- /dev/null
@@ -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 "<VOID>"
+
+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 (file)
index 0000000..2bccfc1
--- /dev/null
@@ -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 (file)
index 0000000..c3653ff
--- /dev/null
@@ -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<double>);
+  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<double>,"");
+BBTK_OUTPUT(GetDoubleVectorSize,VectorSize,"The vector size.",double,"");
+BBTK_END_DESCRIBE_BLACK_BOX(GetDoubleVectorSize);
+}
+// EO namespace bbstd
+
+#endif // __bbstdGetDoubleVectorSize_h_INCLUDED__
+