]> Creatis software - bbtk.git/blobdiff - packages/std/src/bbstdVectorFilterString.cxx
#3267 BBTK Feature New Normal - VectorFilterString Box
[bbtk.git] / packages / std / src / bbstdVectorFilterString.cxx
diff --git a/packages/std/src/bbstdVectorFilterString.cxx b/packages/std/src/bbstdVectorFilterString.cxx
new file mode 100644 (file)
index 0000000..23adb9d
--- /dev/null
@@ -0,0 +1,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)
+//===== 
+#include "bbstdVectorFilterString.h"
+#include "bbstdPackage.h"
+namespace bbstd
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,VectorFilterString)
+BBTK_BLACK_BOX_IMPLEMENTATION(VectorFilterString,bbtk::AtomicBlackBox);
+//===== 
+// 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)
+//===== 
+
+void VectorFilterString::ConnectionRepetitions( std::vector<std::string> vIn,std::vector<std::string> *vOut  )
+{
+       int i,size=vIn.size();
+       int itmp=0, acum=0;
+       std::string stmp;
+       for( i=0;i<size;i++)
+       {
+               if (vIn[i].compare( vIn[itmp])==0) 
+               {
+                       acum++;
+               } else {
+                       itmp=i;
+                       vOut->push_back(std::to_string(acum));
+                       acum=1;
+               }
+       } // for
+       vOut->push_back(std::to_string(acum));
+}
+
+void VectorFilterString::Process()
+{
+
+// THE MAIN PROCESSING METHOD BODY
+//   Here we simply set the input 'In' value to the output 'Out'
+//   And print out the output value
+// INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
+//    void bbSet{Input|Output}NAME(const TYPE&)
+//    const TYPE& bbGet{Input|Output}NAME() const 
+//    Where :
+//    * NAME is the name of the input/output
+//      (the one provided in the attribute 'name' of the tag 'input')
+//    * TYPE is the C++ type of the input/output
+//      (the one provided in the attribute 'type' of the tag 'input')
+
+//    bbSetOutputOut( bbGetInputIn() );
+//    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
+  
+       if (bbGetInputType()==0) 
+       {
+               std::vector<std::string> vOut0;
+               std::vector<std::string> vOut1;
+               std::vector<std::string> vOut2;
+               std::vector<std::string> vOut3;
+               std::vector<std::string> vOut4;
+               std::vector<std::string> vOut5;
+               std::vector<std::string> vOut6;
+               std::vector<std::string> vOut7;
+               std::vector<std::string> vOut8;
+               std::vector<std::string> vOut9;
+               ConnectionRepetitions( bbGetInputIn0() , &vOut0 );
+               ConnectionRepetitions( bbGetInputIn1() , &vOut1 );
+               ConnectionRepetitions( bbGetInputIn2() , &vOut2 );
+               ConnectionRepetitions( bbGetInputIn3() , &vOut3 );
+               ConnectionRepetitions( bbGetInputIn4() , &vOut4 );
+               ConnectionRepetitions( bbGetInputIn5() , &vOut5 );
+               ConnectionRepetitions( bbGetInputIn6() , &vOut6 );
+               ConnectionRepetitions( bbGetInputIn7() , &vOut7 );
+               ConnectionRepetitions( bbGetInputIn8() , &vOut8 );
+               ConnectionRepetitions( bbGetInputIn9() , &vOut9 );
+               bbSetOutputOut0( vOut0 );
+               bbSetOutputOut1( vOut1 );
+               bbSetOutputOut2( vOut2 );
+               bbSetOutputOut3( vOut3 );
+               bbSetOutputOut4( vOut4 );
+               bbSetOutputOut5( vOut5 );
+               bbSetOutputOut6( vOut6 );
+               bbSetOutputOut7( vOut7 );
+               bbSetOutputOut8( vOut8 );
+               bbSetOutputOut9( vOut9 );
+       }
+
+       
+
+}
+//===== 
+// 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)
+//===== 
+void VectorFilterString::bbUserSetDefaultValues()
+{
+
+//  SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX 
+//    Here we initialize the input 'In' to 0
+   bbSetInputType(0);
+  
+}
+//===== 
+// 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)
+//===== 
+void VectorFilterString::bbUserInitializeProcessing()
+{
+
+//  THE INITIALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should allocate the internal/output pointers 
+//    if any 
+
+  
+}
+//===== 
+// 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)
+//===== 
+void VectorFilterString::bbUserFinalizeProcessing()
+{
+
+//  THE FINALIZATION METHOD BODY :
+//    Here does nothing 
+//    but this is where you should desallocate the internal/output pointers 
+//    if any
+  
+}
+}
+// EO namespace bbstd
+
+