00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef _hypstd_factory_h_
00029 #define _hypstd_factory_h_
00030
00031
00032 #ifndef hyp_KERNEL_STD_INSIDE
00033 #error Inclusion not allowed (include hyp.kernel.std.h instead)
00034 #endif
00035
00036
00037 class CFactory :
00038 public IClassFactory
00039 {
00040 public:
00041 CFactory(const CFactoryData* );
00042 ~CFactory();
00043
00045
00046 virtual com_result QueryInterface(const hypIID&, void**);
00047 virtual t_ulong AddRef();
00048 virtual t_ulong Release();
00050
00052
00053 virtual com_result CreateInstance(IUnknown*, const hypIID& iid, void**);
00054 virtual com_result LockServer(bool);
00055
00056
00057
00058 static com_result GetClassObject(const hypCLSID&,const hypIID&, void**);
00059 static bool IsLocked();
00060 static com_result RegisterAll();
00061 static com_result UnregisterAll();
00062 static com_result CanUnloadNow();
00063
00064 static void InitStaticMembers(const CFactoryData*,
00065 int,
00066 const std::string&);
00067
00068
00069 private:
00070
00071 typedef std::vector<CFactoryData> ContFactoryData;
00072 typedef ContFactoryData::iterator ContFactoryDataItor;
00073 typedef ContFactoryData::iterator ContFactoryDataConstItor;
00074
00075
00076 long m_cRef;
00077
00078
00079
00080 const CFactoryData* m_pData;
00081
00082
00083
00084 static ContFactoryData ms_FactoryData;
00085
00086
00087 static long ms_cServerLocks;
00088
00089
00090
00091 static std::string ms_NameModule;
00092 };
00093
00094
00100 #define hyp_DECLARE_EXPORTED_FUNCTIONS \
00101 hyp_EXPORT_DLL hyp_ker::com_result hyp_CALL_CONV hypDllCanUnloadNow(void) { \
00102 return hyp_ker::CFactory::CanUnloadNow(); \
00103 } \
00104 hyp_EXPORT_DLL hyp_ker::com_result hyp_CALL_CONV hypDllGetClassObject(const hyp_ker::hypCLSID& clsid,const hyp_ker::hypIID& iid,void** ppv) { \
00105 hypstd_TRACE( ("Appel de DllGetClassObject") ); \
00106 return hyp_ker::CFactory::GetClassObject(clsid, iid, ppv); \
00107 } \
00108 hyp_EXPORT_DLL hyp_ker::com_result hyp_CALL_CONV hypDllRegisterServer(void) { \
00109 return hyp_ker::CFactory::RegisterAll(); \
00110 } \
00111 hyp_EXPORT_DLL hyp_ker::com_result hyp_CALL_CONV hypDllUnregisterServer(void) { \
00112 return hyp_ker::CFactory::UnregisterAll(); \
00113 }
00114
00115
00116 #endif