Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

hyp.std.factory.h

00001 /*
00002 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
00003  Hyperion Pattern.
00004  Hyperion Pattern is a part of the Hyperion Project.
00005 ----------------------------------------------------------
00006  Copyright (c) 2001 Pierre Rebours.
00007 
00008  This library is free software; you can redistribute it and/or
00009  modify it under the terms of the GNU Lesser General Public
00010  License as published by the Free Software Foundation; either
00011  version 2.1 of the License, or (at your option) any later version.
00012 
00013  This library is distributed in the hope that it will be useful,
00014  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  
00017  See hyp.license.txt file for more information about the license.
00018  
00019  Web: http://lagrandeporte.multimania.com/hyperion
00020  Email: amtycho@yahoo.fr
00021 ----------------------------------------------------------
00022  CVS
00023  $Log$
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         //typedef
00071         typedef std::vector<CFactoryData> ContFactoryData;
00072         typedef ContFactoryData::iterator ContFactoryDataItor;
00073         typedef ContFactoryData::iterator ContFactoryDataConstItor;
00074         
00075         //compteur de réference
00076         long m_cRef;
00077 
00078         //pointeur vers un élément du conteneur ms_FactoryData
00079         //Ce pointeur permet d'associer une fabrique à un composant
00080         const CFactoryData* m_pData;
00081 
00082         //Conteneur vers toutes les informations necessaires pour la gestion des
00083         //composants se trouvant hebergés sur ce serveur
00084         static ContFactoryData ms_FactoryData;
00085 
00086         //Compteur de verrou
00087         static long ms_cServerLocks;
00088 
00089         //Ce nom est l'identifiant du serveur qui pour toute les plateforme est
00090         //le nom complet du serveur.On s'affranchit des handles divers suivant les OS...
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

Top of Page
written by Pierre Rebours © 2000-2001. Terms of Use.