Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

UserPlugin.hpp

Go to the documentation of this file.
00001 /* ImLib3D
00002  * Copyright (c) 2001, ULP-IPB Strasbourg.
00003  *
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or (at
00007  * your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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 //  #include<ImageProcessorsByNameDefinitions.cpp>
00033 //  #include<ImageProcessorsByNameCalls.cpp>
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     // *** answer to queries
00052     // sanity check
00053     if(args[0]=="--query-imlib3d"){printf("imlib3d-plugin");exit(0);}
00054     // get xml description 
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     // read description file
00063     ImageProcessorsDescription description;
00064     description.ReadFromString(Base64::Decode(hardcodedDescription));
00065     // parse commandline
00066     ImageProcessorDescription imageProcessorDescription(procName,description);
00067     vector<string> resArgs=imageProcessorDescription.ParseCmdLine(args);
00068     // find template typename
00069     templateTypeName=imageProcessorDescription.ProcTemplateTypeName(resArgs);
00070     fprintf(stderr,"PluginMain for:\"%s\" ... over\n",argv[0]);
00071 
00072     // now call 
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

Generated on Fri Jun 17 13:36:09 2005 for ImLib3D by  doxygen 1.4.2