ACE_Dynamic_Service_Base Class Reference

Base class for all ACE_Dynamic_Service instantiations. More...

#include <Dynamic_Service_Base.h>

Inheritance diagram for ACE_Dynamic_Service_Base:

Inheritance graph
[legend]
List of all members.

Public Member Functions

void dump (void) const
 Dump the current static of the object.


Protected Member Functions

 ACE_Dynamic_Service_Base (void)
 No need to create, or assign instances of this class.

 ~ACE_Dynamic_Service_Base (void)
const ACE_Dynamic_Service_Baseoperator= (const ACE_Dynamic_Service_Base &)

Static Protected Member Functions

void * instance (const ACE_TCHAR *name)
 Return instance using name to search the (default) Service_Repository.

void * instance (const ACE_TCHAR *name, bool no_global)
void * instance (const ACE_Service_Gestalt *repo, const ACE_TCHAR *name)
 Return instance using name to search the specific repo instance.

void * instance (const ACE_Service_Gestalt *repo, const ACE_TCHAR *name, bool no_global)

Static Private Member Functions

const ACE_Service_Typefind_i (const ACE_Service_Gestalt *&repo, const ACE_TCHAR *name, bool no_global)

Friends

class ACE_Dynamic_Service_Dependency

Detailed Description

Base class for all ACE_Dynamic_Service instantiations.

Factors out common code shared by all ACE_Dynamic_Service instantiations, this avoid code bloat.

Definition at line 38 of file Dynamic_Service_Base.h.


Constructor & Destructor Documentation

ACE_Dynamic_Service_Base::ACE_Dynamic_Service_Base void   )  [protected]
 

No need to create, or assign instances of this class.

ACE_Dynamic_Service_Base::~ACE_Dynamic_Service_Base void   )  [protected]
 


Member Function Documentation

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_Dynamic_Service_Base::dump void   )  const
 

Dump the current static of the object.

Definition at line 17 of file Dynamic_Service_Base.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, and LM_DEBUG.

00018 {
00019 #if defined (ACE_HAS_DUMP)
00020   ACE_TRACE ("ACE_Dynamic_Service_Base::dump");
00021 
00022   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00023   ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
00024   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00025 #endif /* ACE_HAS_DUMP */
00026 }

const ACE_Service_Type * ACE_Dynamic_Service_Base::find_i const ACE_Service_Gestalt *&  repo,
const ACE_TCHAR name,
bool  no_global
[static, private]
 

Implement the service search policy, i.e. "look for the service first locally and then globally"

Definition at line 50 of file Dynamic_Service_Base.cpp.

References ACE_TCHAR, ACE_TRACE, ACE_Service_Gestalt::find(), and ACE_Service_Config::global().

Referenced by ACE_Dynamic_Service_Dependency::init(), and instance().

00053 {
00054   ACE_TRACE ("ACE_Dynamic_Service_Base::find_i");
00055   const ACE_Service_Type *svc_rec = 0;
00056 
00057   ACE_Service_Gestalt* global = ACE_Service_Config::global ();
00058 
00059   for ( ; (repo->find (name, &svc_rec) == -1) && !no_global; repo = global)
00060     {
00061       // Check the static repo, too if different
00062       if (repo == global)
00063         break;
00064     }
00065 
00066   return svc_rec;
00067 }

void * ACE_Dynamic_Service_Base::instance const ACE_Service_Gestalt repo,
const ACE_TCHAR name,
bool  no_global
[static, protected]
 

Reimplemented in ACE_Dynamic_Service< TYPE >.

Definition at line 72 of file Dynamic_Service_Base.cpp.

References ACE_DEBUG, ACE_TCHAR, ACE_TEXT, ACE_TRACE, ACE::debug(), find_i(), LM_DEBUG, ACE_Service_Type_Impl::object(), ACE_Service_Gestalt::repo_, and ACE_Service_Type::type().

00075 {
00076   ACE_TRACE ("ACE_Dynamic_Service_Base::instance");
00077 
00078   void *obj = 0;
00079   const ACE_Service_Type_Impl *type = 0;
00080 
00081   const ACE_Service_Gestalt* repo_found = repo;
00082   const ACE_Service_Type *svc_rec = find_i (repo_found, name, no_global);
00083   if (svc_rec != 0)
00084     {
00085       type = svc_rec->type ();
00086       if (type != 0)
00087         obj = type->object ();
00088     }
00089 
00090   if (ACE::debug ())
00091     {
00092       ACE_Guard <ACE_Log_Msg> log_guard (*ACE_Log_Msg::instance ());
00093 
00094       ACE_DEBUG ((LM_DEBUG,
00095                   ACE_TEXT ("ACE (%P|%t) DSB::instance, repo=%@, name=%s")
00096                   ACE_TEXT (" type=%@ => %@"),
00097                   repo->repo_, name, type, obj));
00098 
00099       if (repo->repo_ != repo_found->repo_)
00100         ACE_DEBUG ((LM_DEBUG,
00101                     ACE_TEXT (" [in repo=%@]\n"),
00102                     repo_found->repo_));
00103       else
00104         ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
00105     }
00106 
00107   return obj;
00108 }

void * ACE_Dynamic_Service_Base::instance const ACE_Service_Gestalt repo,
const ACE_TCHAR name
[static, protected]
 

Return instance using name to search the specific repo instance.

Reimplemented in ACE_Dynamic_Service< TYPE >.

Definition at line 114 of file Dynamic_Service_Base.cpp.

References ACE_TCHAR, and instance().

00116 {
00117   return instance (repo, name, false);
00118 }

void * ACE_Dynamic_Service_Base::instance const ACE_TCHAR name,
bool  no_global
[static, protected]
 

Perform the default repo search, but optionally skip searching the global repo.

Reimplemented in ACE_Dynamic_Service< TYPE >.

Definition at line 32 of file Dynamic_Service_Base.cpp.

References ACE_TCHAR, ACE_TRACE, and instance().

00033 {
00034   ACE_TRACE ("ACE_Dynamic_Service_Base::instance");
00035   return instance (ACE_Service_Config::current (), name, no_global);
00036 }

void * ACE_Dynamic_Service_Base::instance const ACE_TCHAR name  )  [static, protected]
 

Return instance using name to search the (default) Service_Repository.

Reimplemented in ACE_Dynamic_Service< TYPE >.

Definition at line 40 of file Dynamic_Service_Base.cpp.

References ACE_TCHAR, and ACE_TRACE.

Referenced by instance(), and ACE_Dynamic_Service< TYPE >::instance().

00041 {
00042   ACE_TRACE ("ACE_Dynamic_Service_Base::instance");
00043   return instance (ACE_Service_Config::current (), name, false);
00044 }

const ACE_Dynamic_Service_Base& ACE_Dynamic_Service_Base::operator= const ACE_Dynamic_Service_Base  )  [protected]
 


Friends And Related Function Documentation

friend class ACE_Dynamic_Service_Dependency [friend]
 

The dependency declaration class needs access to the service search policy, implemented by find_i()

Definition at line 75 of file Dynamic_Service_Base.h.


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 12:54:35 2008 for ACE by doxygen 1.3.6