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

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

Static Private Member Functions

static 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 41 of file Dynamic_Service_Base.cpp.

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

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

00044 {
00045   ACE_TRACE ("ACE_Dynamic_Service_Base::find_i");
00046   const ACE_Service_Type *svc_rec = 0;
00047 
00048   ACE_Service_Gestalt* global = ACE_Service_Config::global ();
00049 
00050   for ( ; (repo->find (name, &svc_rec) == -1) && !no_global; repo = global)
00051     {
00052       // Check the static repo, too if different
00053       if (repo == global)
00054         break;
00055     }
00056 
00057   return svc_rec;
00058 }

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

Reimplemented in ACE_Dynamic_Service< TYPE >.

Definition at line 63 of file Dynamic_Service_Base.cpp.

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

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

void * ACE_Dynamic_Service_Base::instance ( const ACE_TCHAR name,
bool  no_global = false 
) [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_TRACE, and ACE_Service_Config::current().

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

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

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 68 of file Dynamic_Service_Base.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:05 2010 for ACE by  doxygen 1.4.7