]> Creatis software - bbtk.git/blob - packages/std/src/bbstdReadColumnsString.cxx
no message
[bbtk.git] / packages / std / src / bbstdReadColumnsString.cxx
1 //===== 
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)
3 //===== 
4 #include "bbstdReadColumnsString.h"
5 #include "bbstdPackage.h"
6
7
8 #include<vector>
9
10 namespace bbstd
11 {
12
13 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,ReadColumnsString)
14 BBTK_BLACK_BOX_IMPLEMENTATION(ReadColumnsString,bbtk::AtomicBlackBox);
15 //===== 
16 // 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)
17 //===== 
18 void ReadColumnsString::Process()
19 {
20
21         printf("EED ReadColumnsString::Process start \n");
22         
23         std::vector< std::vector<std::string> * > tlst;
24         
25         int i;
26         for( i=0 ;  i<bbGetInputDimension() ; i++)
27         {
28                 tlst.push_back( new std::vector<std::string> );
29         }       
30         
31         int numberOfLines = 0;
32         char tmpValue[50];
33         std::vector<std::string> *vecData;
34         FILE *ff1 = fopen( bbGetInputFileName().c_str() , "r+" );
35         if (ff1!=NULL)
36         {
37                 while (!feof(ff1))
38                 {
39                         for( i=0 ;  i<bbGetInputDimension() ; i++)
40                         {
41                                 fscanf(ff1,"%s",tmpValue);
42                                 vecData=tlst[i];
43                                 vecData->push_back( tmpValue );
44                         }       
45                         numberOfLines++;                        
46                 }       
47                 fclose(ff1);
48         } else {   // else ff1
49                 printf("bbcreaMaracasVisuReadAxisTree3D::Process  ...Error... reading file InputFileName_Points>%s", bbGetInputFileName().c_str() );
50         } //ff1 
51         
52         i=1; if (i<=bbGetInputDimension()) { bbSetOutputlstData1( *(tlst[i-1]) ); }
53         i=2; if (i<=bbGetInputDimension()) { bbSetOutputlstData2( *(tlst[i-1]) ); }
54         i=3; if (i<=bbGetInputDimension()) { bbSetOutputlstData3( *(tlst[i-1]) ); }
55         i=4; if (i<=bbGetInputDimension()) { bbSetOutputlstData4( *(tlst[i-1]) ); }
56         i=5; if (i<=bbGetInputDimension()) { bbSetOutputlstData5( *(tlst[i-1]) ); }
57         i=6; if (i<=bbGetInputDimension()) { bbSetOutputlstData6( *(tlst[i-1]) ); }
58         i=7; if (i<=bbGetInputDimension()) { bbSetOutputlstData7( *(tlst[i-1]) ); }
59         i=8; if (i<=bbGetInputDimension()) { bbSetOutputlstData8( *(tlst[i-1]) ); }
60         i=9; if (i<=bbGetInputDimension()) { bbSetOutputlstData9( *(tlst[i-1]) ); }
61         
62         printf("EED ReadColumnsString::Process end \n");
63         
64 }
65 //===== 
66 // 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)
67 //===== 
68 void ReadColumnsString::bbUserSetDefaultValues()
69 {
70
71 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
72 //    Here we initialize the input 'In' to 0
73         bbSetInputDimension(1); 
74         bbSetInputFileName(""); 
75   
76 }
77 //===== 
78 // 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)
79 //===== 
80 void ReadColumnsString::bbUserInitializeProcessing()
81 {
82
83 //  THE INITIALIZATION METHOD BODY :
84 //    Here does nothing 
85 //    but this is where you should allocate the internal/output pointers 
86 //    if any 
87
88   
89 }
90 //===== 
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)
92 //===== 
93 void ReadColumnsString::bbUserFinalizeProcessing()
94 {
95
96 //  THE FINALIZATION METHOD BODY :
97 //    Here does nothing 
98 //    but this is where you should desallocate the internal/output pointers 
99 //    if any
100   
101 }
102 }
103 // EO namespace bbstd
104
105