X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fappli%2Fbbfy%2Fbbfy.cpp;h=a315ed9c314620297de9852a4c213b830bfc0ee7;hb=13304e56deca37fe54072b423bc1214687ec503a;hp=8123db20035a61d81195550b62097b2039284ad6;hpb=32f28c419e0c356a18a288af2ea6ffdd32a259ca;p=bbtk.git diff --git a/kernel/appli/bbfy/bbfy.cpp b/kernel/appli/bbfy/bbfy.cpp index 8123db2..a315ed9 100644 --- a/kernel/appli/bbfy/bbfy.cpp +++ b/kernel/appli/bbfy/bbfy.cpp @@ -3,7 +3,7 @@ #endif #include -#include "xmlParser.h" +#include "bbtkXML.h" #include #include #include @@ -77,6 +77,7 @@ private: std::string mTemplateImplementation; std::vector mInclude; + std::vector mTypedef; std::string mUserConstructor; std::string mUserCopyConstructor; @@ -86,6 +87,7 @@ private: { std::string name; std::string type; + std::string nature; std::string descr; std::string special; std::string generic_type; @@ -139,27 +141,6 @@ void bbfy::CreateBlackBox() //========================================================================== -//========================================================================== -void GetTextOrClear(const XMLNode& node, std::string& var) -{ - if (node.nText()>0) - { - var = node.getText(); - } - else if (node.nClear()>0) - { - var = node.getClear().lpszValue; - } - else - { - std::string mess("Error : element <"); - mess += node.getName(); - mess += "> : no text nor
 clear tag found";
-      throw bbfyException(mess);
-    }
-}
-//==========================================================================
-
 
 //==========================================================================
 void bbfy::ParseXML()
@@ -207,7 +188,7 @@ void bbfy::ParseXML()
 	    {
 	      throw bbfyException("Error : blackbox type '"+itkImageToImageFilterString+"' but no  tag found (mandatory)");
 	    }
-	  GetTextOrClear(BB.getChildNode("itkparent"),mItkParent);
+	  bbtk::GetTextOrClear(BB.getChildNode("itkparent"),mItkParent);
 	  // 
 	  mGeneric = false;
 	  if (BB.isAttributeSet("generic")) mGeneric=true;
@@ -222,7 +203,7 @@ void bbfy::ParseXML()
 				  +vtkImageAlgorithmString
 				  +"' but no  tag found (mandatory)");
 	    }
-	  GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
+	  bbtk::GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
 	  // 
 	}
     else if (bbtype == vtkPolyDataAlgorithmString )
@@ -235,7 +216,7 @@ void bbfy::ParseXML()
 				  +vtkPolyDataAlgorithmString
 				  +"' but no  tag found (mandatory)");
 	    }
-	  GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
+	  bbtk::GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
 	  // 
 	}
      else 
@@ -269,7 +250,7 @@ void bbfy::ParseXML()
   for (i=0,j=0; iname << ",\""
-	    << ioi->descr << "\"," <<  ioi->type <<");\n";
+	    << ioi->descr << "\"," <<  ioi->type << ",\"" 
+	    << ioi->nature<<"\");\n";
     }
   
   // Outputs
@@ -774,7 +782,8 @@ void bbfy::CreateHeader()
 	  mFile << "BBTK_OUTPUT(";
 	} 
       mFile << mName << "," << ioi->name << ",\""
-	    << ioi->descr << "\"," <<  ioi->type <<");\n";
+	    << ioi->descr << "\"," <<  ioi->type << ",\"" 
+	    << ioi->nature<<"\");\n";
     }
   
   // EO black box description
@@ -837,7 +846,7 @@ void bbfy::WriteGenericITKFilterHeader()
   mFile << "{\n";
 
   // Interface
-  mFile << "  BBTK_USER_BLACK_BOX_INTERFACE("
+  mFile << "  BBTK_BLACK_BOX_INTERFACE("
 	<< mName << "Generic,bbtk::AtomicBlackBox);\n";
 
   // Inputs
@@ -982,14 +991,14 @@ void bbfy::CreateCode()
   if (mTemplateParam.size()>0) 
     {
       // Implementation
-      mFile << "BBTK_USER_BLACK_BOX_TEMPLATE_IMPLEMENTATION("
+      mFile << "BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION("
 	    << mName << ","  
 	    << mParentBlackBox << ");\n";
      
       if (mGeneric) 
 	{	
 	  // Implementation
-	  mFile << "BBTK_USER_BLACK_BOX_IMPLEMENTATION("
+	  mFile << "BBTK_BLACK_BOX_IMPLEMENTATION("
 		<< mName << "Generic,bbtk::AtomicBlackBox);\n";
 	  // Package
 	  mFile << "BBTK_ADD_BLACK_BOX_TO_PACKAGE("
@@ -1006,21 +1015,21 @@ void bbfy::CreateCode()
 	    << mName << ")\n";
 
       // Implementation
-      mFile << "BBTK_USER_BLACK_BOX_IMPLEMENTATION("
+      mFile << "BBTK_BLACK_BOX_IMPLEMENTATION("
 	    << mName << ","  
 	    << mParentBlackBox << ");\n"; 
     }
   // Process
   if ((mType == STD)||(mProcess.size()))
     {
-      mFile << "void "<