00001 /* -*- C++ -*- */ 00002 00003 //============================================================================= 00004 /** 00005 * @file Dynamic_Service_Base.h 00006 * 00007 * $Id: Dynamic_Service_Base.h 89454 2010-03-11 09:35:25Z johnnyw $ 00008 * 00009 * @author Prashant Jain <pjain@cs.wustl.edu> 00010 * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> 00011 */ 00012 //============================================================================= 00013 00014 #ifndef ACE_DYNAMIC_SERVICE_BASE_H 00015 #define ACE_DYNAMIC_SERVICE_BASE_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include /**/ "ace/ACE_export.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00026 00027 class ACE_Service_Gestalt; 00028 class ACE_Service_Type; 00029 00030 /** 00031 * @class ACE_Dynamic_Service_Base 00032 * 00033 * @brief Base class for all ACE_Dynamic_Service instantiations. 00034 * 00035 * Factors out common code shared by all ACE_Dynamic_Service 00036 * instantiations, this avoid code bloat. 00037 */ 00038 class ACE_Export ACE_Dynamic_Service_Base 00039 { 00040 public: 00041 /// Dump the current static of the object 00042 void dump (void) const; 00043 00044 protected: 00045 /// Perform the default repo search, but optionally skip searching the global 00046 /// repo. 00047 static void* instance (const ACE_TCHAR *name, bool no_global = false); 00048 00049 static void* instance (const ACE_Service_Gestalt* repo, 00050 const ACE_TCHAR *name, 00051 bool no_global = false); 00052 00053 /// No need to create, or assign instances of this class 00054 ACE_Dynamic_Service_Base (void); 00055 ~ACE_Dynamic_Service_Base (void); 00056 const ACE_Dynamic_Service_Base& operator= (const ACE_Dynamic_Service_Base&); 00057 00058 private: 00059 /// Implement the service search policy, i.e. "look for the service first 00060 /// locally and then globally" 00061 static const ACE_Service_Type *find_i (const ACE_Service_Gestalt* &repo, 00062 const ACE_TCHAR *name, 00063 bool no_global); 00064 00065 /// The dependency declaration class needs access to the service search 00066 /// policy, implemented by find_i() 00067 friend class ACE_Dynamic_Service_Dependency; 00068 }; 00069 00070 ACE_END_VERSIONED_NAMESPACE_DECL 00071 00072 #include /**/ "ace/post.h" 00073 #endif /* ACE_DYNAMIC_SERVICE_BASE_H */