1 #include "ace/Dynamic_Service_Base.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
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.
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
,
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
57 // Get the instance using <name> for specific configuration repository.
59 ACE_Dynamic_Service_Base::instance (const ACE_Service_Gestalt
* repo
,
60 const ACE_TCHAR
*name
,
63 ACE_TRACE ("ACE_Dynamic_Service_Base::instance");
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
);
72 type
= svc_rec
->type ();
74 obj
= type
->object ();
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
,
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
));
102 ACE_END_VERSIONED_NAMESPACE_DECL