OpenDDS::DCPS::QOS_XML_File_Handler Class Reference

#include <XML_File_Intf.h>

List of all members.

Public Member Functions

 QOS_XML_File_Handler (void)
 ~QOS_XML_File_Handler (void)
DDS::ReturnCode_t init (const ACE_TCHAR *file)
void add_search_path (const ACE_TCHAR *environment, const ACE_TCHAR *relpath)



DDS::ReturnCode_t get_datawriter_qos (::DDS::DataWriterQos &dw_qos, const char *profile_name, const char *topic_name)
DDS::ReturnCode_t get_datareader_qos (::DDS::DataReaderQos &dr_qos, const char *profile_name, const char *topic_name)
DDS::ReturnCode_t get_topic_qos (::DDS::TopicQos &tp_qos, const char *profile_name, const char *topic_name)
DDS::ReturnCode_t get_publisher_qos (::DDS::PublisherQos &pub_qos, const char *profile_name)
DDS::ReturnCode_t get_subscriber_qos (::DDS::SubscriberQos &sub_qos, const char *profile_name)
DDS::ReturnCode_t get_participant_qos (::DDS::DomainParticipantQos &sub_qos, const char *profile_name)

Private Types

typedef XML::XML_Typedef XML_Helper_type

Private Member Functions

::dds::qosProfile * get_profile (const char *profile_name)

Private Attributes

::dds::qosProfile_seq profiles_

Detailed Description

Definition at line 32 of file XML_File_Intf.h.


Member Typedef Documentation

typedef XML::XML_Typedef OpenDDS::DCPS::QOS_XML_File_Handler::XML_Helper_type [private]

Definition at line 105 of file XML_File_Intf.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::QOS_XML_File_Handler::QOS_XML_File_Handler ( void   ) 

Definition at line 20 of file XML_File_Intf.cpp.

00021   {
00022   }

OpenDDS::DCPS::QOS_XML_File_Handler::~QOS_XML_File_Handler ( void   ) 

Definition at line 24 of file XML_File_Intf.cpp.

00025   {
00026   }


Member Function Documentation

void OpenDDS::DCPS::QOS_XML_File_Handler::add_search_path ( const ACE_TCHAR environment,
const ACE_TCHAR relpath 
)

add_search_path will add a relative path to the XML parsing library. The XML parsing library will use this path to search for the schema

Definition at line 353 of file XML_File_Intf.cpp.

Referenced by OpenDDS::DCPS::QOS_XML_Loader::init().

00355   {
00356     XML_Helper_type::XML_HELPER.get_resolver ().get_resolver ().add_path (environment, relpath);
00357   }

Here is the caller graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_File_Handler::get_datareader_qos ( ::DDS::DataReaderQos dr_qos,
const char *  profile_name,
const char *  topic_name 
)

These methods will search for the profileQos in profiles_, using the given profile_name. If found, these methods will invoke the corresponding method on the corresponding Handler class. These classes are available in the xxxQos_Handler.h files.

Definition at line 172 of file XML_File_Intf.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), get_profile(), LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

Referenced by OpenDDS::DCPS::QOS_XML_Loader::get_datareader_qos().

