Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Dynamic_Service_Base.cpp
blobe0912b1df58bb1785863358ae76ed40860c4879c
1 #include "ace/Dynamic_Service_Base.h"
2 #include "ace/ACE.h"
3 #include "ace/Service_Config.h"
4 #include "ace/Service_Repository.h"
5 #include "ace/Service_Types.h"
6 #include "ace/Log_Category.h"
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
12 void
13 ACE_Dynamic_Service_Base::dump () const
15 #if defined (ACE_HAS_DUMP)
16 ACE_TRACE ("ACE_Dynamic_Service_Base::dump");
18 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
19 ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
20 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
21 #endif /* ACE_HAS_DUMP */
24 // Get the instance using <name> for the current global
25 // service configuration repository.
27 void *
28 ACE_Dynamic_Service_Base::instance (const ACE_TCHAR *name, bool no_global)
30 ACE_TRACE ("ACE_Dynamic_Service_Base::instance");
31 return instance (ACE_Service_Config::current (), name, no_global);
34 // Find a service registration
36 const ACE_Service_Type *
37 ACE_Dynamic_Service_Base::find_i (const ACE_Service_Gestalt* &repo,
38 const ACE_TCHAR *name,
39 bool no_global)
41 ACE_TRACE ("ACE_Dynamic_Service_Base::find_i");
42 const ACE_Service_Type *svc_rec = 0;
44 ACE_Service_Gestalt* global = ACE_Service_Config::global ();
46 for ( ; (repo->find (name, &svc_rec) == -1) && !no_global; repo = global)
48 // Check the static repo, too if different
49 if (repo == global)
50 break;
53 return svc_rec;
57 // Get the instance using <name> for specific configuration repository.
58 void *
59 ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt* repo,
60 const ACE_TCHAR *name,
61 bool no_global)
63 ACE_TRACE ("ACE_Dynamic_Service_Base::instance");
65 void *obj = 0;
66 const ACE_Service_Type_Impl *type = 0;
68 const ACE_Service_Gestalt* repo_found = repo;
69 const ACE_Service_Type *svc_rec = find_i (repo_found, name, no_global);
70 if (svc_rec != 0)
72 type = svc_rec->type ();
73 if (type != 0)
74 obj = type->object ();
77 if (ACE::debug ())
79 ACE_GUARD_RETURN (ACE_Log_Msg, log_guard, *ACE_Log_Msg::instance (), 0);
81 if (repo->repo_ != repo_found->repo_)
83 ACELIB_DEBUG ((LM_DEBUG,
84 ACE_TEXT ("ACE (%P|%t) DSB::instance, repo=%@, name=%s")
85 ACE_TEXT (" type=%@ => %@")
86 ACE_TEXT (" [in repo=%@]\n"),
87 repo->repo_, name, type, obj,
88 repo_found->repo_));
90 else
92 ACELIB_DEBUG ((LM_DEBUG,
93 ACE_TEXT ("ACE (%P|%t) DSB::instance, repo=%@, name=%s")
94 ACE_TEXT (" type=%@ => %@\n"),
95 repo->repo_, name, type, obj));
99 return obj;
102 ACE_END_VERSIONED_NAMESPACE_DECL