2 // 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)
4 #include "bbstdWriteColumnsString.h"
5 #include "bbstdPackage.h"
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,WriteColumnsString)
10 BBTK_BLACK_BOX_IMPLEMENTATION(WriteColumnsString,bbtk::AtomicBlackBox);
12 // 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)
14 void WriteColumnsString::Process()
16 std::ofstream write_fi;
17 write_fi.open(bbGetInputFileName().c_str());
18 std::vector<std::string> headers = bbGetInputHeaders(); //Headers Input
19 bool onHeaders = bbGetInputOnHeaders();
20 std::vector<std::vector<std::string> > values;
21 values.push_back(bbGetInputlstData1());
22 values.push_back(bbGetInputlstData2());
23 values.push_back(bbGetInputlstData3());
24 values.push_back(bbGetInputlstData4());
25 values.push_back(bbGetInputlstData5());
26 values.push_back(bbGetInputlstData6());
27 values.push_back(bbGetInputlstData7());
28 values.push_back(bbGetInputlstData8());
29 values.push_back(bbGetInputlstData9());
30 std::vector<std::vector<std::string> >::iterator it;
31 for(it = values.begin() ; it != values.end() ; )
35 it = values.erase(it);
41 if(write_fi.is_open())
43 if(onHeaders == true) // If onHeaders is true, the file is write with Headers.
45 //Add each header input write to file
46 for(unsigned int i=0 ;i< headers.size(); i++ )
48 if(i==(headers.size()-1))
50 write_fi << headers[i] << "\n";
52 write_fi << headers[i] << "\t";
57 unsigned int colSize = values[0].size();
58 for(unsigned int j=0;j<colSize;j++)
60 for(unsigned int i=0;i<values.size();i++)
62 if(i==(values.size()-1))
64 write_fi << values[i][j] << "\n";
66 write_fi << values[i][j] << "\t";
70 }// if write_fi.is_open()
73 std::cout<<"No es posible abrir"<<std::endl;
76 bbSetOutputOutFileName(bbGetInputFileName().c_str());
79 // 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)
81 void WriteColumnsString::bbUserSetDefaultValues()
84 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
85 // Here we initialize the input 'In' to 0
86 bbSetInputFileName("");
87 bbSetInputFileName("true");
91 // 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)
93 void WriteColumnsString::bbUserInitializeProcessing()
96 // THE INITIALIZATION METHOD BODY :
98 // but this is where you should allocate the internal/output pointers
104 // 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)
106 void WriteColumnsString::bbUserFinalizeProcessing()
109 // THE FINALIZATION METHOD BODY :
111 // but this is where you should desallocate the internal/output pointers
116 // EO namespace bbstd