00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00020 #ifndef _UserPlugin_hpp
00021 #define _UserPlugin_hpp
00022
00023 #include<ImLib3D/PluginManagement.hpp>
00024 #include<ImLib3D/ImageProcessorDescription.hpp>
00025 #include<ImLib3D/Base64.hpp>
00026 #include<ImLib3D/PluginManagement.hpp>
00027 #include<ImLib3D/XMLTools.hpp>
00028 #include<ImLib3D/TemplateGroups.hpp>
00029 #include<ImLib3D/ImageProcessorDescription.hpp>
00030 #include<ImLib3D/StringArgumentConversion.hpp>
00031
00032
00033
00034
00035 void
00036 UserPluginMain(int argc,char **argv)
00037 {
00038 bool CustomImProcCalls(const string &procName,const vector<string> &args,const string typeName,
00039 vector<TypeSafeGenericPointer> alternateArgs);
00040 void StandardImProcCalls(const string &procName,const vector<string> &args,const string typeName,
00041 vector<TypeSafeGenericPointer> alternateArgs);
00042
00043 vector<string> args;
00044 for(int i=1;i<argc;i++){args.push_back(argv[i]);}
00045
00046 if(args.size()==0){ThrowError("bad commandline for plugin");}
00047
00048 string procName;
00049 string templateTypeName;
00050
00051
00052
00053 if(args[0]=="--query-imlib3d"){printf("imlib3d-plugin");exit(0);}
00054
00055 if(args[0]=="--query-full-xml-description")
00056 {
00057 string xml=Base64::Decode(hardcodedDescription);
00058 cout << xml << endl;
00059 exit(0);
00060 }
00061 procName=args[0];
00062
00063 ImageProcessorsDescription description;
00064 description.ReadFromString(Base64::Decode(hardcodedDescription));
00065
00066 ImageProcessorDescription imageProcessorDescription(procName,description);
00067 vector<string> resArgs=imageProcessorDescription.ParseCmdLine(args);
00068
00069 templateTypeName=imageProcessorDescription.ProcTemplateTypeName(resArgs);
00070 fprintf(stderr,"PluginMain for:\"%s\" ... over\n",argv[0]);
00071
00072
00073 vector<TypeSafeGenericPointer> alternateArgs;
00074 #ifdef HAS_CUSTOM_IMPROCCALLS
00075 if(!CustomImProcCalls(procName,resArgs,templateTypeName,alternateArgs))
00076 #endif //HAS_CUSTOM_IMPROCCALLS
00077 StandardImProcCalls(procName,resArgs,templateTypeName,alternateArgs);
00078 }
00079
00080 #endif // _UserPlugin_hpp