X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fappli%2Fbbfy%2Fbbfy.cpp;h=3dd1855448bd914570019bb371625b7d18f1950f;hb=a94262289f8148799f8e319c216d5af2a6053c18;hp=347babc2b89afcf162727fc8b7eeff4cd77c41a5;hpb=70db75992e0ccf5ad1fab5ccf9cec013877ea3d5;p=bbtk.git diff --git a/kernel/appli/bbfy/bbfy.cpp b/kernel/appli/bbfy/bbfy.cpp index 347babc..3dd1855 100644 --- a/kernel/appli/bbfy/bbfy.cpp +++ b/kernel/appli/bbfy/bbfy.cpp @@ -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 { @@ -105,6 +105,8 @@ private: std::string mHName; std::string mCxxName; + void AlertString(); + }; //========================================================================== @@ -140,11 +142,22 @@ void bbfy::CreateBlackBox() } //========================================================================== - +void bbfy::AlertString() +{ + + mFile << "//===== \n"; + mFile << "// Before editing this file, make sure it's a file of your own "; + mFile << "(i.e.: it wasn't generated from xml description; if so : your modifications will be lost)\n"; + mFile << "//===== \n"; + +} //========================================================================== void bbfy::ParseXML() { + + + XMLResults* res = new XMLResults; XMLNode BB = XMLNode::parseFile(mFilename.c_str(),"blackbox",res); @@ -196,27 +209,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,25 +289,30 @@ void bbfy::ParseXML() bbtk::GetTextOrClear(BB.getChildNode("namespace"),mNamespace); } - // UserConstructor body - if (BB.nChildNode("constructor")) + // UserSetDefaultValues body + if (BB.nChildNode("defaultValues")) { - bbtk::GetTextOrClear(BB.getChildNode("constructor"),mUserConstructor); + bbtk::GetTextOrClear(BB.getChildNode("defaultValues"), + mUserSetDefaultValues); } - // UserCopyConstructor body - if (BB.nChildNode("copyconstructor")) + // UserInitializeProcessing body + if (BB.nChildNode("initializeProcessing")) { - bbtk::GetTextOrClear(BB.getChildNode("copyconstructor"),mUserCopyConstructor); + bbtk::GetTextOrClear(BB.getChildNode("initializeProcessing"), + mUserInitializeProcessing); } - // UserDestructor body - if (BB.nChildNode("destructor")) + // UserFinalizeProcessing body + if (BB.nChildNode("finalizeProcessing")) { - bbtk::GetTextOrClear(BB.getChildNode("destructor"),mUserDestructor); + bbtk::GetTextOrClear(BB.getChildNode("finalizeProcessing"), + mUserFinalizeProcessing); } - - // Template parameters + + + + // Template parameters // mNbTemplateParam = BB.nChildNode("template"); if ( BB.nChildNode("template") > 0) @@ -421,7 +439,7 @@ void bbfy::ParseXML() // process tag given ? if (BB.nChildNode("process")) { - bbtk::GetTextOrClear(BB.getChildNode("process"),mProcess); + bbtk::GetTextOrClear(BB.getChildNode("process"),mProcess); } // CreateWidget @@ -430,6 +448,30 @@ void bbfy::ParseXML() { 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 ioi; @@ -659,6 +689,7 @@ void bbfy::CreateHeader() throw bbfyException(mess); } } + // Outputs for (ioi=mOutput.begin(); ioi!=mOutput.end(); ++ioi) @@ -722,6 +753,7 @@ void bbfy::CreateHeader() mFile << " void CreateWidget(wxWindow*);\n"; } + AlertString(); // EO black box declaration mFile << "};\n\n"; @@ -749,7 +781,8 @@ void bbfy::CreateHeader() { throw bbfyException("template bb with more than 1 templ param not impl"); } - + + // Author mFile << "BBTK_AUTHOR(\""<