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()
17 std::cout << "MLER WriteColumnsString::Process Start " << std::endl;
20 std::ofstream write_fi;
21 write_fi.open(bbGetInputFileName().c_str());
23 std::vector<std::string> headers = bbGetInputHeaders(); //Headers Input
24 bool onHeaders = bbGetInputOnHeaders();
27 std::vector<std::vector<std::string> > values;
29 values.push_back(bbGetInputlstData1());
30 values.push_back(bbGetInputlstData2());
31 values.push_back(bbGetInputlstData3());
32 values.push_back(bbGetInputlstData4());
33 values.push_back(bbGetInputlstData5());
34 values.push_back(bbGetInputlstData6());
35 values.push_back(bbGetInputlstData7());
36 values.push_back(bbGetInputlstData8());
37 values.push_back(bbGetInputlstData9());
39 std::vector<std::vector<std::string> >::iterator it;
41 std::cout << "values size"<<values.size()<< std::endl;
42 for(it = values.begin() ; it != values.end() ; )
46 it = values.erase(it);
52 std::cout << "values size"<<values.size()<< std::endl;
54 if(write_fi.is_open())
56 if(onHeaders == true) // If onHeaders is true, the file is write with Headers.
58 //Add each header input write to file
59 for(unsigned int i=0 ;i< headers.size(); i++ )
61 if(i==(headers.size()-1))
63 write_fi << headers[i] << "\n";
65 write_fi << headers[i] << "\t";
71 unsigned int colSize = values[0].size();
73 for(unsigned int j=0;j<colSize;j++)
75 for(unsigned int i=0;i<values.size();i++)
77 if(i==(values.size()-1))
79 write_fi << values[i][j] << "\n";
81 write_fi << values[i][j] << "\t";
89 }// if write_fi.is_open()
92 std::cout<<"No es posible abrir"<<std::endl;
97 bbSetOutputOutFileName(bbGetInputFileName().c_str());
99 std::cout << "MLER WriteColumnsString::End Process " << std::endl;
103 // 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)
105 void WriteColumnsString::bbUserSetDefaultValues()
108 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
109 // Here we initialize the input 'In' to 0
110 bbSetInputFileName("");
111 bbSetInputFileName("true");
115 // 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)
117 void WriteColumnsString::bbUserInitializeProcessing()
120 // THE INITIALIZATION METHOD BODY :
122 // but this is where you should allocate the internal/output pointers
128 // 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)
130 void WriteColumnsString::bbUserFinalizeProcessing()
133 // THE FINALIZATION METHOD BODY :
135 // but this is where you should desallocate the internal/output pointers
140 // EO namespace bbstd