From: espinosa Date: Sun, 10 May 2015 08:50:52 +0000 (+0200) Subject: #2560 BBTK Feature New Normal - bbstd package : WriteColumnsString X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=302ab66a86986677a5726ffbac9d545292a77fc4;p=bbtk.git #2560 BBTK Feature New Normal - bbstd package : WriteColumnsString --- diff --git a/packages/std/src/bbstdWriteColumnsString.cxx b/packages/std/src/bbstdWriteColumnsString.cxx index 064342e..05b760b 100644 --- a/packages/std/src/bbstdWriteColumnsString.cxx +++ b/packages/std/src/bbstdWriteColumnsString.cxx @@ -21,6 +21,8 @@ void WriteColumnsString::Process() write_fi.open(bbGetInputFileName().c_str()); std::vector headers = bbGetInputHeaders(); //Headers Input + bool onHeaders = bbGetInputOnHeaders(); + std::vector > values; @@ -51,17 +53,20 @@ void WriteColumnsString::Process() if(write_fi.is_open()) { - //Add each header input write to file - for(unsigned int i=0 ;i< headers.size(); i++ ) + if(onHeaders == true) // If onHeaders is true, the file is write with Headers. { - if(i==(headers.size()-1)) + //Add each header input write to file + for(unsigned int i=0 ;i< headers.size(); i++ ) { - write_fi << headers[i] << "\n"; - }else{ - write_fi << headers[i] << "\t"; - } + if(i==(headers.size()-1)) + { + write_fi << headers[i] << "\n"; + }else{ + write_fi << headers[i] << "\t"; + } - }//for headersSize + }//for headersSize + } unsigned int colSize = values[0].size(); @@ -103,6 +108,7 @@ void WriteColumnsString::bbUserSetDefaultValues() // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX // Here we initialize the input 'In' to 0 bbSetInputFileName(""); + bbSetInputFileName("true"); } //===== diff --git a/packages/std/src/bbstdWriteColumnsString.h b/packages/std/src/bbstdWriteColumnsString.h index c0bee71..08e54bf 100644 --- a/packages/std/src/bbstdWriteColumnsString.h +++ b/packages/std/src/bbstdWriteColumnsString.h @@ -19,6 +19,8 @@ class bbstd_EXPORT WriteColumnsString : //===== BBTK_DECLARE_INPUT(FileName,std::string); BBTK_DECLARE_INPUT(Headers,std::vector); + BBTK_DECLARE_INPUT(OnHeaders,bool); + BBTK_DECLARE_INPUT(lstData1,std::vector ); BBTK_DECLARE_INPUT(lstData2,std::vector ); @@ -46,6 +48,7 @@ BBTK_CATEGORY("read/write"); BBTK_INPUT(WriteColumnsString,FileName,"File name",std::string,""); BBTK_INPUT(WriteColumnsString,Headers,"Headers of Columns",std::vector,""); +BBTK_INPUT(WriteColumnsString,OnHeaders,"On Headers / Off Headers",bool,""); BBTK_INPUT(WriteColumnsString,lstData1,"vector of data",std::vector,""); BBTK_INPUT(WriteColumnsString,lstData2,"vector of data",std::vector,"");