Parser_Registry.cpp

Go to the documentation of this file.
00001 // Parser_Registry.cpp,v 1.7 2006/04/26 21:21:54 jeliazkov_i Exp
00002 
00003 #include "tao/Parser_Registry.h"
00004 #include "tao/IOR_Parser.h"
00005 #include "tao/ORB_Core.h"
00006 
00007 #include "ace/Dynamic_Service.h"
00008 
00009 #if !defined(__ACE_INLINE__)
00010 #include "tao/Parser_Registry.i"
00011 #endif /* __ACE_INLINE__ */
00012 
00013 ACE_RCSID (tao,
00014            Parser_Registry,
00015            "Parser_Registry.cpp,v 1.7 2006/04/26 21:21:54 jeliazkov_i Exp")
00016 
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018 
00019 TAO_Parser_Registry::TAO_Parser_Registry (void)
00020   : parsers_ (0),
00021     size_ (0)
00022 {
00023 }
00024 
00025 TAO_Parser_Registry::~TAO_Parser_Registry (void)
00026 {
00027   delete [] this->parsers_;
00028 }
00029 
00030 int
00031 TAO_Parser_Registry::open (TAO_ORB_Core *orb_core)
00032 {
00033   char **names;
00034   int number_of_names = 0;
00035 
00036   orb_core->resource_factory ()->get_parser_names (names,
00037                                                    number_of_names);
00038 
00039   if (number_of_names == 0)
00040     {
00041       return -1;
00042     }
00043 
00044   this->size_ = number_of_names;
00045   ACE_NEW_RETURN (this->parsers_,
00046                   TAO_IOR_Parser*[this->size_],
00047                   -1);
00048 
00049   for (size_t i = 0; i != this->size_; ++i)
00050     {
00051       this->parsers_[i] =
00052         ACE_Dynamic_Service<TAO_IOR_Parser>::instance (orb_core->configuration (),
00053                                                        names [i]);
00054 
00055       if (this->parsers_[i] == 0)
00056         {
00057           return -1;
00058         }
00059     }
00060 
00061   return 0;
00062 }
00063 
00064 TAO_IOR_Parser *
00065 TAO_Parser_Registry::match_parser (const char *ior_string)
00066 {
00067   for (Parser_Iterator i = this->begin (); i != this->end (); ++i)
00068     {
00069       if ((*i)->match_prefix (ior_string))
00070         {
00071           return *i;
00072         }
00073     }
00074 
00075   return 0;
00076 }
00077 
00078 TAO_END_VERSIONED_NAMESPACE_DECL

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