TAO_Parser_Registry Class Reference

Maintain the collection of known IOR format parsers. More...

#include <Parser_Registry.h>

Collaboration diagram for TAO_Parser_Registry:

Collaboration graph
[legend]
List of all members.

Public Types

typedef TAO_IOR_Parser ** Parser_Iterator

Public Member Functions

 TAO_Parser_Registry (void)
 Default constructor.
 ~TAO_Parser_Registry (void)
 Dstructor.
int open (TAO_ORB_Core *orb_core)
TAO_IOR_Parsermatch_parser (const char *ior_string)
Parser_Iterator begin (void) const
Parser_Iterator end (void) const

Private Member Functions

 TAO_Parser_Registry (const TAO_Parser_Registry &)
void operator= (const TAO_Parser_Registry &)

Private Attributes

TAO_IOR_Parser ** parsers_
 List of parsers.
size_t size_
 Number of parsers.

Detailed Description

Maintain the collection of known IOR format parsers.

The ORB dynamically loads a collection of IOR parsers (check the IOR_Parser class). The collection is kept in this class for easy lookup and use.

Definition at line 46 of file Parser_Registry.h.


Member Typedef Documentation

typedef TAO_IOR_Parser** TAO_Parser_Registry::Parser_Iterator

Definition at line 65 of file Parser_Registry.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Parser_Registry::TAO_Parser_Registry ( void   ) 

Default constructor.

Definition at line 19 of file Parser_Registry.cpp.

00020   : parsers_ (0),
00021     size_ (0)
00022 {
00023 }

TAO_Parser_Registry::~TAO_Parser_Registry ( void   ) 

Dstructor.

Definition at line 25 of file Parser_Registry.cpp.

References parsers_.

00026 {
00027   delete [] this->parsers_;
00028 }

TAO_Parser_Registry::TAO_Parser_Registry ( const TAO_Parser_Registry  )  [private]


Member Function Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE TAO_Parser_Registry::Parser_Iterator TAO_Parser_Registry::begin ( void   )  const

Definition at line 8 of file Parser_Registry.inl.

References parsers_.

00009 {
00010   return this->parsers_;
00011 }

ACE_INLINE TAO_Parser_Registry::Parser_Iterator TAO_Parser_Registry::end ( void   )  const

Definition at line 14 of file Parser_Registry.inl.

References parsers_, and size_.

Referenced by match_parser().

00015 {
00016   return this->parsers_ + this->size_;
00017 }

TAO_IOR_Parser * TAO_Parser_Registry::match_parser ( const char *  ior_string  ) 

Find the parser that can parse ior_string The lookup is based on the prefix in the string

Definition at line 79 of file Parser_Registry.cpp.

References end().

Referenced by CORBA::ORB::string_to_object().

00080 {
00081   for (Parser_Iterator i = this->begin (); i != this->end (); ++i)
00082     {
00083       if ((*i)->match_prefix (ior_string))
00084         {
00085           return *i;
00086         }
00087     }
00088 
00089   return 0;
00090 }

int TAO_Parser_Registry::open ( TAO_ORB_Core orb_core  ) 

Initialize the parser registry with the list of known protocols. Invoked by the ORB during startup.

Definition at line 31 of file Parser_Registry.cpp.

References ACE_DEBUG, ACE_NEW_RETURN, TAO_ORB_Core::configuration(), TAO_Resource_Factory::get_parser_names(), LM_DEBUG, TAO_ORB_Core::resource_factory(), size_, and TAO_debug_level.

Referenced by TAO_ORB_Core::init().

00032 {
00033   char **names = 0;
00034   int number_of_names = 0;
00035 
00036   if (orb_core->resource_factory () == 0)
00037     {
00038       return -1;
00039     }
00040 
00041   orb_core->resource_factory ()->get_parser_names (names, number_of_names);
00042 
00043   if (number_of_names == 0)
00044     {
00045       return -1;
00046     }
00047 
00048   this->size_ = number_of_names;
00049   ACE_NEW_RETURN (this->parsers_,
00050                   TAO_IOR_Parser*[this->size_],
00051                   -1);
00052 
00053   for (size_t i = 0, index = 0; i != this->size_; ++i)
00054     {
00055       this->parsers_[index] =
00056         ACE_Dynamic_Service<TAO_IOR_Parser>::instance (orb_core->configuration (),
00057                                                        names [i]);
00058 
00059       if (this->parsers_[index] == 0)
00060         {
00061           --number_of_names;
00062           if (TAO_debug_level >= 1)
00063             {
00064               ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) Failed to find Service Object"
00065                           " for %s.\n", names[i]));
00066             }
00067         }
00068       else
00069         {
00070           ++index;
00071         }
00072     }
00073 
00074   this->size_ = number_of_names;
00075   return 0;
00076 }

void TAO_Parser_Registry::operator= ( const TAO_Parser_Registry  )  [private]


Member Data Documentation

TAO_IOR_Parser** TAO_Parser_Registry::parsers_ [private]

List of parsers.

Definition at line 78 of file Parser_Registry.h.

Referenced by begin(), end(), and ~TAO_Parser_Registry().

size_t TAO_Parser_Registry::size_ [private]

Number of parsers.

Definition at line 81 of file Parser_Registry.h.

Referenced by end(), and open().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:39:40 2010 for TAO by  doxygen 1.4.7