]> Creatis software - bbtk.git/commitdiff
#2560 BBTK Feature New Normal - bbstd package : WriteColumnsString
authorespinosa <Monica.Espinosa@creatis.insa-lyon.fr>
Sun, 10 May 2015 08:50:52 +0000 (10:50 +0200)
committerespinosa <Monica.Espinosa@creatis.insa-lyon.fr>
Sun, 10 May 2015 08:50:52 +0000 (10:50 +0200)
packages/std/src/bbstdWriteColumnsString.cxx
packages/std/src/bbstdWriteColumnsString.h

index 064342e6829affd18c9f5531039579e8550a7c53..05b760bbd8c514466adb65e3486454be0a001e25 100644 (file)
@@ -21,6 +21,8 @@ void WriteColumnsString::Process()
        write_fi.open(bbGetInputFileName().c_str());
        
        std::vector<std::string> headers = bbGetInputHeaders(); //Headers Input
+       bool onHeaders = bbGetInputOnHeaders();
+
 
        std::vector<std::vector<std::string> > 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");
   
 }
 //===== 
index c0bee7140ddbc4e6cc6fd71eed49d4fa688275fe..08e54bf95933ec7da3c31a9d9ff416bdd41154a4 100644 (file)
@@ -19,6 +19,8 @@ class bbstd_EXPORT WriteColumnsString :
 //===== 
   BBTK_DECLARE_INPUT(FileName,std::string);
   BBTK_DECLARE_INPUT(Headers,std::vector<std::string>);
+  BBTK_DECLARE_INPUT(OnHeaders,bool);
+
 
   BBTK_DECLARE_INPUT(lstData1,std::vector<std::string> );
   BBTK_DECLARE_INPUT(lstData2,std::vector<std::string> );
@@ -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<std::string>,"");
+BBTK_INPUT(WriteColumnsString,OnHeaders,"On Headers / Off Headers",bool,"");
 
 BBTK_INPUT(WriteColumnsString,lstData1,"vector of data",std::vector<std::string>,"");
 BBTK_INPUT(WriteColumnsString,lstData2,"vector of data",std::vector<std::string>,"");