]> Creatis software - bbtk.git/blob - packages/std/src/bbstdVectorFilterString.cxx
7b5da8bb009aca6816f382b410a884c025785b5f
[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
35
36 void VectorFilterString::Process()
37 {
38
39 // THE MAIN PROCESSING METHOD BODY
40 //   Here we simply set the input 'In' value to the output 'Out'
41 //   And print out the output value
42 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
43 //    void bbSet{Input|Output}NAME(const TYPE&)
44 //    const TYPE& bbGet{Input|Output}NAME() const 
45 //    Where :
46 //    * NAME is the name of the input/output
47 //      (the one provided in the attribute 'name' of the tag 'input')
48 //    * TYPE is the C++ type of the input/output
49 //      (the one provided in the attribute 'type' of the tag 'input')
50
51 //    bbSetOutputOut( bbGetInputIn() );
52 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
53   
54         if (bbGetInputType()==0) 
55         {
56                 std::vector<std::string> vOut0;
57                 std::vector<std::string> vOut1;
58                 std::vector<std::string> vOut2;
59                 std::vector<std::string> vOut3;
60                 std::vector<std::string> vOut4;
61                 std::vector<std::string> vOut5;
62                 std::vector<std::string> vOut6;
63                 std::vector<std::string> vOut7;
64                 std::vector<std::string> vOut8;
65                 std::vector<std::string> vOut9;
66                 ConnectionRepetitions( bbGetInputIn0() , &vOut0 );
67                 ConnectionRepetitions( bbGetInputIn1() , &vOut1 );
68                 ConnectionRepetitions( bbGetInputIn2() , &vOut2 );
69                 ConnectionRepetitions( bbGetInputIn3() , &vOut3 );
70                 ConnectionRepetitions( bbGetInputIn4() , &vOut4 );
71                 ConnectionRepetitions( bbGetInputIn5() , &vOut5 );
72                 ConnectionRepetitions( bbGetInputIn6() , &vOut6 );
73                 ConnectionRepetitions( bbGetInputIn7() , &vOut7 );
74                 ConnectionRepetitions( bbGetInputIn8() , &vOut8 );
75                 ConnectionRepetitions( bbGetInputIn9() , &vOut9 );
76                 bbSetOutputOut0( vOut0 );
77                 bbSetOutputOut1( vOut1 );
78                 bbSetOutputOut2( vOut2 );
79                 bbSetOutputOut3( vOut3 );
80                 bbSetOutputOut4( vOut4 );
81                 bbSetOutputOut5( vOut5 );
82                 bbSetOutputOut6( vOut6 );
83                 bbSetOutputOut7( vOut7 );
84                 bbSetOutputOut8( vOut8 );
85                 bbSetOutputOut9( vOut9 );
86         }
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 VectorFilterString::bbUserSetDefaultValues()
94 {
95
96 //  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
97 //    Here we initialize the input 'In' to 0
98    bbSetInputType(0);
99    bbSetInputsk1("");
100    bbSetInputsk2("");
101 }
102 //===== 
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)
104 //===== 
105 void VectorFilterString::bbUserInitializeProcessing()
106 {
107
108 //  THE INITIALIZATION METHOD BODY :
109 //    Here does nothing 
110 //    but this is where you should allocate the internal/output pointers 
111 //    if any 
112
113   
114 }
115 //===== 
116 // 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 //===== 
118 void VectorFilterString::bbUserFinalizeProcessing()
119 {
120
121 //  THE FINALIZATION METHOD BODY :
122 //    Here does nothing 
123 //    but this is where you should desallocate the internal/output pointers 
124 //    if any
125   
126 }
127 }
128 // EO namespace bbstd
129
130