00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019 #include<ImLib3D/ImageProcessorsDescription.hpp>
00020 #include<ImLib3D/XMLTools.hpp>
00021
00022 int
00023 main(int argc,char **argv)
00024 {
00025 vector<string> args;
00026 for(int i=1;i<argc;i++){args.push_back(argv[i]);}
00027 SetErrorManagementType(ERROR_USE_EXCEPTIONS);
00028 string warning="// *************** DO NOT MODIFY!!! ***********\n// ** AUTOMATICALLY GENERATED SRC CODE **\n\n";
00029 string out=warning;
00030 ImageProcessorsDescription imProcsDescription;
00031 imProcsDescription.Read(args[0]);
00032 vector<string> procNames=imProcsDescription.GetNames(true);
00033
00034
00035
00036 printf(" found %d template groups\n",imProcsDescription.templateGroups.size());
00037 string out1=warning;
00038 for(uint i=0;i<imProcsDescription.templateGroups.size();i++)
00039 {
00040 XIPD::TemplateGroup &group=imProcsDescription.templateGroups[i];
00041 uint maxNbArgs=5;
00042 for(uint nbArgs=0;nbArgs<maxNbArgs;nbArgs++)
00043 {
00044 string macroName= "CallWith"+group.name+SPrintf("_%d",nbArgs);
00045 out1+="#define "+macroName+"(fct,typeName";
00046 for(uint j=0;j<nbArgs;j++){out1+=SPrintf(",a%d",j);}
00047 out1+=")\\\n";
00048 for(uint j=0;j<group.types.size();j++)
00049 {
00050 string type=group.types[j];
00051 out1+=" if(typeName==\""+type+"\"){fct< "+type+" >(";
00052 for(uint k=0;k<nbArgs;k++){out1+=(k>0 ? "," : "")+SPrintf("a%d",k);}
00053 out1+=");}\\\n";
00054 out1+=" else\\\n";
00055 }
00056 out1+=" {ThrowError(\""+macroName+" failed, type \\\"%s\\\" is not in template group \\\""+
00057 group.name+"\\\"\",typeName);}\n";
00058 }
00059 }
00060 WriteStringToFile("TemplateGroups.hpp",out1);
00061
00062 }