Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / DLL_Parser.cpp
blobfaf6e4e4b23c35ba8c670eb3d61a0b00c7de7361
1 #include "tao/DLL_Parser.h"
3 # if (TAO_HAS_DDL_PARSER == 1)
5 #include "tao/Object_Loader.h"
6 #include "tao/Object.h"
7 #include "tao/ORB_Constants.h"
8 #include "tao/SystemException.h"
9 #include "tao/ORB_Core.h"
11 #include "ace/Dynamic_Service.h"
12 #include "ace/Log_Msg.h"
13 #include "ace/OS_NS_string.h"
15 static const char dll_prefix[] = "DLL:";
17 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
19 bool
20 TAO_DLL_Parser::match_prefix (const char *ior_string) const
22 return (ACE_OS::strncmp (ior_string,
23 ::dll_prefix,
24 sizeof (::dll_prefix) - 1) == 0);
27 CORBA::Object_ptr
28 TAO_DLL_Parser::parse_string (const char *ior,
29 CORBA::ORB_ptr orb)
31 // Skip the prefix, we know it is there because this method in only
32 // called if <match_prefix> returns 1.
33 const char *name =
34 ior + sizeof (::dll_prefix) - 1;
36 TAO_ORB_Core *oc = orb->orb_core ();
38 TAO_Object_Loader *loader =
39 ACE_Dynamic_Service<TAO_Object_Loader>::instance
40 (oc->configuration(), name);
42 if (loader == nullptr)
44 throw
45 CORBA::INV_OBJREF
46 (CORBA::SystemException::_tao_minor_code (
48 EINVAL),
49 CORBA::COMPLETED_NO);
52 return loader->create_object (orb, 0, nullptr);
56 ACE_STATIC_SVC_DEFINE (TAO_DLL_Parser,
57 ACE_TEXT ("DLL_Parser"),
58 ACE_SVC_OBJ_T,
59 &ACE_SVC_NAME (TAO_DLL_Parser),
60 ACE_Service_Type::DELETE_THIS |
61 ACE_Service_Type::DELETE_OBJ,
64 ACE_FACTORY_DEFINE (TAO, TAO_DLL_Parser)
66 TAO_END_VERSIONED_NAMESPACE_DECL
68 #endif /* TAO_HAS_DDL_PARSER == 1 */