DLL_Parser.cpp

Go to the documentation of this file.
00001 // DLL_Parser.cpp,v 1.12 2006/04/26 21:21:54 jeliazkov_i Exp
00002 
00003 #include "tao/DLL_Parser.h"
00004 #include "tao/Object_Loader.h"
00005 #include "tao/Object.h"
00006 #include "tao/Environment.h"
00007 #include "tao/ORB_Constants.h"
00008 #include "tao/SystemException.h"
00009 #include "tao/ORB_Core.h"
00010 
00011 #include "ace/Dynamic_Service.h"
00012 #include "ace/Log_Msg.h"
00013 #include "ace/OS_NS_string.h"
00014 
00015 
00016 ACE_RCSID (tao,
00017            DLL_Parser,
00018            "DLL_Parser.cpp,v 1.12 2006/04/26 21:21:54 jeliazkov_i Exp")
00019 
00020 static const char dll_prefix[] = "DLL:";
00021 
00022 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00023 
00024 TAO_DLL_Parser::~TAO_DLL_Parser (void)
00025 {
00026 }
00027 
00028 
00029 int
00030 TAO_DLL_Parser::match_prefix (const char *ior_string) const
00031 {
00032   return (ACE_OS::strncmp (ior_string,
00033                            ::dll_prefix,
00034                            sizeof (::dll_prefix) - 1) == 0);
00035 }
00036 
00037 CORBA::Object_ptr
00038 TAO_DLL_Parser::parse_string (const char *ior,
00039                               CORBA::ORB_ptr orb
00040                               ACE_ENV_ARG_DECL)
00041   ACE_THROW_SPEC ((CORBA::SystemException))
00042 {
00043   // Skip the prefix, we know it is there because this method in only
00044   // called if <match_prefix> returns 1.
00045   const char *name =
00046     ior + sizeof (::dll_prefix) - 1;
00047 
00048   TAO_ORB_Core *oc = orb->orb_core ();
00049 
00050   TAO_Object_Loader *loader =
00051     ACE_Dynamic_Service<TAO_Object_Loader>::instance
00052       (oc->configuration(), name);
00053 
00054   if (loader == 0)
00055     {
00056       ACE_THROW_RETURN
00057         (CORBA::INV_OBJREF
00058          (CORBA::SystemException::_tao_minor_code (
00059             0,
00060             EINVAL),
00061           CORBA::COMPLETED_NO),
00062          CORBA::Object::_nil ());
00063     }
00064 
00065   return loader->create_object (orb, 0, 0 ACE_ENV_ARG_PARAMETER);
00066 }
00067 
00068 TAO_END_VERSIONED_NAMESPACE_DECL
00069 
00070 ACE_STATIC_SVC_DEFINE (TAO_DLL_Parser,
00071                        ACE_TEXT ("DLL_Parser"),
00072                        ACE_SVC_OBJ_T,
00073                        &ACE_SVC_NAME (TAO_DLL_Parser),
00074                        ACE_Service_Type::DELETE_THIS |
00075                                   ACE_Service_Type::DELETE_OBJ,
00076                        0)
00077 
00078 
00079 ACE_FACTORY_DEFINE (TAO, TAO_DLL_Parser)
00080 

Generated on Thu Nov 9 11:54:10 2006 for TAO by doxygen 1.3.6