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 "bbstdReadVectorFromFile.h"
5 #include "bbstdPackage.h"
10 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ReadVectorFromFile)
11 BBTK_BLACK_BOX_IMPLEMENTATION(ReadVectorFromFile,bbtk::AtomicBlackBox);
13 // 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)
15 void ReadVectorFromFile::Process()
17 std::vector< std::vector< double > > Data;
18 std::ifstream openfile( bbGetInputFileName().c_str() );
20 unsigned int LineLength=bbGetInputLineLength();
22 while ( getline( openfile, Input ) )
24 std::stringstream Parse;
27 std::vector<double> Line;
28 // -------- une ligne sur 10!
35 while ( Parse >> Value )
36 Line.push_back( Value );
37 if ( Line.size() != LineLength )
39 std::cout << "Line " << Data.size() + 1 << " expected " <<
40 LineLength << " values, received " << Line.size() << " values, aborting." <<std::endl;
43 Data.push_back( Line );
48 printf("ReadVectorFromFile::Process end \n");
52 // 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)
54 void ReadVectorFromFile::bbUserSetDefaultValues()
57 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
58 // Here we initialize the input 'In' to 0
59 bbSetInputFileName("");
60 bbSetInputLineLength(1);
63 // 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)
65 void ReadVectorFromFile::bbUserInitializeProcessing()
68 // THE INITIALIZATION METHOD BODY :
70 // but this is where you should allocate the internal/output pointers
72 //Data = new vector< vector< double > >;
76 // 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)
78 void ReadVectorFromFile::bbUserFinalizeProcessing()
81 // THE FINALIZATION METHOD BODY :
83 // but this is where you should desallocate the internal/output pointers