From f2915d23e6a2d2f1d45cc91b9d8ca2fb4a9af361 Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Mon, 20 Jun 2011 12:10:59 +0000 Subject: [PATCH] no message --- packages/std/src/bbstdStringWriter.cxx | 87 +++++++++++++++++++ packages/std/src/bbstdStringWriter.h | 65 ++++++++++++++ .../toolsbbtk/bbs/boxes/SaveMHD-Button.bbg | 4 +- .../toolsbbtk/bbs/boxes/SaveMHD-Button.bbs | 4 +- 4 files changed, 156 insertions(+), 4 deletions(-) create mode 100644 packages/std/src/bbstdStringWriter.cxx create mode 100644 packages/std/src/bbstdStringWriter.h diff --git a/packages/std/src/bbstdStringWriter.cxx b/packages/std/src/bbstdStringWriter.cxx new file mode 100644 index 0000000..e67c95e --- /dev/null +++ b/packages/std/src/bbstdStringWriter.cxx @@ -0,0 +1,87 @@ +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +#include "bbstdStringWriter.h" +#include "bbstdPackage.h" + +namespace bbstd +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,StringWriter) +BBTK_BLACK_BOX_IMPLEMENTATION(StringWriter,bbtk::AtomicBlackBox); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void StringWriter::Process() +{ + + if (bbGetInputFileName()!="") + { + FILE *ff = fopen(bbGetInputFileName().c_str(),"w"); + if (ff!=NULL) + { + fprintf(ff,"%s \n",bbGetInputIn0().c_str()); + fprintf(ff,"%s \n",bbGetInputIn1().c_str()); + fprintf(ff,"%s \n",bbGetInputIn2().c_str()); + fprintf(ff,"%s \n",bbGetInputIn3().c_str()); + fprintf(ff,"%s \n",bbGetInputIn4().c_str()); + fprintf(ff,"%s \n",bbGetInputIn5().c_str()); + fprintf(ff,"%s \n",bbGetInputIn6().c_str()); + fprintf(ff,"%s \n",bbGetInputIn7().c_str()); + fprintf(ff,"%s \n",bbGetInputIn8().c_str()); + fprintf(ff,"%s \n",bbGetInputIn9().c_str()); + fclose(ff); + } + } + +} +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void StringWriter::bbUserSetDefaultValues() +{ + +// SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX +// Here we initialize the input 'In' to 0 + bbSetInputIn0(""); + bbSetInputIn1(""); + bbSetInputIn2(""); + bbSetInputIn3(""); + bbSetInputIn4(""); + bbSetInputIn5(""); + bbSetInputIn6(""); + bbSetInputIn7(""); + bbSetInputIn8(""); + bbSetInputIn9(""); + bbSetInputFileName(""); + +} +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void StringWriter::bbUserInitializeProcessing() +{ + +// THE INITIALIZATION METHOD BODY : +// Here does nothing +// but this is where you should allocate the internal/output pointers +// if any + + +} +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +void StringWriter::bbUserFinalizeProcessing() +{ + +// THE FINALIZATION METHOD BODY : +// Here does nothing +// but this is where you should desallocate the internal/output pointers +// if any + +} +} +// EO namespace bbstd + + diff --git a/packages/std/src/bbstdStringWriter.h b/packages/std/src/bbstdStringWriter.h new file mode 100644 index 0000000..1043d68 --- /dev/null +++ b/packages/std/src/bbstdStringWriter.h @@ -0,0 +1,65 @@ +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +#ifndef __bbstdStringWriter_h_INCLUDED__ +#define __bbstdStringWriter_h_INCLUDED__ +#include "bbstd_EXPORT.h" +#include "bbtkAtomicBlackBox.h" +#include "iostream" + +namespace bbstd +{ + +class bbstd_EXPORT StringWriter + : + public bbtk::AtomicBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(StringWriter,bbtk::AtomicBlackBox); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== + BBTK_DECLARE_INPUT(In0,std::string); + BBTK_DECLARE_INPUT(In1,std::string); + BBTK_DECLARE_INPUT(In2,std::string); + BBTK_DECLARE_INPUT(In3,std::string); + BBTK_DECLARE_INPUT(In4,std::string); + BBTK_DECLARE_INPUT(In5,std::string); + BBTK_DECLARE_INPUT(In6,std::string); + BBTK_DECLARE_INPUT(In7,std::string); + BBTK_DECLARE_INPUT(In8,std::string); + BBTK_DECLARE_INPUT(In9,std::string); + BBTK_DECLARE_INPUT(FileName,std::string); +// BBTK_DECLARE_OUTPUT(Out,double); + BBTK_PROCESS(Process); + void Process(); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(StringWriter,bbtk::AtomicBlackBox); + BBTK_NAME("StringWriter"); + BBTK_AUTHOR("Info-Dev Creatis"); + BBTK_DESCRIPTION("Write a string in a file"); + BBTK_CATEGORY("read/write"); + BBTK_INPUT(StringWriter,In0,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,In1,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,In2,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,In3,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,In4,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,In5,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,In6,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,In7,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,In8,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,In9,"String to be write",std::string,""); + BBTK_INPUT(StringWriter,FileName,"Output file name",std::string,""); +// BBTK_OUTPUT(StringWriter,Out,"First output",double,""); +BBTK_END_DESCRIBE_BLACK_BOX(StringWriter); +//===== +// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost) +//===== +} +// EO namespace bbstd + +#endif // __bbstdStringWriter_h_INCLUDED__ + diff --git a/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbg b/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbg index 28b2161..91ef48e 100644 --- a/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbg +++ b/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbg @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.2 BBG BlackBox Diagram file -# - /Users/davila/Creatis/All3/creatools_source/bbs/package/toolsbbtk/bbs/boxes/SaveMHD-Button.bbg +# - /Users/davila/Creatis/All3/creatools_source/bbtk/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbg # ---------------------------------- APP_START @@ -27,7 +27,7 @@ ISEXEC:FALSE -118.250801:-14.140786:900.000000 -72.675801:-24.140786:900.000000 PORT -Label:"Save Image" +Label:"Save Image (*.mhd)" PORT WinTitle:"Save Img." FIN_BOX diff --git a/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbs b/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbs index d5797f5..054099d 100644 --- a/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbs +++ b/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbs @@ -1,6 +1,6 @@ # ---------------------------------- # - BBTKGEditor v 1.2 BBS BlackBox Script (Complex Box) -# - /Users/davila/Creatis/All3/creatools_source/creaMiniTools/bbtk_package_creaMiniToolsBase/bbs/boxes/SaveMHD-Button.bbs +# - /Users/davila/Creatis/All3/creatools_source/bbtk/packages/toolsbbtk/bbs/boxes/SaveMHD-Button.bbs # ---------------------------------- include std @@ -16,7 +16,7 @@ description "Button that saves the input vtkImageData as a MHD file" category "read/write widget" new CommandButton Box00 - set Box00.Label "Save Image" + set Box00.Label "Save Image (*.mhd)" set Box00.WinTitle "Save Img." new MetaImageWriter Box01 -- 2.47.1