00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #ifndef _factory_library_impl_hh
00019 #define _factory_library_impl_hh
00020 
00021 #include <map>
00022 #include <string.h>
00023 
00024 #include "AllupS.h"
00025 
00026 #include "HeyParser.hh"
00027 
00028 #include "factory_library.h"
00029 #include "ltdl.h"
00030 
00031 using namespace std;
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 class FactoryLibrary_ltdl : public virtual POA_edu::utah::pces::FactoryLibrary
00040 {
00041 
00042 public:
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054     static edu::utah::pces::FactoryLibrary_ptr OpenLibrary(
00055         PortableServer::POA_ptr poa,
00056         const char *name)
00057         throw (edu::utah::pces::NoSuchLibrary,
00058                CORBA::SystemException);
00059 
00060 
00061 
00062 
00063     static void Shutdown(void);
00064 
00065 
00066 
00067 
00068     virtual ~FactoryLibrary_ltdl(void);
00069 
00070 
00071     virtual char *Name(void)
00072         throw (CORBA::SystemException);
00073 
00074 
00075     virtual CORBA::Long Hey(const edu::utah::pces::ArgV &args,
00076                             CORBA::String_out o,
00077                             CORBA::String_out e)
00078         throw (CORBA::SystemException);
00079 
00080 
00081 
00082 
00083 
00084     virtual PortableServer::POA_ptr _default_POA(void)
00085         throw (CORBA::SystemException)
00086     {
00087         throw CORBA::BAD_INV_ORDER();
00088     };
00089 
00090 protected:
00091     
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101     FactoryLibrary_ltdl(PortableServer::POA_ptr poa,
00102                         const char *name,
00103                         lt_dlhandle dlh,
00104                         factory_method_t fm);
00105     
00106 private:
00107 
00108 
00109 
00110 
00111     static map<string, FactoryLibrary_ltdl *> open_libraries;
00112 
00113 
00114 
00115 
00116     static CORBA::ORB_var orb;
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 
00125     FactoryLibrary_ltdl(const char *name,
00126                         lt_dlhandle library,
00127                         factory_method_t fm);
00128 
00129 
00130 
00131 
00132 
00133     PortableServer::POA_var fl_POA;
00134     
00135 
00136 
00137 
00138     CORBA::String_var fl_Name;
00139 
00140 
00141 
00142 
00143     unsigned int fl_OpenCount;
00144 
00145 
00146 
00147 
00148     lt_dlhandle fl_Library;
00149 
00150 
00151 
00152 
00153     factory_method_t fl_Method;
00154     
00155 };
00156 
00157 #endif