00175   {
00176     ACE_UNUSED_ARG (topic_name);
00177 
00178     DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR;
00179     try
00180       {
00181         ::dds::qosProfile * profile = this->get_profile (profile_name);
00182         if (profile != 0)
00183           {
00184             DataReaderQos_Handler::get_datareader_qos (dr_qos, profile);
00185             retcode = ::DDS::RETCODE_OK;
00186           }
00187         else
00188           retcode = DDS::RETCODE_BAD_PARAMETER;
00189       }
00190     catch (const CORBA::Exception &ex)
00191       {
00192         ACE_ERROR ((LM_ERROR,
00193           ACE_TEXT ("QOS_XML_File_Handler::get_datareader_qos - ")
00194           ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"),
00195           ex._info ().c_str ()));
00196         retcode = DDS::RETCODE_ERROR;
00197       }
00198     catch (...)
00199       {
00200         ACE_ERROR ((LM_ERROR,
00201           ACE_TEXT ("QOS_XML_File_Handler::get_datareader_qos - ")
00202           ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n")));
00203         retcode = DDS::RETCODE_ERROR;
00204       }
00205 
00206     return retcode;
00207   }

Here is the call graph for this function:

Here is the caller graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_File_Handler::get_datawriter_qos ( ::DDS::DataWriterQos dw_qos,
const char *  profile_name,
const char *  topic_name 
)

These methods will search for the profileQos in profiles_, using the given profile_name. If found, these methods will invoke the corresponding method on the corresponding Handler class. These classes are available in the xxxQos_Handler.h files.

Definition at line 134 of file XML_File_Intf.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), get_profile(), LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

00137   {
00138     ACE_UNUSED_ARG (topic_name);
00139 
00140     DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR;
00141     try
00142       {
00143         ::dds::qosProfile * profile = this->get_profile (profile_name);
00144         if (profile != 0)
00145           {
00146             DataWriterQos_Handler::get_datawriter_qos (dw_qos, profile);
00147             retcode = ::DDS::RETCODE_OK;
00148           }
00149         else
00150           retcode = DDS::RETCODE_BAD_PARAMETER;
00151       }
00152     catch (const CORBA::Exception &ex)
00153       {
00154         ACE_ERROR ((LM_ERROR,
00155           ACE_TEXT ("QOS_XML_File_Handler::get_datawriter_qos - ")
00156           ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"),
00157           ex._info ().c_str ()));
00158         retcode = DDS::RETCODE_ERROR;
00159       }
00160     catch (...)
00161       {
00162         ACE_ERROR ((LM_ERROR,
00163           ACE_TEXT ("QOS_XML_File_Handler::get_datawriter_qos - ")
00164           ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n")));
00165         retcode = DDS::RETCODE_ERROR;
00166       }
00167 
00168     return retcode;
00169   }

Here is the call graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_File_Handler::get_participant_qos ( ::DDS::DomainParticipantQos sub_qos,
const char *  profile_name 
)

These methods will search for the profileQos in profiles_, using the given profile_name. If found, these methods will invoke the corresponding method on the corresponding Handler class. These classes are available in the xxxQos_Handler.h files.

Definition at line 318 of file XML_File_Intf.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), get_profile(), LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

Referenced by OpenDDS::DCPS::QOS_XML_Loader::get_participant_qos().

00320   {
00321     DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR;
00322     try
00323       {
00324         ::dds::qosProfile * profile = this->get_profile (profile_name);
00325         if (profile != 0)
00326           {
00327             ParticipantQos_Handler::get_participant_qos (sub_qos, profile);
00328             retcode = ::DDS::RETCODE_OK;
00329           }
00330         else
00331           retcode = DDS::RETCODE_BAD_PARAMETER;
00332       }
00333     catch (const CORBA::Exception &ex)
00334       {
00335         ACE_ERROR ((LM_ERROR,
00336           ACE_TEXT ("QOS_XML_File_Handler::get_participant_qos - ")
00337           ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"),
00338           ex._info ().c_str ()));
00339         retcode = DDS::RETCODE_ERROR;
00340       }
00341     catch (...)
00342       {
00343         ACE_ERROR ((LM_ERROR,
00344           ACE_TEXT ("QOS_XML_File_Handler::get_participant_qos - ")
00345           ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n")));
00346         retcode = DDS::RETCODE_ERROR;
00347       }
00348 
00349     return retcode;
00350   }

Here is the call graph for this function:

Here is the caller graph for this function:

dds::qosProfile * OpenDDS::DCPS::QOS_XML_File_Handler::get_profile ( const char *  profile_name  )  [private]

Searches for the profile in the XML file, using the given profile name.

Definition at line 99 of file XML_File_Intf.cpp.

References ACE_TEXT(), OpenDDS::DCPS::DCPS_debug_level, LM_DEBUG, LM_TRACE, profiles_, ACE_OS::strcmp(), and ACE_OS::strlen().

Referenced by get_datareader_qos(), get_datawriter_qos(), get_participant_qos(), get_publisher_qos(), get_subscriber_qos(), and get_topic_qos().

00100   {
00101     for (::dds::qosProfile_seq::qos_profile_const_iterator it = this->profiles_.begin_qos_profile ();
00102         it != this->profiles_.end_qos_profile ();
00103         ++it)
00104       {
00105         if (ACE_OS::strcmp ((*it)->name ().c_str (), profile_name) == 0)
00106           {
00107             if (DCPS_debug_level > 7)
00108               {
00109                 ACE_DEBUG ((LM_TRACE,
00110                   ACE_TEXT ("QOS_XML_File_Handler::get_profile - ")
00111                   ACE_TEXT ("Found profile <%C>\n"),
00112                   (*it)->name ().c_str ()));
00113               }
00114             return it->get();
00115           }
00116       }
00117     if (ACE_OS::strlen (profile_name) == 0)
00118       {
00119         ACE_ERROR ((LM_DEBUG,
00120           ACE_TEXT ("QOS_XML_File_Handler::get_profile - ")
00121           ACE_TEXT ("No profile specified\n")));
00122       }
00123     else
00124       {
00125         ACE_ERROR ((LM_TRACE,
00126           ACE_TEXT ("QOS_XML_File_Handler::get_profile - ")
00127           ACE_TEXT ("Did not find profile <%C>\n"),
00128           profile_name));
00129       }
00130     return 0;
00131   }

Here is the call graph for this function:

Here is the caller graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_File_Handler::get_publisher_qos ( ::DDS::PublisherQos pub_qos,
const char *  profile_name 
)

These methods will search for the profileQos in profiles_, using the given profile_name. If found, these methods will invoke the corresponding method on the corresponding Handler class. These classes are available in the xxxQos_Handler.h files.

Definition at line 248 of file XML_File_Intf.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), get_profile(), LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

Referenced by OpenDDS::DCPS::QOS_XML_Loader::get_publisher_qos().

00250   {
00251     DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR;
00252     try
00253       {
00254         ::dds::qosProfile * profile = this->get_profile (profile_name);
00255         if (profile != 0)
00256           {
00257             PublisherQos_Handler::get_publisher_qos (pub_qos, profile);
00258             retcode = ::DDS::RETCODE_OK;
00259           }
00260         else
00261           retcode = DDS::RETCODE_BAD_PARAMETER;
00262       }
00263     catch (const CORBA::Exception &ex)
00264       {
00265         ACE_ERROR ((LM_ERROR,
00266           ACE_TEXT ("QOS_XML_File_Handler::get_publisher_qos - ")
00267           ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"),
00268           ex._info ().c_str ()));
00269         retcode = DDS::RETCODE_ERROR;
00270       }
00271     catch (...)
00272       {
00273         ACE_ERROR ((LM_ERROR,
00274           ACE_TEXT ("QOS_XML_File_Handler::get_publisher_qos - ")
00275           ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n")));
00276         retcode = DDS::RETCODE_ERROR;
00277       }
00278 
00279     return retcode;
00280   }

Here is the call graph for this function:

Here is the caller graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_File_Handler::get_subscriber_qos ( ::DDS::SubscriberQos sub_qos,
const char *  profile_name 
)

These methods will search for the profileQos in profiles_, using the given profile_name. If found, these methods will invoke the corresponding method on the corresponding Handler class. These classes are available in the xxxQos_Handler.h files.

Definition at line 283 of file XML_File_Intf.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), get_profile(), LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

Referenced by OpenDDS::DCPS::QOS_XML_Loader::get_subscriber_qos().

00285   {
00286     DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR;
00287     try
00288       {
00289         ::dds::qosProfile * profile = this->get_profile (profile_name);
00290         if (profile != 0)
00291           {
00292             SubscriberQos_Handler::get_subscriber_qos (sub_qos, profile);
00293             retcode = ::DDS::RETCODE_OK;
00294           }
00295         else
00296           retcode = DDS::RETCODE_BAD_PARAMETER;
00297       }
00298     catch (const CORBA::Exception &ex)
00299       {
00300         ACE_ERROR ((LM_ERROR,
00301           ACE_TEXT ("QOS_XML_File_Handler::get_subscriber_qos - ")
00302           ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"),
00303           ex._info ().c_str ()));
00304         retcode = DDS::RETCODE_ERROR;
00305       }
00306     catch (...)
00307       {
00308         ACE_ERROR ((LM_ERROR,
00309           ACE_TEXT ("QOS_XML_File_Handler::get_subscriber_qos - ")
00310           ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n")));
00311         retcode = DDS::RETCODE_ERROR;
00312       }
00313 
00314     return retcode;
00315   }

Here is the call graph for this function:

Here is the caller graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_File_Handler::get_topic_qos ( ::DDS::TopicQos tp_qos,
const char *  profile_name,
const char *  topic_name 
)

These methods will search for the profileQos in profiles_, using the given profile_name. If found, these methods will invoke the corresponding method on the corresponding Handler class. These classes are available in the xxxQos_Handler.h files.

Definition at line 210 of file XML_File_Intf.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), get_profile(), LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

Referenced by OpenDDS::DCPS::QOS_XML_Loader::get_topic_qos().

00213   {
00214     ACE_UNUSED_ARG (topic_name);
00215 
00216     DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR;
00217     try
00218       {
00219         ::dds::qosProfile * profile = this->get_profile (profile_name);
00220         if (profile != 0)
00221           {
00222             TopicQos_Handler::get_topic_qos (tp_qos, profile);
00223             retcode = ::DDS::RETCODE_OK;
00224           }
00225         else
00226           retcode = DDS::RETCODE_BAD_PARAMETER;
00227       }
00228     catch (const CORBA::Exception &ex)
00229       {
00230         ACE_ERROR ((LM_ERROR,
00231           ACE_TEXT ("QOS_XML_File_Handler::get_topic_qos - ")
00232           ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"),
00233           ex._info ().c_str ()));
00234         retcode = DDS::RETCODE_ERROR;
00235       }
00236     catch (...)
00237       {
00238         ACE_ERROR ((LM_ERROR,
00239           ACE_TEXT ("QOS_XML_File_Handler::get_topic_qos - ")
00240           ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n")));
00241         retcode = DDS::RETCODE_ERROR;
00242       }
00243 
00244     return retcode;
00245   }

Here is the call graph for this function:

Here is the caller graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_File_Handler::init ( const ACE_TCHAR file  ) 

init

The init method will open the file and will validate it against the schema. It returns RETCODE_ERROR when any error occurs during parsing

Definition at line 29 of file XML_File_Intf.cpp.

References CORBA::Exception::_info(), ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), OpenDDS::DCPS::DCPS_debug_level, dds::reader::dds(), LM_ERROR, LM_TRACE, profiles_, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.

Referenced by OpenDDS::DCPS::QOS_XML_Loader::init().

00030   {
00031     DDS::ReturnCode_t retcode = DDS::RETCODE_OK;
00032     try
00033       {
00034         if (!XML_Helper_type::XML_HELPER.is_initialized ())
00035           {
00036             ACE_ERROR ((LM_ERROR,
00037               ACE_TEXT ("QOS_XML_File_Handler::init - ")
00038               ACE_TEXT ("Unable to initialize XML_Helper.\n")));
00039             return DDS::RETCODE_ERROR;
00040           }
00041 
00042         if (DCPS_debug_level > 9)
00043           {
00044             ACE_DEBUG ((LM_TRACE,
00045               ACE_TEXT ("QOS_XML_File_Handler::init - ")
00046               ACE_TEXT ("Constructing DOM\n")));
00047           }
00048 
00049         XERCES_CPP_NAMESPACE::DOMDocument *dom =
00050           XML_Helper_type::XML_HELPER.create_dom (file);
00051 
00052         if (dom == 0)
00053           {
00054             if (DCPS_debug_level > 1)
00055               {
00056                 ACE_ERROR ((LM_ERROR,
00057                   ACE_TEXT ("QOS_XML_File_Handler::init - ")
00058                   ACE_TEXT ("Failed to open file %s\n"),
00059                   file));
00060               }
00061             return DDS::RETCODE_ERROR;
00062           }
00063 
00064         XERCES_CPP_NAMESPACE::DOMElement *profile_dom = dom->getDocumentElement ();
00065 
00066         if (DCPS_debug_level > 9)
00067           {
00068             ACE_DEBUG ((LM_TRACE,
00069               ACE_TEXT ("QOS_XML_File_Handler::init - ")
00070               ACE_TEXT ("DOMElement pointer: %u\n"), profile_dom));
00071           }
00072 
00073         ID_Map::TSS_ID_Map* TSS_ID_Map (ACE_Singleton<ID_Map::TSS_ID_Map, ACE_Null_Mutex>::instance());
00074         (*TSS_ID_Map)->reset ();
00075 
00076         this->profiles_ = dds::reader::dds (dom);
00077       }
00078     catch (const CORBA::Exception &ex)
00079       {
00080         ACE_ERROR ((LM_ERROR,
00081           ACE_TEXT ("QOS_XML_File_Handler::init - ")
00082           ACE_TEXT ("Caught CORBA exception whilst parsing XML <%C> into IDL: %C\n"),
00083           file,
00084           ex._info ().c_str ()));
00085         retcode = DDS::RETCODE_ERROR;
00086       }
00087     catch (...)
00088       {
00089         ACE_ERROR ((LM_ERROR,
00090           ACE_TEXT ("QOS_XML_File_Handler::init - ")
00091           ACE_TEXT ("Unexpected exception whilst parsing XML <%C> into IDL.\n"),
00092           file));
00093         retcode = DDS::RETCODE_ERROR;
00094       }
00095     return retcode;
00096   }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

::dds::qosProfile_seq OpenDDS::DCPS::QOS_XML_File_Handler::profiles_ [private]

Definition at line 104 of file XML_File_Intf.h.

Referenced by get_profile(), and init().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1