2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 #define _CRT_SECURE_NO_DEPRECATE
38 //==========================================================================
42 bbfyException(const std::string& message) : mMessage(message) {}
46 //==========================================================================
48 const std::string itkImageToImageFilterString = "ITK_ImageToImageFilter";
49 const std::string vtkImageAlgorithmString = "VTK_ImageAlgorithm";
50 const std::string vtkPolyDataAlgorithmString = "VTK_PolyDataAlgorithm";
52 //==========================================================================
56 bbfy(const std::string& filename,
57 const std::string& package = "PACKAGE_NAME",
58 const std::string& output_path = "",
59 bool verbose = false);
61 void CreateBlackBox();
66 void WriteGenericITKFilterHeader();
68 void BeginNamespace();
73 std::string mFilename;
74 std::string mOutputPath;
82 itkImageToImageFilter,
90 std::string mParentBlackBox;
91 std::string mItkParent;
92 std::string mVtkObject;
95 std::string mDescription;
96 std::string mCategory;
98 // bool mIsInNamespace;
99 std::string mNamespace;
100 // int mNbTemplateParam;
101 std::vector<std::string> mTemplateParam;
102 std::string mTemplateDeclaration;
103 std::string mTemplateImplementation;
105 std::vector<std::string> mInclude;
106 std::vector<std::string> mTypedef;
108 std::string mUserSetDefaultValues;
109 std::string mUserInitializeProcessing;
110 std::string mUserFinalizeProcessing;
119 std::string generic_type;
123 std::vector<IO> mInput;
124 std::vector<IO> mOutput;
126 std::string mProcess;
127 std::string mCreateWidget;
132 std::string mCxxName;
137 //==========================================================================
141 //==========================================================================
142 bbfy::bbfy(const std::string& filename,
143 const std::string& package,
144 const std::string& output_path,
149 mFilename = filename;
151 mNamespace = "bb" + mPackage;
153 mOutputPath = output_path;
158 //==========================================================================
160 //==========================================================================
161 void bbfy::CreateBlackBox()
163 // Parse XML input file
165 // Create output files
169 //==========================================================================
171 void bbfy::AlertString()
174 mFile << "//===== \n";
175 mFile << "// Before editing this file, make sure it's a file of your own ";
176 mFile << "(i.e.: it wasn't generated from xml description; if so : your modifications will be lost)\n";
177 mFile << "//===== \n";
181 //==========================================================================
182 void bbfy::ParseXML()
187 XMLResults* res = new XMLResults;
188 XMLNode BB = XMLNode::parseFile(mFilename.c_str(),"blackbox",res);
190 if ( res->error != eXMLErrorNone )
192 std::ostringstream str;
193 str << XMLNode::getError(res->error);
194 str << " [line " << res->nLine << ", col "<<res->nColumn<<"]";
196 throw bbfyException(str.str());
201 if (!BB.isAttributeSet("name"))
203 throw bbfyException("Error : <blackbox> tag : no 'name' attribute found (mandatory)");
205 mName = BB.getAttribute("name");
207 if (mVerbose) std::cout << "* Creating BlackBox '"<<mName<<"'"<<std::endl;
214 if (BB.isAttributeSet("type"))
216 std::string bbtype = BB.getAttribute("type");
217 if (bbtype=="standard")
222 else if (bbtype==itkImageToImageFilterString)
224 mType = itkImageToImageFilter;
225 // Looks for <itkparent> tag
226 if (!BB.nChildNode("itkparent"))
228 throw bbfyException("Error : blackbox type '"+itkImageToImageFilterString+"' but no <itkparent> tag found (mandatory)");
230 bbtk::GetTextOrClear(BB.getChildNode("itkparent"),mItkParent);
233 if (BB.isAttributeSet("generic")) mGeneric=true;
235 else if (bbtype == vtkImageAlgorithmString)
237 mType = vtkImageAlgorithm;
238 // Looks for <vtkobject> tag
239 if (!BB.nChildNode("vtkobject"))
241 throw bbfyException("Error : blackbox type '"
242 +vtkImageAlgorithmString
243 +"' but no <vtkobject> tag found (mandatory)");
245 bbtk::GetTextOrClear(BB.getChildNode("vtkobject"),mVtkObject);
248 else if (bbtype == vtkPolyDataAlgorithmString )
250 mType = vtkPolyDataAlgorithm;
251 // Looks for <vtkobject> tag
252 if (!BB.nChildNode("vtkobject"))
254 throw bbfyException("Error : blackbox type '"
255 +vtkPolyDataAlgorithmString
256 +"' but no <vtkobject> tag found (mandatory)");
258 bbtk::GetTextOrClear(BB.getChildNode("vtkobject"),mVtkObject);
263 std::string mess("Error : blackbox type '");
265 mess += "' unknown. Known types :";
266 mess += "'" + itkImageToImageFilterString + "' ";
267 mess += "'" + vtkImageAlgorithmString + "' ";
268 mess += "'" + vtkPolyDataAlgorithmString + "' ";
269 throw bbfyException(mess);
274 if (BB.isAttributeSet("widget"))
277 mParentBlackBox = "bbtk::WxBlackBox";
278 mInclude.push_back("bbtkWxBlackBox.h");
283 mParentBlackBox = "bbtk::AtomicBlackBox";
284 mInclude.push_back("bbtkAtomicBlackBox.h");
289 for (i=0,j=0; i<BB.nChildNode("author"); i++)
292 bbtk::GetTextOrClear(BB.getChildNode("author",&j),val);
297 for (i=0,j=0; i<BB.nChildNode("description"); i++)
300 bbtk::GetTextOrClear(BB.getChildNode("description",&j),val);
305 for (i=0,j=0; i<BB.nChildNode("category"); i++)
308 bbtk::GetTextOrClear(BB.getChildNode("category",&j),val);
313 if (BB.nChildNode("namespace"))
315 bbtk::GetTextOrClear(BB.getChildNode("namespace"),mNamespace);
318 // UserSetDefaultValues body
319 if (BB.nChildNode("defaultValues"))
321 bbtk::GetTextOrClear(BB.getChildNode("defaultValues"),
322 mUserSetDefaultValues);
325 // UserInitializeProcessing body
326 if (BB.nChildNode("initializeProcessing"))
328 bbtk::GetTextOrClear(BB.getChildNode("initializeProcessing"),
329 mUserInitializeProcessing);
332 // UserFinalizeProcessing body
333 if (BB.nChildNode("finalizeProcessing"))
335 bbtk::GetTextOrClear(BB.getChildNode("finalizeProcessing"),
336 mUserFinalizeProcessing);
341 // Template parameters
342 // mNbTemplateParam = BB.nChildNode("template");
344 if ( BB.nChildNode("template") > 0)
346 mTemplateDeclaration = "<";
347 mTemplateImplementation = "<";
349 for (i=0,j=0; i<BB.nChildNode("template")-1; i++)
351 mTemplateDeclaration += "class ";
353 bbtk::GetTextOrClear(BB.getChildNode("template",&j),val);
354 mTemplateDeclaration += val;
355 mTemplateDeclaration += ",";
356 mTemplateImplementation += val;
357 mTemplateImplementation += ",";
358 mTemplateParam.push_back(val);
360 mTemplateDeclaration += "class ";
362 bbtk::GetTextOrClear(BB.getChildNode("template",&j),val);
363 mTemplateDeclaration += val;
364 mTemplateDeclaration += ">";
365 mTemplateImplementation += val;
366 mTemplateImplementation += ">";
367 mTemplateParam.push_back(val);
371 for (i=0,j=0; i<BB.nChildNode("include"); i++)
374 bbtk::GetTextOrClear(BB.getChildNode("include",&j),val);
375 mInclude.push_back(val);
378 for (i=0,j=0; i<BB.nChildNode("typedef"); i++)
381 bbtk::GetTextOrClear(BB.getChildNode("typedef",&j),val);
382 mTypedef.push_back(val);
386 for (i=0,j=0; i<BB.nChildNode("input"); i++)
389 XMLNode n = BB.getChildNode("input",&j);
390 if (!n.isAttributeSet("name"))
392 throw bbfyException("Error : <input> attribute 'name' not found (mandatory)");
394 io.name = n.getAttribute("name");
395 if (!n.isAttributeSet("type"))
397 throw bbfyException("Error : <input name=\""+io.name+"\"> attribute 'type' not found (mandatory)");
399 io.type = n.getAttribute("type");
400 if (!n.isAttributeSet("description"))
402 throw bbfyException("Error : <input name=\""+io.name+"\"> attribute 'description' not found (mandatory)");
404 io.descr = n.getAttribute("description");
406 if (n.isAttributeSet("special"))
408 io.special = n.getAttribute("special");
411 if (n.isAttributeSet("nature"))
413 io.nature = n.getAttribute("nature");
416 if (n.isAttributeSet("generic_type"))
418 io.generic_type = n.getAttribute("generic_type");
421 mInput.push_back(io);
425 for (i=0,j=0; i<BB.nChildNode("output"); i++)
428 XMLNode n = BB.getChildNode("output",&j);
429 if (!n.isAttributeSet("name"))
431 throw bbfyException("Error : <output> attribute 'name' not found (mandatory)");
433 io.name = n.getAttribute("name");
434 if (!n.isAttributeSet("type"))
436 throw bbfyException("Error : <output name=\""+io.name+"\"> attribute 'type' not found (mandatory)");
438 io.type = n.getAttribute("type");
439 if (!n.isAttributeSet("description"))
441 throw bbfyException("Error : <output name=\""+io.name+"\"> attribute 'description' not found (mandatory)");
443 io.descr = n.getAttribute("description");
445 if (n.isAttributeSet("special"))
447 io.special = n.getAttribute("special");
450 if (n.isAttributeSet("nature"))
452 io.nature = n.getAttribute("nature");
455 if (n.isAttributeSet("generic_type"))
457 io.generic_type = n.getAttribute("generic_type");
460 mOutput.push_back(io);
465 // process tag given ?
466 if (BB.nChildNode("process"))
468 bbtk::GetTextOrClear(BB.getChildNode("process"),mProcess);
472 // createwidget tag given ?
473 if (BB.nChildNode("createwidget"))
475 bbtk::GetTextOrClear(BB.getChildNode("createwidget"),mCreateWidget);
484 // OBSOLETE/UNSUPPORTED TAGS
485 // WARN IF OBSOLETE TAGS PROVIDED
486 if (BB.nChildNode("constructor"))
488 std::cout << "WARNING !!! The tag <constructor> is obsolete !!"<<std::endl;
490 if (BB.nChildNode("destructor"))
492 std::cout << "WARNING !!! The tag <destructor> is obsolete !!"<<std::endl;
494 if (BB.nChildNode("copy_constructor"))
496 std::cout << "WARNING !!! The tag <copy_constructor> is obsolete !!"<<std::endl;
502 //==========================================================================
505 //==========================================================================
506 void bbfy::BeginNamespace()
508 // if (mIsInNamespace)
510 mFile << "namespace "<<mNamespace <<"\n{\n\n";
513 //==========================================================================
515 //==========================================================================
516 void bbfy::EndNamespace()
518 // if (mIsInNamespace)
520 mFile << "}\n// EO namespace "<<mNamespace<<"\n\n";
523 //==========================================================================
526 //==========================================================================
527 void bbfy::CreateHeader()
534 if (mVerbose) std::cout << " - Creating header '"<<mHName<<"'"<<std::endl;
535 std::string fullname = mOutputPath + mHName;
536 mFile.open(fullname.c_str());
539 std::string mess("Error : could not open file \"");
540 mess += fullname + "\"";
541 throw bbfyException(mess);
549 mFile << "#ifdef _USE_WXWIDGETS_\n";
552 // Prevent multiple inclusions
553 std::string included("__bb");
554 included += mPackage + mName + "_h_INCLUDED__";
555 mFile << "#ifndef " << included <<"\n";
556 mFile << "#define " << included <<"\n";
559 mFile << "#include \"bb" << mPackage << "_EXPORT.h\"\n";
560 std::vector<std::string>::iterator i;
561 for (i=mInclude.begin(); i!=mInclude.end(); ++i)
563 mFile << "#include \"" << *i <<"\"\n";
565 if (mGeneric) mFile << "#include \"bbitkImage.h\"\n";
568 if (mType == itkImageToImageFilter )
570 mFile << "#include \"bbtkItkBlackBoxMacros.h\"\n";
572 else if ( (mType == vtkImageAlgorithm) ||
573 (mType == vtkPolyDataAlgorithm) )
575 mFile << "#include \"bbtkVtkBlackBoxMacros.h\"\n";
582 // If it is a template class
583 if (mTemplateParam.size() > 0)
585 mFile << "template " << mTemplateDeclaration <<"\n";
588 // Class declaration and parents
589 mFile << "class bb"<<mPackage<<"_EXPORT "<<mName<<"\n";
593 if (mBB.nChildNode("inherits"))
596 for (i=0,j=0; i<mBB.nChildNode("inherits")-1; i++)
599 << mBB.getChildNode("inherits",&j).getText()
603 << mBB.getChildNode("Inherits",&j).getText()
608 if (mType == itkImageToImageFilter )
610 mFile << " public " << mItkParent <<",\n";
613 mFile << " public "<<mParentBlackBox << "\n";
620 if (mType == itkImageToImageFilter)
622 mFile << " BBTK_ITK_BLACK_BOX_INTERFACE("
624 << mParentBlackBox << ","
629 else if ( (mType == vtkImageAlgorithm) ||
630 (mType == vtkPolyDataAlgorithm) )
632 mFile << " BBTK_VTK_BLACK_BOX_INTERFACE("
634 << mParentBlackBox << ","
642 mFile << " BBTK_BLACK_BOX_INTERFACE("
644 << mParentBlackBox << ");\n";
647 for (i=mTypedef.begin(); i!=mTypedef.end(); ++i)
656 std::vector<IO>::iterator ioi;
657 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
659 if (ioi->special=="")
661 mFile << " BBTK_DECLARE_INPUT("
667 else if (ioi->special=="itk input")
669 mFile << " BBTK_DECLARE_ITK_INPUT("
675 else if (ioi->special=="vtk input")
677 if (mType == vtkImageAlgorithm) {
678 mFile << " BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT("
684 else if (mType == vtkPolyDataAlgorithm) {
685 mFile << " BBTK_DECLARE_POLY_DATA_ALGORITHM_INPUT("
692 else if (ioi->special=="itk parameter")
694 mFile << " BBTK_DECLARE_ITK_PARAM("
700 else if (ioi->special=="vtk parameter")
702 mFile << " BBTK_DECLARE_VTK_PARAM("
710 std::string mess("Error : input '");
712 mess += "', 'special' attribute '";
713 mess += ioi->special;
715 throw bbfyException(mess);
721 for (ioi=mOutput.begin(); ioi!=mOutput.end(); ++ioi)
723 if (ioi->special=="")
725 mFile << " BBTK_DECLARE_OUTPUT("
731 else if (ioi->special=="itk output")
733 mFile << " BBTK_DECLARE_ITK_OUTPUT("
739 else if (ioi->special=="vtk output")
741 mFile << " BBTK_DECLARE_VTK_OUTPUT("
749 std::string mess("Error : output '");
751 mess += "', 'special' attribute '";
752 mess += ioi->special;
754 throw bbfyException(mess);
759 if ((mType == STD)||(mProcess.size()))
761 mFile << " BBTK_PROCESS(Process);\n" ;
762 mFile << " void Process();\n";
764 else if (mType == itkImageToImageFilter)
766 mFile << " BBTK_ITK_PROCESS();\n" ;
768 else if ((mType == vtkImageAlgorithm) ||
769 (mType == vtkPolyDataAlgorithm) )
772 mFile << " BBTK_VTK_PROCESS();\n" ;
778 mFile << " BBTK_CREATE_WIDGET(CreateWidget);\n" ;
779 mFile << " void CreateWidget(wxWindow*);\n";
784 // EO black box declaration
787 // BO black box description
788 if (mTemplateParam.size()==0)
790 mFile << "BBTK_BEGIN_DESCRIBE_BLACK_BOX("
792 << mParentBlackBox << ");\n";
793 mFile << "BBTK_NAME(\"" << mName <<"\");\n";
795 else if (mTemplateParam.size()==1)
797 mFile << "BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX("
799 //<< mParentBlackBox //<< ","
800 // << mTemplateParam[0]
802 mFile << "BBTK_NAME(\"" << mName
803 << "<\"+bbtk::TypeName<" << mTemplateParam[0]
808 throw bbfyException("template bb with more than 1 templ param not impl");
813 mFile << "BBTK_AUTHOR(\""<<mAuthor<< "\");\n";
816 mFile << "BBTK_DESCRIPTION(\""<<mDescription<< "\");\n";
819 mFile << "BBTK_CATEGORY(\""<<mCategory<< "\");\n";
821 for (i=mTypedef.begin(); i!=mTypedef.end(); ++i)
827 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
829 if (mTemplateParam.size()>0)
831 mFile << "BBTK_TEMPLATE_INPUT(";
835 mFile << "BBTK_INPUT(";
837 mFile << mName << "," << ioi->name << ",\""
838 << ioi->descr << "\"," << ioi->type << ",\""
839 << ioi->nature<<"\");\n";
843 for (ioi=mOutput.begin(); ioi!=mOutput.end(); ++ioi)
845 if (mTemplateParam.size()>0)
847 mFile << "BBTK_TEMPLATE_OUTPUT(";
851 mFile << "BBTK_OUTPUT(";
853 mFile << mName << "," << ioi->name << ",\""
854 << ioi->descr << "\"," << ioi->type << ",\""
855 << ioi->nature<<"\");\n";
858 // EO black box description
859 if (mTemplateParam.size()==0)
861 mFile << "BBTK_END_DESCRIBE_BLACK_BOX("
864 else if (mTemplateParam.size()==1)
866 mFile << "BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX("
868 // << mTemplateParam[0]
873 throw bbfyException("template bb with more than 1 templ param not impl");
877 // Untemplatization of itk filters
880 WriteGenericITKFilterHeader();
888 // Prevent multiple inclusions
889 mFile << "#endif // " << included <<"\n";
893 mFile << "#endif // _USE_WXWIDGETS_\n";
901 //==========================================================================
905 //==========================================================================
906 void bbfy::WriteGenericITKFilterHeader()
908 mFile << "\n//===================================================\n";
909 mFile << "// Generic \"untemplatized\" filter\n";
910 mFile << "//===================================================\n";
912 // Class declaration and parents
913 mFile << "class /*BBTK_EXPORT*/ "<<mName<<"Generic\n";
915 mFile << " public bbtk::AtomicBlackBox\n";
919 mFile << " BBTK_BLACK_BOX_INTERFACE("
920 << mName << "Generic,bbtk::AtomicBlackBox);\n";
923 std::vector<IO>::iterator ioi;
924 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
926 mFile << " BBTK_DECLARE_INPUT("
934 for (ioi=mOutput.begin(); ioi!=mOutput.end(); ++ioi)
936 mFile << " BBTK_DECLARE_OUTPUT("
944 mFile << " BBTK_PROCESS(ProcessSwitch);\n";
945 mFile << " private :\n";
946 mFile << " inline void ProcessSwitch();\n";
947 mFile << " template <class T, unsigned int D> void Process();\n";
948 // EO black box declaration
953 // BO black box description
954 mFile << "BBTK_BEGIN_DESCRIBE_BLACK_BOX("
955 << mName << "Generic,bbtk::AtomicBlackBox);\n";
956 mFile << "BBTK_NAME(\"" << mName <<"\");\n";
959 mFile << "BBTK_AUTHOR(\""<<mAuthor<< "\");\n";
962 mFile << "BBTK_DESCRIPTION(\""<<mDescription<< "\");\n";
965 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
967 mFile << "BBTK_INPUT(";
968 mFile << mName << "Generic," << ioi->name << ",\""
969 << ioi->descr << "\"," << ioi->generic_type <<");\n";
973 for (ioi=mOutput.begin(); ioi!=mOutput.end(); ++ioi)
975 mFile << "BBTK_OUTPUT(";
976 mFile << mName << "Generic," << ioi->name << ",\""
977 << ioi->descr << "\"," << ioi->generic_type <<");\n";
980 // EO black box description
981 mFile << "BBTK_END_DESCRIBE_BLACK_BOX("
982 << mName << "Generic);\n";
985 //=================================================================
986 // ProcessSwitch implementation
987 mFile << "void "<< mName <<"Generic::ProcessSwitch()\n"
989 << "CALL_FOR_ALL_TYPES_AND_DIM(bbGetInputIn()->GetType(),\n"
990 << " bbGetInputIn()->GetDimension(),\n"
993 //=================================================================
996 //=================================================================
997 // Template process implementation
998 mFile << "template <class T, unsigned int D>\n"
999 << "void "<<mName<<"Generic::Process()\n"
1001 << " bbtkDebugMessageInc(\"Kernel\",9,\n"
1003 << "Generic::Process<\"<<TypeName<T>()<<\",\"<<D<<\">()\"<<std::endl);\n"
1005 << " typedef itk::Image<T,D> ImageType;\n"
1006 << " typedef "<<mName<<"<ImageType> FilterType;\n"
1008 << " FilterType* f = new FilterType(\"Temp\");\n"
1010 << " f->bbSetInputIn( this->bbGetInputIn()->GetImage<T,D>() );\n";
1012 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
1014 if (ioi->name == "In") continue;
1015 mFile << " f->bbSetInput"<<ioi->name<<" ( this->bbGetInput"
1016 << ioi->name << "() );\n";
1019 mFile << " f->bbUpdate();\n"
1020 << " this->bbSetOutputOut( new itkImage( f->bbGetOutputOut() ) );\n"
1021 << " f->UnRegister();\n"
1022 << " bbtkDebugDecTab(\"Kernel\",9);\n"
1024 //=================================================================
1028 //==========================================================================
1031 //==========================================================================
1032 void bbfy::CreateCode()
1035 mCxxName += mPackage;
1038 if (mVerbose) std::cout << " - Creating code '"<<mCxxName<<"'"<<std::endl;
1039 std::string fullname = mOutputPath + mCxxName;
1040 mFile.open(fullname.c_str());
1043 std::string mess("Error : could not open file \"");
1046 throw bbfyException(mess);
1053 // Header of the class
1054 mFile << "#include \"" << mHName << "\"\n";
1056 // Include Package header
1057 mFile << "#include \"bb"<<mPackage << "Package.h\"\n";
1064 if (mTemplateParam.size()>0)
1067 mFile << "BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION("
1069 << mParentBlackBox << ");\n";
1074 mFile << "BBTK_BLACK_BOX_IMPLEMENTATION("
1075 << mName << "Generic,bbtk::AtomicBlackBox);\n";
1077 mFile << "BBTK_ADD_BLACK_BOX_TO_PACKAGE("
1079 << mName << "Generic)\n";
1084 // Non template class
1086 mFile << "BBTK_ADD_BLACK_BOX_TO_PACKAGE("
1091 mFile << "BBTK_BLACK_BOX_IMPLEMENTATION("
1093 << mParentBlackBox << ");\n";
1096 if ((mType == STD)||(mProcess.size()))
1099 mFile << "void "<<mName<<"::Process()\n{\n";
1100 mFile << mProcess << "\n";
1107 mFile << "void "<<mName<<"::CreateWidget(wxWindow* parent)\n{\n";
1108 mFile << mCreateWidget << "\n";
1113 // User Set Default Values
1115 mFile <<"void "<<mName<<"::bbUserSetDefaultValues()"<<std::endl;
1116 mFile << "{"<<std::endl;
1117 if ( (mType == vtkImageAlgorithm) || (mType == vtkPolyDataAlgorithm) )
1119 mFile << " BBTK_VTK_SET_DEFAULT_VALUES();\n";
1121 mFile << mUserSetDefaultValues << std::endl;
1122 mFile << "}" << std::endl;
1124 // User Initialize Processing
1126 mFile <<"void "<<mName<<"::bbUserInitializeProcessing()"
1128 mFile << "{"<<std::endl;
1129 if ( (mType == vtkImageAlgorithm) || (mType == vtkPolyDataAlgorithm) )
1131 mFile << " BBTK_VTK_INITIALIZE_PROCESSING();\n";
1133 mFile << mUserInitializeProcessing << std::endl;
1134 mFile << "}" << std::endl;
1136 // User Finalize Processing
1138 mFile <<"void "<<mName<<"::bbUserFinalizeProcessing()"<<std::endl;
1139 mFile << "{"<<std::endl;
1140 if ( (mType == vtkImageAlgorithm) || (mType == vtkPolyDataAlgorithm) )
1142 mFile << " BBTK_VTK_FINALIZE_PROCESSING();\n";
1144 mFile << mUserFinalizeProcessing << std::endl;
1145 mFile << "}" << std::endl;
1157 //==========================================================================
1163 //==========================================================================
1164 int main(int argc, char **argv)
1167 if (argc<2 || argc>5)
1169 std::cerr << "usage : "<< argv[0] <<" xml_file [package_name] [output_path] [-q]" << std::endl;
1175 std::string package("PACKAGE_NAME");
1176 std::string output_path("");
1177 bool verbose = true;
1178 if (argc>2) package = argv[2];
1179 if (argc>3) output_path = argv[3];
1180 if (argc>4) verbose = false;
1182 bbfy B(argv[1],package,output_path,verbose);
1184 catch (bbfyException e)
1186 std::cerr << argv[0] << " " << argv[1] << std::endl
1187 << e.mMessage << std::endl;
1192 //==========================================================================