]> Creatis software - bbtk.git/blob - packages/std/src/bbstdVectorFilterString.cxx
23adb9d14197dfa08339e8b498f6eb526cbccb4c
[bbtk.git] / packages / std / src / bbstdVectorFilterString.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 "bbstdVectorFilterString.h"
5 #include "bbstdPackage.h"
6 namespace bbstd
7 {
8
9 BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,VectorFilterString)
10 BBTK_BLACK_BOX_IMPLEMENTATION(VectorFilterString,bbtk::AtomicBlackBox);
11 //===== 
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)
13 //===== 
14
15 void VectorFilterString::ConnectionRepetitions( std::vector<std::string> vIn,std::vector<std::string> *vOut  )
16 {
17         int i,size=vIn.size();
18         int itmp=0, acum=0;
19         std::string stmp;
20         for( i=0;i<size;i++)
21         {
22                 if (vIn[i].compare( vIn[itmp])==0) 
23                 {
24                         acum++;
25                 } else {
26                         itmp=i;
27                         vOut->push_back(std::to_string(acum));
28                         acum=1;
29                 }
30         } // for
31         vOut->push_back(std::to_string(acum));
32 }
33
34 void VectorFilterString::Process()
35 {
36
37 // THE MAIN PROCESSING METHOD BODY
38 //   Here we simply set the input 'In' value to the output 'Out'
39 //   And print out the output value
40 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
41 //    void bbSet{Input|Output}NAME(const TYPE&)
42 //    const TYPE& bbGet{Input|Output}NAME() const 
43 //    Where :
44 //    * NAME is the name of the input/output
45 //      (the one provided in the attribute 'name' of the tag 'input')
46 //    * TYPE is the C++ type of the input/output
47 //      (the one provided in the attribute 'type' of the tag 'input')
48
49 //    bbSetOutputOut( bbGetInputIn() );
50 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
51   
52         if (bbGetInputType()==0) 
53         {
54                 std::vector<std::string> vOut0;
55                 std::vector<std::string> vOut1;
56                 std::vector<std::string> vOut2;
57                 std::vector<std::string> vOut3;
58                 std::vector<std::string> vOut4;
59                 std::vector<std::string> vOut5;
60                 std::vector<std::string> vOut6;
61                 std::vector<std::string> vOut7;
62                 std::vector<std::string> vOut8;
63                 std::vector<std::string> vOut9;
64                 ConnectionRepetitions( bbGetInputIn0() , &vOut0 );
65                 ConnectionRepetitions( bbGetInputIn1() , &vOut1 );
66                 ConnectionRepetitions( bbGetInputIn2() , &vOut2 );
67                 ConnectionRepetitions( bbGetInputIn3() , &vOut3 );
68                 ConnectionRepetitions( bbGetInputIn4() , &vOut4 );
69                 ConnectionRepetitions( bbGetInputIn5() , &vOut5 );
70                 ConnectionRepetitions( bbGetInputIn6() , &vOut6 );
71                 ConnectionRepetitions( bbGetInputIn7() , &vOut7 );
72                 ConnectionRepetitions( bbGetInputIn8() , &vOut8 );
73                 ConnectionRepetitions( bbGetInputIn9() , &vOut9 );
74                 bbSetOutputOut0( vOut0 );
75                 bbSetOutputOut1( vOut1 );
76                 bbSetOutputOut2( vOut2 );
77                 bbSetOutputOut3( vOut3 );
78                 bbSetOutputOut4( vOut4 );
79                 bbSetOutputOut5( vOut5 );
80                 bbSetOutputOut6( vOut6 );
81                 bbSetOutputOut7( vOut7 );
82                 bbSetOutputOut8( vOut8 );
83                 bbSetOutputOut9( vOut9 );
84         }
85
86         
87
88 }
89 //===== 
90 // 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)
91 //===== 
92 void VectorFilterString::bbUserSetDefaultValues()
93 {
94
95 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
96 //    Here we initialize the input 'In' to 0
97    bbSetInputType(0);
98   
99 }
100 //===== 
101 // 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)
102 //===== 
103 void VectorFilterString::bbUserInitializeProcessing()
104 {
105
106 //  THE INITIALIZATION METHOD BODY :
107 //    Here does nothing 
108 //    but this is where you should allocate the internal/output pointers 
109 //    if any 
110
111   
112 }
113 //===== 
114 // 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)
115 //===== 
116 void VectorFilterString::bbUserFinalizeProcessing()
117 {
118
119 //  THE FINALIZATION METHOD BODY :
120 //    Here does nothing 
121 //    but this is where you should desallocate the internal/output pointers 
122 //    if any
123   
124 }
125 }
126 // EO namespace bbstd
127
128