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

ExternalApp.h

00001 // Copyright (C) 2000 Jean-Marc Valin
00002 #ifndef _EXTERNALAPP_H_
00003 #define _EXTERNALAPP_H_
00004 
00005 #include <map>
00006 #include <string>
00007 
00008 namespace FD {
00009 
00010 class ExternalApp;
00011 
00012 class AppFactory {
00013   public:
00014    virtual ExternalApp *create()=0;
00015 };
00016 
00017 template <class T>
00018 class _AppFactory : public AppFactory{
00019   public:
00020    ExternalApp *create() {return new T();}
00021 };
00022 
00023 class ExternalApp {
00024    static std::map<std::string, AppFactory *> &factories();
00025   protected:
00026   public:
00027    static int addAppFactory(std::string name, AppFactory *f) {factories()[name] = f;}
00028    static ExternalApp *startApp(std::string name) {return factories()[name]->create();}
00029 };
00030 
00031 }//namespace FD
00032 #endif

Generated on Wed Oct 5 14:28:55 2005 for FlowDesigner by  doxygen 1.4.4