2 #define _CRT_SECURE_NO_DEPRECATE
12 //==========================================================================
16 bbfyException(const std::string& message) : mMessage(message) {}
20 //==========================================================================
22 const std::string itkImageToImageFilterString = "ITK_ImageToImageFilter";
23 const std::string vtkImageAlgorithmString = "VTK_ImageAlgorithm";
24 const std::string vtkPolyDataAlgorithmString = "VTK_PolyDataAlgorithm";
26 //==========================================================================
30 bbfy(const std::string& filename,
31 const std::string& package = "PACKAGE_NAME",
32 const std::string& output_path = "",
33 bool verbose = false);
35 void CreateBlackBox();
40 void WriteGenericITKFilterHeader();
42 void BeginNamespace();
47 std::string mFilename;
48 std::string mOutputPath;
56 itkImageToImageFilter,
64 std::string mParentBlackBox;
65 std::string mItkParent;
66 std::string mVtkParent;
69 std::string mDescription;
70 std::string mCategory;
72 // bool mIsInNamespace;
73 std::string mNamespace;
74 // int mNbTemplateParam;
75 std::vector<std::string> mTemplateParam;
76 std::string mTemplateDeclaration;
77 std::string mTemplateImplementation;
79 std::vector<std::string> mInclude;
80 std::vector<std::string> mTypedef;
82 std::string mUserConstructor;
83 std::string mUserCopyConstructor;
84 std::string mUserDestructor;
93 std::string generic_type;
97 std::vector<IO> mInput;
98 std::vector<IO> mOutput;
100 std::string mProcess;
101 std::string mCreateWidget;
106 std::string mCxxName;
109 //==========================================================================
113 //==========================================================================
114 bbfy::bbfy(const std::string& filename,
115 const std::string& package,
116 const std::string& output_path,
121 mFilename = filename;
123 mNamespace = "bb" + mPackage;
125 mOutputPath = output_path;
130 //==========================================================================
132 //==========================================================================
133 void bbfy::CreateBlackBox()
135 // Parse XML input file
137 // Create output files
141 //==========================================================================
145 //==========================================================================
146 void bbfy::ParseXML()
148 XMLResults* res = new XMLResults;
149 XMLNode BB = XMLNode::parseFile(mFilename.c_str(),"blackbox",res);
151 if ( res->error != eXMLErrorNone )
153 std::ostringstream str;
154 str << XMLNode::getError(res->error);
155 str << " [line " << res->nLine << ", col "<<res->nColumn<<"]";
157 throw bbfyException(str.str());
162 if (!BB.isAttributeSet("name"))
164 throw bbfyException("Error : <blackbox> tag : no 'name' attribute found (mandatory)");
166 mName = BB.getAttribute("name");
168 if (mVerbose) std::cout << "* Creating BlackBox '"<<mName<<"'"<<std::endl;
175 if (BB.isAttributeSet("type"))
177 std::string bbtype = BB.getAttribute("type");
178 if (bbtype=="standard")
183 else if (bbtype==itkImageToImageFilterString)
185 mType = itkImageToImageFilter;
186 // Looks for <itkparent> tag
187 if (!BB.nChildNode("itkparent"))
189 throw bbfyException("Error : blackbox type '"+itkImageToImageFilterString+"' but no <itkparent> tag found (mandatory)");
191 bbtk::GetTextOrClear(BB.getChildNode("itkparent"),mItkParent);
194 if (BB.isAttributeSet("generic")) mGeneric=true;
196 else if (bbtype == vtkImageAlgorithmString)
198 mType = vtkImageAlgorithm;
199 // Looks for <vtkparent> tag
200 if (!BB.nChildNode("vtkparent"))
202 throw bbfyException("Error : blackbox type '"
203 +vtkImageAlgorithmString
204 +"' but no <vtkparent> tag found (mandatory)");
206 bbtk::GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
209 else if (bbtype == vtkPolyDataAlgorithmString )
211 mType = vtkPolyDataAlgorithm;
212 // Looks for <vtkparent> tag
213 if (!BB.nChildNode("vtkparent"))
215 throw bbfyException("Error : blackbox type '"
216 +vtkPolyDataAlgorithmString
217 +"' but no <vtkparent> tag found (mandatory)");
219 bbtk::GetTextOrClear(BB.getChildNode("vtkparent"),mVtkParent);
224 std::string mess("Error : blackbox type '");
226 mess += "' unknown. Known types :";
227 mess += "'" + itkImageToImageFilterString + "' ";
228 mess += "'" + vtkImageAlgorithmString + "' ";
229 mess += "'" + vtkPolyDataAlgorithmString + "' ";
230 throw bbfyException(mess);
235 if (BB.isAttributeSet("widget"))
238 mParentBlackBox = "bbtk::WxBlackBox";
239 mInclude.push_back("bbtkWxBlackBox.h");
244 mParentBlackBox = "bbtk::AtomicBlackBox";
245 mInclude.push_back("bbtkAtomicBlackBox.h");
250 for (i=0,j=0; i<BB.nChildNode("author"); i++)
253 bbtk::GetTextOrClear(BB.getChildNode("author",&j),val);
258 for (i=0,j=0; i<BB.nChildNode("description"); i++)
261 bbtk::GetTextOrClear(BB.getChildNode("description",&j),val);
266 for (i=0,j=0; i<BB.nChildNode("category"); i++)
269 bbtk::GetTextOrClear(BB.getChildNode("category",&j),val);
274 if (BB.nChildNode("namespace"))
276 bbtk::GetTextOrClear(BB.getChildNode("namespace"),mNamespace);
279 // UserConstructor body
280 if (BB.nChildNode("constructor"))
282 bbtk::GetTextOrClear(BB.getChildNode("constructor"),mUserConstructor);
284 // UserCopyConstructor body
285 if (BB.nChildNode("copyconstructor"))
287 bbtk::GetTextOrClear(BB.getChildNode("copyconstructor"),mUserCopyConstructor);
289 // UserDestructor body
290 if (BB.nChildNode("destructor"))
292 bbtk::GetTextOrClear(BB.getChildNode("destructor"),mUserDestructor);
295 // Template parameters
296 // mNbTemplateParam = BB.nChildNode("template");
298 if ( BB.nChildNode("template") > 0)
300 mTemplateDeclaration = "<";
301 mTemplateImplementation = "<";
303 for (i=0,j=0; i<BB.nChildNode("template")-1; i++)
305 mTemplateDeclaration += "class ";
307 bbtk::GetTextOrClear(BB.getChildNode("template",&j),val);
308 mTemplateDeclaration += val;
309 mTemplateDeclaration += ",";
310 mTemplateImplementation += val;
311 mTemplateImplementation += ",";
312 mTemplateParam.push_back(val);
314 mTemplateDeclaration += "class ";
316 bbtk::GetTextOrClear(BB.getChildNode("template",&j),val);
317 mTemplateDeclaration += val;
318 mTemplateDeclaration += ">";
319 mTemplateImplementation += val;
320 mTemplateImplementation += ">";
321 mTemplateParam.push_back(val);
325 for (i=0,j=0; i<BB.nChildNode("include"); i++)
328 bbtk::GetTextOrClear(BB.getChildNode("include",&j),val);
329 mInclude.push_back(val);
332 for (i=0,j=0; i<BB.nChildNode("typedef"); i++)
335 bbtk::GetTextOrClear(BB.getChildNode("typedef",&j),val);
336 mTypedef.push_back(val);
340 for (i=0,j=0; i<BB.nChildNode("input"); i++)
343 XMLNode n = BB.getChildNode("input",&j);
344 if (!n.isAttributeSet("name"))
346 throw bbfyException("Error : <input> attribute 'name' not found (mandatory)");
348 io.name = n.getAttribute("name");
349 if (!n.isAttributeSet("type"))
351 throw bbfyException("Error : <input name=\""+io.name+"\"> attribute 'type' not found (mandatory)");
353 io.type = n.getAttribute("type");
354 if (!n.isAttributeSet("description"))
356 throw bbfyException("Error : <input name=\""+io.name+"\"> attribute 'description' not found (mandatory)");
358 io.descr = n.getAttribute("description");
360 if (n.isAttributeSet("special"))
362 io.special = n.getAttribute("special");
365 if (n.isAttributeSet("nature"))
367 io.nature = n.getAttribute("nature");
370 if (n.isAttributeSet("generic_type"))
372 io.generic_type = n.getAttribute("generic_type");
375 mInput.push_back(io);
379 for (i=0,j=0; i<BB.nChildNode("output"); i++)
382 XMLNode n = BB.getChildNode("output",&j);
383 if (!n.isAttributeSet("name"))
385 throw bbfyException("Error : <output> attribute 'name' not found (mandatory)");
387 io.name = n.getAttribute("name");
388 if (!n.isAttributeSet("type"))
390 throw bbfyException("Error : <output name=\""+io.name+"\"> attribute 'type' not found (mandatory)");
392 io.type = n.getAttribute("type");
393 if (!n.isAttributeSet("description"))
395 throw bbfyException("Error : <output name=\""+io.name+"\"> attribute 'description' not found (mandatory)");
397 io.descr = n.getAttribute("description");
399 if (n.isAttributeSet("special"))
401 io.special = n.getAttribute("special");
404 if (n.isAttributeSet("nature"))
406 io.nature = n.getAttribute("nature");
409 if (n.isAttributeSet("generic_type"))
411 io.generic_type = n.getAttribute("generic_type");
414 mOutput.push_back(io);
419 // process tag given ?
420 if (BB.nChildNode("process"))
422 bbtk::GetTextOrClear(BB.getChildNode("process"),mProcess);
425 // createwidget tag given ?
426 if (BB.nChildNode("createwidget"))
428 bbtk::GetTextOrClear(BB.getChildNode("createwidget"),mCreateWidget);
431 //==========================================================================
434 //==========================================================================
435 void bbfy::BeginNamespace()
437 // if (mIsInNamespace)
439 mFile << "namespace "<<mNamespace <<"\n{\n\n";
442 //==========================================================================
444 //==========================================================================
445 void bbfy::EndNamespace()
447 // if (mIsInNamespace)
449 mFile << "}\n// EO namespace "<<mNamespace<<"\n\n";
452 //==========================================================================
455 //==========================================================================
456 void bbfy::CreateHeader()
463 if (mVerbose) std::cout << " - Creating header '"<<mHName<<"'"<<std::endl;
464 std::string fullname = mOutputPath + mHName;
465 mFile.open(fullname.c_str());
468 std::string mess("Error : could not open file \"");
469 mess += fullname + "\"";
470 throw bbfyException(mess);
476 mFile << "#ifdef _USE_WXWIDGETS_\n";
479 // Prevent multiple inclusions
480 std::string included("__bb");
481 included += mPackage + mName + "_h_INCLUDED__";
482 mFile << "#ifndef " << included <<"\n";
483 mFile << "#define " << included <<"\n";
486 // mFile << "#include \"bbtkAtomicBlackBox.h\"\n";
487 std::vector<std::string>::iterator i;
488 for (i=mInclude.begin(); i!=mInclude.end(); ++i)
490 mFile << "#include \"" << *i <<"\"\n";
492 if (mGeneric) mFile << "#include \"bbitkImage.h\"\n";
495 if (mType == itkImageToImageFilter )
497 mFile << "#include \"bbtkItkBlackBoxMacros.h\"\n";
499 else if ( (mType == vtkImageAlgorithm) ||
500 (mType == vtkPolyDataAlgorithm) )
502 mFile << "#include \"bbtkVtkBlackBoxMacros.h\"\n";
509 // If it is a template class
510 if (mTemplateParam.size() > 0)
512 mFile << "template " << mTemplateDeclaration <<"\n";
515 // Class declaration and parents
516 mFile << "class /*BBTK_EXPORT*/ "<<mName<<"\n";
520 if (mBB.nChildNode("inherits"))
523 for (i=0,j=0; i<mBB.nChildNode("inherits")-1; i++)
526 << mBB.getChildNode("inherits",&j).getText()
530 << mBB.getChildNode("Inherits",&j).getText()
535 if (mType == itkImageToImageFilter )
537 mFile << " public " << mItkParent <<",\n";
539 else if ( (mType == vtkImageAlgorithm) ||
540 (mType == vtkPolyDataAlgorithm) )
542 mFile << " public " << mVtkParent <<",\n";
545 mFile << " public "<<mParentBlackBox << "\n";
552 if (mType == itkImageToImageFilter)
554 mFile << " BBTK_ITK_BLACK_BOX_INTERFACE("
556 << mParentBlackBox << ","
561 else if ( (mType == vtkImageAlgorithm) ||
562 (mType == vtkPolyDataAlgorithm) )
564 mFile << " BBTK_VTK_BLACK_BOX_INTERFACE("
566 << mParentBlackBox << ","
573 mFile << " BBTK_BLACK_BOX_INTERFACE("
575 << mParentBlackBox << ");\n";
578 for (i=mTypedef.begin(); i!=mTypedef.end(); ++i)
583 // Declare user constructor / copy cons /destr
584 mFile << "//=================================================================="<<std::endl;
585 mFile << "/// User callback called in the box contructor"<<std::endl;
587 mFile << "virtual void bbUserConstructor();"<<std::endl;
588 mFile << "/// User callback called in the box copy constructor"<<std::endl;
589 mFile << "virtual void bbUserCopyConstructor();"<<std::endl;
590 mFile << "/// User callback called in the box destructor"<<std::endl;
591 mFile << "virtual void bbUserDestructor();"<<std::endl;
592 mFile << "//=================================================================="<<std::endl;
597 std::vector<IO>::iterator ioi;
598 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
600 if (ioi->special=="")
602 mFile << " BBTK_DECLARE_INPUT("
608 else if (ioi->special=="itk input")
610 mFile << " BBTK_DECLARE_ITK_INPUT("
616 else if (ioi->special=="vtk input")
618 if (mType == vtkImageAlgorithm) {
619 mFile << " BBTK_DECLARE_VTK_IMAGE_ALGORITHM_INPUT("
625 else if (mType == vtkPolyDataAlgorithm) {
626 mFile << " BBTK_DECLARE_POLY_DATA_ALGORITHM_INPUT("
633 else if (ioi->special=="itk parameter")
635 mFile << " BBTK_DECLARE_ITK_PARAM("
641 else if (ioi->special=="vtk parameter")
643 mFile << " BBTK_DECLARE_VTK_PARAM("
651 std::string mess("Error : input '");
653 mess += "', 'special' attribute '";
654 mess += ioi->special;
656 throw bbfyException(mess);
661 for (ioi=mOutput.begin(); ioi!=mOutput.end(); ++ioi)
663 if (ioi->special=="")
665 mFile << " BBTK_DECLARE_OUTPUT("
671 else if (ioi->special=="itk output")
673 mFile << " BBTK_DECLARE_ITK_OUTPUT("
679 else if (ioi->special=="vtk output")
681 mFile << " BBTK_DECLARE_VTK_OUTPUT("
689 std::string mess("Error : output '");
691 mess += "', 'special' attribute '";
692 mess += ioi->special;
694 throw bbfyException(mess);
699 if ((mType == STD)||(mProcess.size()))
701 mFile << " BBTK_PROCESS(Process);\n" ;
702 mFile << " void Process();\n";
704 else if (mType == itkImageToImageFilter)
706 mFile << " BBTK_ITK_PROCESS();\n" ;
708 else if ((mType == vtkImageAlgorithm) ||
709 (mType == vtkPolyDataAlgorithm) )
712 mFile << " BBTK_VTK_PROCESS();\n" ;
718 mFile << " BBTK_CREATE_WIDGET(CreateWidget);\n" ;
719 mFile << " void CreateWidget();\n";
723 // EO black box declaration
726 // BO black box description
727 if (mTemplateParam.size()==0)
729 mFile << "BBTK_BEGIN_DESCRIBE_BLACK_BOX("
731 << mParentBlackBox << ");\n";
732 mFile << "BBTK_NAME(\"" << mName <<"\");\n";
734 else if (mTemplateParam.size()==1)
736 mFile << "BBTK_BEGIN_DESCRIBE_TEMPLATE_BLACK_BOX("
738 //<< mParentBlackBox //<< ","
739 // << mTemplateParam[0]
741 mFile << "BBTK_NAME(\"" << mName
742 << "<\"+bbtk::TypeName<" << mTemplateParam[0]
747 throw bbfyException("template bb with more than 1 templ param not impl");
751 mFile << "BBTK_AUTHOR(\""<<mAuthor<< "\");\n";
754 mFile << "BBTK_DESCRIPTION(\""<<mDescription<< "\");\n";
757 mFile << "BBTK_CATEGORY(\""<<mCategory<< "\");\n";
759 for (i=mTypedef.begin(); i!=mTypedef.end(); ++i)
765 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
767 if (mTemplateParam.size()>0)
769 mFile << "BBTK_TEMPLATE_INPUT(";
773 mFile << "BBTK_INPUT(";
775 mFile << mName << "," << ioi->name << ",\""
776 << ioi->descr << "\"," << ioi->type << ",\""
777 << ioi->nature<<"\");\n";
781 for (ioi=mOutput.begin(); ioi!=mOutput.end(); ++ioi)
783 if (mTemplateParam.size()>0)
785 mFile << "BBTK_TEMPLATE_OUTPUT(";
789 mFile << "BBTK_OUTPUT(";
791 mFile << mName << "," << ioi->name << ",\""
792 << ioi->descr << "\"," << ioi->type << ",\""
793 << ioi->nature<<"\");\n";
796 // EO black box description
797 if (mTemplateParam.size()==0)
799 mFile << "BBTK_END_DESCRIBE_BLACK_BOX("
802 else if (mTemplateParam.size()==1)
804 mFile << "BBTK_END_DESCRIBE_TEMPLATE_BLACK_BOX("
806 // << mTemplateParam[0]
811 throw bbfyException("template bb with more than 1 templ param not impl");
815 // Untemplatization of itk filters
818 WriteGenericITKFilterHeader();
825 // Prevent multiple inclusions
826 mFile << "#endif // " << included <<"\n";
830 mFile << "#endif // _USE_WXWIDGETS_\n";
838 //==========================================================================
842 //==========================================================================
843 void bbfy::WriteGenericITKFilterHeader()
845 mFile << "\n//===================================================\n";
846 mFile << "// Generic \"untemplatized\" filter\n";
847 mFile << "//===================================================\n";
849 // Class declaration and parents
850 mFile << "class /*BBTK_EXPORT*/ "<<mName<<"Generic\n";
852 mFile << " public bbtk::AtomicBlackBox\n";
856 mFile << " BBTK_BLACK_BOX_INTERFACE("
857 << mName << "Generic,bbtk::AtomicBlackBox);\n";
860 std::vector<IO>::iterator ioi;
861 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
863 mFile << " BBTK_DECLARE_INPUT("
871 for (ioi=mOutput.begin(); ioi!=mOutput.end(); ++ioi)
873 mFile << " BBTK_DECLARE_OUTPUT("
881 mFile << " BBTK_PROCESS(ProcessSwitch);\n";
882 mFile << " private :\n";
883 mFile << " inline void ProcessSwitch();\n";
884 mFile << " template <class T, unsigned int D> void Process();\n";
885 // EO black box declaration
890 // BO black box description
891 mFile << "BBTK_BEGIN_DESCRIBE_BLACK_BOX("
892 << mName << "Generic,bbtk::AtomicBlackBox);\n";
893 mFile << "BBTK_NAME(\"" << mName <<"\");\n";
896 mFile << "BBTK_AUTHOR(\""<<mAuthor<< "\");\n";
899 mFile << "BBTK_DESCRIPTION(\""<<mDescription<< "\");\n";
902 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
904 mFile << "BBTK_INPUT(";
905 mFile << mName << "Generic," << ioi->name << ",\""
906 << ioi->descr << "\"," << ioi->generic_type <<");\n";
910 for (ioi=mOutput.begin(); ioi!=mOutput.end(); ++ioi)
912 mFile << "BBTK_OUTPUT(";
913 mFile << mName << "Generic," << ioi->name << ",\""
914 << ioi->descr << "\"," << ioi->generic_type <<");\n";
917 // EO black box description
918 mFile << "BBTK_END_DESCRIBE_BLACK_BOX("
919 << mName << "Generic);\n";
922 //=================================================================
923 // ProcessSwitch implementation
924 mFile << "void "<< mName <<"Generic::ProcessSwitch()\n"
926 << "CALL_FOR_ALL_TYPES_AND_DIM(bbGetInputIn()->GetType(),\n"
927 << " bbGetInputIn()->GetDimension(),\n"
930 //=================================================================
933 //=================================================================
934 // Template process implementation
935 mFile << "template <class T, unsigned int D>\n"
936 << "void "<<mName<<"Generic::Process()\n"
938 << " bbtkDebugMessageInc(\"Kernel\",9,\n"
940 << "Generic::Process<\"<<TypeName<T>()<<\",\"<<D<<\">()\"<<std::endl);\n"
942 << " typedef itk::Image<T,D> ImageType;\n"
943 << " typedef "<<mName<<"<ImageType> FilterType;\n"
945 << " FilterType* f = new FilterType(\"Temp\");\n"
947 << " f->bbSetInputIn( this->bbGetInputIn()->GetImage<T,D>() );\n";
949 for (ioi=mInput.begin(); ioi!=mInput.end(); ++ioi)
951 if (ioi->name == "In") continue;
952 mFile << " f->bbSetInput"<<ioi->name<<" ( this->bbGetInput"
953 << ioi->name << "() );\n";
956 mFile << " f->bbUpdate();\n"
957 << " this->bbSetOutputOut( new itkImage( f->bbGetOutputOut() ) );\n"
958 << " f->UnRegister();\n"
959 << " bbtkDebugDecTab(\"Kernel\",9);\n"
961 //=================================================================
965 //==========================================================================
968 //==========================================================================
969 void bbfy::CreateCode()
972 mCxxName += mPackage;
975 if (mVerbose) std::cout << " - Creating code '"<<mCxxName<<"'"<<std::endl;
976 std::string fullname = mOutputPath + mCxxName;
977 mFile.open(fullname.c_str());
980 std::string mess("Error : could not open file \"");
983 throw bbfyException(mess);
987 // Header of the class
988 mFile << "#include \"" << mHName << "\"\n";
990 // Include Package header
991 mFile << "#include \"bb"<<mPackage << "Package.h\"\n";
998 if (mTemplateParam.size()>0)
1001 mFile << "BBTK_BLACK_BOX_TEMPLATE_IMPLEMENTATION("
1003 << mParentBlackBox << ");\n";
1008 mFile << "BBTK_BLACK_BOX_IMPLEMENTATION("
1009 << mName << "Generic,bbtk::AtomicBlackBox);\n";
1011 mFile << "BBTK_ADD_BLACK_BOX_TO_PACKAGE("
1013 << mName << "Generic)\n";
1018 // Non template class
1020 mFile << "BBTK_ADD_BLACK_BOX_TO_PACKAGE("
1025 mFile << "BBTK_BLACK_BOX_IMPLEMENTATION("
1027 << mParentBlackBox << ");\n";
1030 if ((mType == STD)||(mProcess.size()))
1032 mFile << "void "<<mName<<"::Process()\n{\n";
1033 mFile << mProcess << "\n";
1039 mFile << "void "<<mName<<"::CreateWidget()\n{\n";
1040 mFile << mCreateWidget << "\n";
1044 // User constr / copy constr / destr implementation
1045 mFile <<"void "<<mName<<"::bbUserConstructor()"<<std::endl;
1046 mFile << "{"<<std::endl;
1047 //mFile<<"bbtkDebugMessage(\"Kernel\",9,\""<<mName<<::bbUserConstructor()"<<std::endl);"<<std::endl;
1049 mFile << mUserConstructor << std::endl;
1050 mFile << "}" << std::endl;
1052 mFile <<"void "<<mName<<"::bbUserCopyConstructor()"<<std::endl;
1053 mFile << "{"<<std::endl;
1054 //mFile<<"bbtkDebugMessage(\"Kernel\",9,\""<<mName<<::bbUserCopyConstructor()"<<std::endl);"<<std::endl;
1055 mFile << mUserCopyConstructor << std::endl;
1056 mFile << "}" << std::endl;
1058 mFile <<"void "<<mName<<"::bbUserDestructor()"<<std::endl;
1059 mFile << "{"<<std::endl;
1060 //mFile<<"bbtkDebugMessage(\"Kernel\",9,\""<<mName<<::bbUserDestructor()"<<std::endl);"<<std::endl;
1061 mFile << mUserDestructor << std::endl;
1062 mFile << "}" << std::endl;
1074 //==========================================================================
1080 //==========================================================================
1081 int main(int argc, char **argv)
1084 if (argc<2 || argc>5)
1086 std::cerr << "usage : "<< argv[0] <<" xml_file [package_name] [output_path] [-q]" << std::endl;
1092 std::string package("PACKAGE_NAME");
1093 std::string output_path("");
1094 bool verbose = true;
1095 if (argc>2) package = argv[2];
1096 if (argc>3) output_path = argv[3];
1097 if (argc>4) verbose = false;
1099 bbfy B(argv[1],package,output_path,verbose);
1101 catch (bbfyException e)
1103 std::cerr << argv[0] << " " << argv[1] << std::endl
1104 << e.mMessage << std::endl;
1109 //==========================================================================