]> Creatis software - bbtk.git/commitdiff
#2560 BBTK Feature New Normal - bbstd package : WriteColumnsString
authorespinosa <Monica.Espinosa@creatis.insa-lyon.fr>
Mon, 23 Mar 2015 16:02:35 +0000 (17:02 +0100)
committerespinosa <Monica.Espinosa@creatis.insa-lyon.fr>
Mon, 23 Mar 2015 16:02:35 +0000 (17:02 +0100)
packages/std/src/bbstdWriteColumnsString.cxx [new file with mode: 0644]
packages/std/src/bbstdWriteColumnsString.h [new file with mode: 0644]

diff --git a/packages/std/src/bbstdWriteColumnsString.cxx b/packages/std/src/bbstdWriteColumnsString.cxx
new file mode 100644 (file)
index 0000000..bd0f0b0
--- /dev/null
@@ -0,0 +1,93 @@
+//===== 
+// 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 "bbstdWriteColumnsString.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,WriteColumnsString)
+BBTK_BLACK_BOX_IMPLEMENTATION(WriteColumnsString,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 WriteColumnsString::Process()
+{
+
+       std::cout << "MLER WriteColumnsString::Process Start " << std::endl;
+       
+       std::ofstream write_fi;
+       write_fi.open(bbGetInputFileName().c_str());
+       //std::cout<<"write_fi "<<bbGetInputFileName().c_str()<<std::endl;
+       std::vector<std::string> headers = bbGetInputHeaders();
+
+       int i,j,k;
+
+       if(write_fi.is_open())
+       {
+               for(i=0 ;i< headers.size(); i++ )
+               {
+                       write_fi << headers[i] << "\t";
+               }//for headersSize
+
+               for(j=0; j< bbGetInputlstData1().size();j++)
+               {
+                       write_fi << bbGetInputlstData1()[j] << "\n";
+               }
+
+               std::cout<<"size Header"<<headers.size()<<std::endl;
+               
+
+       }// if write_fi.is_open()
+       else
+       {
+               std::cout<<"No es posible abrir"<<std::endl;
+       }//else
+
+       write_fi.close();
+
+       bbSetOutputOutFileName("Prueba.txt");
+
+       std::cout << "MLER WriteColumnsString::End Process " << std::endl;
+  
+}
+//===== 
+// 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 WriteColumnsString::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   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 WriteColumnsString::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 WriteColumnsString::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/bbstdWriteColumnsString.h b/packages/std/src/bbstdWriteColumnsString.h
new file mode 100644 (file)
index 0000000..c0bee71
--- /dev/null
@@ -0,0 +1,69 @@
+//===== 
+// 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 __bbstdWriteColumnsString_h_INCLUDED__
+#define __bbstdWriteColumnsString_h_INCLUDED__
+#include "bbstd_EXPORT.h"
+#include "bbtkAtomicBlackBox.h"
+#include "iostream"
+
+namespace bbstd
+{
+
+class bbstd_EXPORT WriteColumnsString :
+   public bbtk::AtomicBlackBox
+{
+  BBTK_BLACK_BOX_INTERFACE(WriteColumnsString,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(FileName,std::string);
+  BBTK_DECLARE_INPUT(Headers,std::vector<std::string>);
+
+  BBTK_DECLARE_INPUT(lstData1,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData2,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData3,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData4,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData5,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData6,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData7,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData8,std::vector<std::string> );
+  BBTK_DECLARE_INPUT(lstData9,std::vector<std::string> );
+
+  BBTK_DECLARE_OUTPUT(OutFileName,std::string);
+  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(WriteColumnsString,bbtk::AtomicBlackBox);
+BBTK_NAME("WriteColumnsString");
+BBTK_AUTHOR("Monica ESPINOSA");
+BBTK_DESCRIPTION("Write Columns to file");
+BBTK_CATEGORY("read/write");
+
+BBTK_INPUT(WriteColumnsString,FileName,"File name",std::string,"");
+BBTK_INPUT(WriteColumnsString,Headers,"Headers of Columns",std::vector<std::string>,"");
+
+BBTK_INPUT(WriteColumnsString,lstData1,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData2,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData3,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData4,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData5,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData6,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData7,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData8,"vector of data",std::vector<std::string>,"");
+BBTK_INPUT(WriteColumnsString,lstData9,"vector of data",std::vector<std::string>,"");
+
+BBTK_OUTPUT(WriteColumnsString,OutFileName,"File Name",std::string,"");
+BBTK_END_DESCRIBE_BLACK_BOX(WriteColumnsString);
+//===== 
+// 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 // __bbstdWriteColumnsString_h_INCLUDED__
+