X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fappli%2Fbbfy%2Fbbfy.cpp;h=390e5b0ddb8e4e24ebc29469b13a91180da05646;hb=f45b7f05b03f411759981fe13645466a1c289e6a;hp=4aeb878c5719e47b2b1e9d657646ad44da31e59e;hpb=4ad5b5ee44357ad873bc8c43230defb6d0a79879;p=bbtk.git diff --git a/kernel/appli/bbfy/bbfy.cpp b/kernel/appli/bbfy/bbfy.cpp index 4aeb878..390e5b0 100644 --- a/kernel/appli/bbfy/bbfy.cpp +++ b/kernel/appli/bbfy/bbfy.cpp @@ -20,8 +20,8 @@ public: //========================================================================== const std::string itkImageToImageFilterString = "ITK_ImageToImageFilter"; -const std::string vtkImageAlgorithmString = "VTK_ImageAlgorithm"; -const std::string vtkPolyDataAlgorithmString = "VTK_PolyDataAlgorithm"; +const std::string vtkImageAlgorithmString = "VTK_ImageAlgorithm"; +const std::string vtkPolyDataAlgorithmString = "VTK_PolyDataAlgorithm"; //========================================================================== class bbfy @@ -63,7 +63,7 @@ private: bool mIsWidget; std::string mParentBlackBox; std::string mItkParent; - std::string mVtkParent; + std::string mVtkObject; bool mGeneric; std::string mAuthor; std::string mDescription; @@ -79,9 +79,9 @@ private: std::vector mInclude; std::vector mTypedef; - std::string mUserConstructor; - std::string mUserCopyConstructor; - std::string mUserDestructor; + std::string mUserSetDefaultValues; + std::string mUserInitializeProcessing; + std::string mUserFinalizeProcessing; typedef struct { @@ -196,27 +196,27 @@ void bbfy::ParseXML() else if (bbtype == vtkImageAlgorithmString) { mType = vtkImageAlgorithm; - // Looks for tag - if (!BB.nChildNode("vtkparent")) + // Looks for tag + if (!BB.nChildNode("vtkobject")) { throw bbfyException("Error : blackbox type '" +vtkImageAlgorithmString - +"' but no tag found (mandatory)"); + +"' but no tag found (mandatory)"); } - bbtk::GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent); + bbtk::GetTextOrClear(BB.getChildNode("vtkobject"),mVtkObject); // } else if (bbtype == vtkPolyDataAlgorithmString ) { mType = vtkPolyDataAlgorithm; - // Looks for tag - if (!BB.nChildNode("vtkparent")) + // Looks for tag + if (!BB.nChildNode("vtkobject")) { throw bbfyException("Error : blackbox type '" +vtkPolyDataAlgorithmString - +"' but no tag found (mandatory)"); + +"' but no tag found (mandatory)"); } - bbtk::GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent); + bbtk::GetTextOrClear(BB.getChildNode("vtkobject"),mVtkObject); // } else @@ -276,23 +276,30 @@ void bbfy::ParseXML() bbtk::GetTextOrClear(BB.getChildNode("namespace"),mNamespace); } - // UserConstructor body - if (BB.nChildNode("userconstructor")) + // UserSetDefaultValues body + if (BB.nChildNode("defaultValues")) { - bbtk::GetTextOrClear(BB.getChildNode("userconstructor"),mUserConstructor); + bbtk::GetTextOrClear(BB.getChildNode("defaultValues"), + mUserSetDefaultValues); } - // UserCopyConstructor body - if (BB.nChildNode("usercopyconstructor")) + + // UserInitializeProcessing body + if (BB.nChildNode("initializeProcessing")) { - bbtk::GetTextOrClear(BB.getChildNode("usercopyconstructor"),mUserCopyConstructor); + bbtk::GetTextOrClear(BB.getChildNode("initializeProcessing"), + mUserInitializeProcessing); } - // UserDestructor body - if (BB.nChildNode("userdestructor")) + + // UserFinalizeProcessing body + if (BB.nChildNode("finalizeProcessing")) { - bbtk::GetTextOrClear(BB.getChildNode("userdestructor"),mUserDestructor); + bbtk::GetTextOrClear(BB.getChildNode("finalizeProcessing"), + mUserFinalizeProcessing); } - - // Template parameters + + + + // Template parameters // mNbTemplateParam = BB.nChildNode("template"); if ( BB.nChildNode("template") > 0) @@ -421,12 +428,37 @@ void bbfy::ParseXML() { bbtk::GetTextOrClear(BB.getChildNode("process"),mProcess); } + // CreateWidget // createwidget tag given ? if (BB.nChildNode("createwidget")) { bbtk::GetTextOrClear(BB.getChildNode("createwidget"),mCreateWidget); } + + + + + + + + // OBSOLETE/UNSUPPORTED TAGS + // WARN IF OBSOLETE TAGS PROVIDED + if (BB.nChildNode("constructor")) + { + std::cout << "WARNING !!! The tag is obsolete !!"< is obsolete !!"< is obsolete !!"<::iterator i; for (i=mInclude.begin(); i!=mInclude.end(); ++i) { @@ -492,6 +524,15 @@ void bbfy::CreateHeader() if (mGeneric) mFile << "#include \"bbitkImage.h\"\n"; mFile << "\n"; + if (mType == itkImageToImageFilter ) + { + mFile << "#include \"bbtkItkBlackBoxMacros.h\"\n"; + } + else if ( (mType == vtkImageAlgorithm) || + (mType == vtkPolyDataAlgorithm) ) + { + mFile << "#include \"bbtkVtkBlackBoxMacros.h\"\n"; + } // Namespace BeginNamespace(); @@ -504,9 +545,8 @@ void bbfy::CreateHeader() } // Class declaration and parents - mFile << "class /*BBTK_EXPORT*/ "<special=="itk input") { mFile << " BBTK_DECLARE_ITK_INPUT(" - << "itkParent," << ioi->name << "," << ioi->type @@ -601,7 +634,6 @@ void bbfy::CreateHeader() { if (mType == vtkImageAlgorithm) { mFile << " BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT(" - << "vtkParent," << ioi->name << "," << ioi->type @@ -609,7 +641,6 @@ void bbfy::CreateHeader() } else if (mType == vtkPolyDataAlgorithm) { mFile << " BBTK_DECLARE_POLY_DATA_ALGORITHM_INPUT(" - << "vtkParent," << ioi->name << "," << ioi->type @@ -619,7 +650,6 @@ void bbfy::CreateHeader() else if (ioi->special=="itk parameter") { mFile << " BBTK_DECLARE_ITK_PARAM(" - << "itkParent," << ioi->name << "," << ioi->type @@ -628,7 +658,6 @@ void bbfy::CreateHeader() else if (ioi->special=="vtk parameter") { mFile << " BBTK_DECLARE_VTK_PARAM(" - << "vtkParent," << ioi->name << "," << ioi->type @@ -659,7 +688,6 @@ void bbfy::CreateHeader() else if (ioi->special=="itk output") { mFile << " BBTK_DECLARE_ITK_OUTPUT(" - << "itkParent," << ioi->name << "," << ioi->type @@ -668,7 +696,6 @@ void bbfy::CreateHeader() else if (ioi->special=="vtk output") { mFile << " BBTK_DECLARE_VTK_OUTPUT(" - << "vtkParent," << ioi->name << "," << ioi->type @@ -685,7 +712,6 @@ void bbfy::CreateHeader() } } - // Process if ((mType == STD)||(mProcess.size())) { @@ -694,28 +720,26 @@ void bbfy::CreateHeader() } else if (mType == itkImageToImageFilter) { - mFile << " BBTK_PROCESS(itkParent::Update);\n" ; + mFile << " BBTK_ITK_PROCESS();\n" ; } else if ((mType == vtkImageAlgorithm) || (mType == vtkPolyDataAlgorithm) ) { - mFile << " BBTK_PROCESS(vtkParent::Update);\n" ; + mFile << " BBTK_VTK_PROCESS();\n" ; } // CreateWidget if (mIsWidget) { mFile << " BBTK_CREATE_WIDGET(CreateWidget);\n" ; - mFile << " void CreateWidget();\n"; + mFile << " void CreateWidget(wxWindow*);\n"; } // EO black box declaration mFile << "};\n\n"; - - // BO black box description if (mTemplateParam.size()==0) { @@ -1029,29 +1053,41 @@ void bbfy::CreateCode() // CreateWidget if (mIsWidget) { - mFile << "void "<