#include <XML_File_Intf.h>
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_ |
Definition at line 30 of file XML_File_Intf.h.
typedef XML::XML_Typedef OpenDDS::DCPS::QOS_XML_File_Handler::XML_Helper_type [private] |
Definition at line 103 of file XML_File_Intf.h.
OpenDDS::DCPS::QOS_XML_File_Handler::QOS_XML_File_Handler | ( | void | ) |
OpenDDS::DCPS::QOS_XML_File_Handler::~QOS_XML_File_Handler | ( | void | ) |
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 351 of file XML_File_Intf.cpp.
00353 { 00354 XML_Helper_type::XML_HELPER.get_resolver ().get_resolver ().add_path (environment, relpath); 00355 }
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 170 of file XML_File_Intf.cpp.
References DataReaderQos_Handler::get_datareader_qos(), get_profile(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
Referenced by OpenDDS::DCPS::QOS_XML_Loader::get_datareader_qos().
00173 { 00174 ACE_UNUSED_ARG (topic_name); 00175 00176 DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR; 00177 try 00178 { 00179 ::dds::qosProfile * profile = this->get_profile (profile_name); 00180 if (profile != 0) 00181 { 00182 DataReaderQos_Handler::get_datareader_qos (dr_qos, profile); 00183 retcode = ::DDS::RETCODE_OK; 00184 } 00185 else 00186 retcode = DDS::RETCODE_BAD_PARAMETER; 00187 } 00188 catch (const CORBA::Exception &ex) 00189 { 00190 ACE_ERROR ((LM_ERROR, 00191 ACE_TEXT ("QOS_XML_File_Handler::get_datareader_qos - ") 00192 ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"), 00193 ex._info ().c_str ())); 00194 retcode = DDS::RETCODE_ERROR; 00195 } 00196 catch (...) 00197 { 00198 ACE_ERROR ((LM_ERROR, 00199 ACE_TEXT ("QOS_XML_File_Handler::get_datareader_qos - ") 00200 ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n"))); 00201 retcode = DDS::RETCODE_ERROR; 00202 } 00203 00204 return retcode; 00205 }
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 132 of file XML_File_Intf.cpp.
References DataWriterQos_Handler::get_datawriter_qos(), get_profile(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
00135 { 00136 ACE_UNUSED_ARG (topic_name); 00137 00138 DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR; 00139 try 00140 { 00141 ::dds::qosProfile * profile = this->get_profile (profile_name); 00142 if (profile != 0) 00143 { 00144 DataWriterQos_Handler::get_datawriter_qos (dw_qos, profile); 00145 retcode = ::DDS::RETCODE_OK; 00146 } 00147 else 00148 retcode = DDS::RETCODE_BAD_PARAMETER; 00149 } 00150 catch (const CORBA::Exception &ex) 00151 { 00152 ACE_ERROR ((LM_ERROR, 00153 ACE_TEXT ("QOS_XML_File_Handler::get_datawriter_qos - ") 00154 ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"), 00155 ex._info ().c_str ())); 00156 retcode = DDS::RETCODE_ERROR; 00157 } 00158 catch (...) 00159 { 00160 ACE_ERROR ((LM_ERROR, 00161 ACE_TEXT ("QOS_XML_File_Handler::get_datawriter_qos - ") 00162 ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n"))); 00163 retcode = DDS::RETCODE_ERROR; 00164 } 00165 00166 return retcode; 00167 }
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 316 of file XML_File_Intf.cpp.
References ParticipantQos_Handler::get_participant_qos(), get_profile(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
Referenced by OpenDDS::DCPS::QOS_XML_Loader::get_participant_qos().
00318 { 00319 DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR; 00320 try 00321 { 00322 ::dds::qosProfile * profile = this->get_profile (profile_name); 00323 if (profile != 0) 00324 { 00325 ParticipantQos_Handler::get_participant_qos (sub_qos, profile); 00326 retcode = ::DDS::RETCODE_OK; 00327 } 00328 else 00329 retcode = DDS::RETCODE_BAD_PARAMETER; 00330 } 00331 catch (const CORBA::Exception &ex) 00332 { 00333 ACE_ERROR ((LM_ERROR, 00334 ACE_TEXT ("QOS_XML_File_Handler::get_participant_qos - ") 00335 ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"), 00336 ex._info ().c_str ())); 00337 retcode = DDS::RETCODE_ERROR; 00338 } 00339 catch (...) 00340 { 00341 ACE_ERROR ((LM_ERROR, 00342 ACE_TEXT ("QOS_XML_File_Handler::get_participant_qos - ") 00343 ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n"))); 00344 retcode = DDS::RETCODE_ERROR; 00345 } 00346 00347 return retcode; 00348 }
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 97 of file XML_File_Intf.cpp.
References OpenDDS::DCPS::DCPS_debug_level, and profiles_.
Referenced by get_datareader_qos(), get_datawriter_qos(), get_participant_qos(), get_publisher_qos(), get_subscriber_qos(), and get_topic_qos().
00098 { 00099 for (::dds::qosProfile_seq::qos_profile_const_iterator it = this->profiles_.begin_qos_profile (); 00100 it != this->profiles_.end_qos_profile (); 00101 ++it) 00102 { 00103 if (ACE_OS::strcmp ((*it)->name ().c_str (), profile_name) == 0) 00104 { 00105 if (DCPS_debug_level > 7) 00106 { 00107 ACE_DEBUG ((LM_TRACE, 00108 ACE_TEXT ("QOS_XML_File_Handler::get_profile - ") 00109 ACE_TEXT ("Found profile <%C>\n"), 00110 (*it)->name ().c_str ())); 00111 } 00112 return it->get(); 00113 } 00114 } 00115 if (ACE_OS::strlen (profile_name) == 0) 00116 { 00117 ACE_ERROR ((LM_DEBUG, 00118 ACE_TEXT ("QOS_XML_File_Handler::get_profile - ") 00119 ACE_TEXT ("No profile specified\n"))); 00120 } 00121 else 00122 { 00123 ACE_ERROR ((LM_TRACE, 00124 ACE_TEXT ("QOS_XML_File_Handler::get_profile - ") 00125 ACE_TEXT ("Did not find profile <%C>\n"), 00126 profile_name)); 00127 } 00128 return 0; 00129 }
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 246 of file XML_File_Intf.cpp.
References get_profile(), PublisherQos_Handler::get_publisher_qos(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
Referenced by OpenDDS::DCPS::QOS_XML_Loader::get_publisher_qos().
00248 { 00249 DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR; 00250 try 00251 { 00252 ::dds::qosProfile * profile = this->get_profile (profile_name); 00253 if (profile != 0) 00254 { 00255 PublisherQos_Handler::get_publisher_qos (pub_qos, profile); 00256 retcode = ::DDS::RETCODE_OK; 00257 } 00258 else 00259 retcode = DDS::RETCODE_BAD_PARAMETER; 00260 } 00261 catch (const CORBA::Exception &ex) 00262 { 00263 ACE_ERROR ((LM_ERROR, 00264 ACE_TEXT ("QOS_XML_File_Handler::get_publisher_qos - ") 00265 ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"), 00266 ex._info ().c_str ())); 00267 retcode = DDS::RETCODE_ERROR; 00268 } 00269 catch (...) 00270 { 00271 ACE_ERROR ((LM_ERROR, 00272 ACE_TEXT ("QOS_XML_File_Handler::get_publisher_qos - ") 00273 ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n"))); 00274 retcode = DDS::RETCODE_ERROR; 00275 } 00276 00277 return retcode; 00278 }
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 281 of file XML_File_Intf.cpp.
References get_profile(), SubscriberQos_Handler::get_subscriber_qos(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
Referenced by OpenDDS::DCPS::QOS_XML_Loader::get_subscriber_qos().
00283 { 00284 DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR; 00285 try 00286 { 00287 ::dds::qosProfile * profile = this->get_profile (profile_name); 00288 if (profile != 0) 00289 { 00290 SubscriberQos_Handler::get_subscriber_qos (sub_qos, profile); 00291 retcode = ::DDS::RETCODE_OK; 00292 } 00293 else 00294 retcode = DDS::RETCODE_BAD_PARAMETER; 00295 } 00296 catch (const CORBA::Exception &ex) 00297 { 00298 ACE_ERROR ((LM_ERROR, 00299 ACE_TEXT ("QOS_XML_File_Handler::get_subscriber_qos - ") 00300 ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"), 00301 ex._info ().c_str ())); 00302 retcode = DDS::RETCODE_ERROR; 00303 } 00304 catch (...) 00305 { 00306 ACE_ERROR ((LM_ERROR, 00307 ACE_TEXT ("QOS_XML_File_Handler::get_subscriber_qos - ") 00308 ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n"))); 00309 retcode = DDS::RETCODE_ERROR; 00310 } 00311 00312 return retcode; 00313 }
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 208 of file XML_File_Intf.cpp.
References get_profile(), TopicQos_Handler::get_topic_qos(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
00211 { 00212 ACE_UNUSED_ARG (topic_name); 00213 00214 DDS::ReturnCode_t retcode = DDS::RETCODE_ERROR; 00215 try 00216 { 00217 ::dds::qosProfile * profile = this->get_profile (profile_name); 00218 if (profile != 0) 00219 { 00220 TopicQos_Handler::get_topic_qos (tp_qos, profile); 00221 retcode = ::DDS::RETCODE_OK; 00222 } 00223 else 00224 retcode = DDS::RETCODE_BAD_PARAMETER; 00225 } 00226 catch (const CORBA::Exception &ex) 00227 { 00228 ACE_ERROR ((LM_ERROR, 00229 ACE_TEXT ("QOS_XML_File_Handler::get_topic_qos - ") 00230 ACE_TEXT ("Caught CORBA exception whilst parsing XML into IDL: %C\n"), 00231 ex._info ().c_str ())); 00232 retcode = DDS::RETCODE_ERROR; 00233 } 00234 catch (...) 00235 { 00236 ACE_ERROR ((LM_ERROR, 00237 ACE_TEXT ("QOS_XML_File_Handler::get_topic_qos - ") 00238 ACE_TEXT ("Unexpected exception whilst parsing XML into IDL.\n"))); 00239 retcode = DDS::RETCODE_ERROR; 00240 } 00241 00242 return retcode; 00243 }
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 27 of file XML_File_Intf.cpp.
References OpenDDS::DCPS::DCPS_debug_level, dds::reader::dds(), profiles_, DDS::RETCODE_ERROR, and DDS::RETCODE_OK.
00028 { 00029 DDS::ReturnCode_t retcode = DDS::RETCODE_OK; 00030 try 00031 { 00032 if (!XML_Helper_type::XML_HELPER.is_initialized ()) 00033 { 00034 ACE_ERROR ((LM_ERROR, 00035 ACE_TEXT ("QOS_XML_File_Handler::init - ") 00036 ACE_TEXT ("Unable to initialize XML_Helper.\n"))); 00037 return DDS::RETCODE_ERROR; 00038 } 00039 00040 if (DCPS_debug_level > 9) 00041 { 00042 ACE_DEBUG ((LM_TRACE, 00043 ACE_TEXT ("QOS_XML_File_Handler::init - ") 00044 ACE_TEXT ("Constructing DOM\n"))); 00045 } 00046 00047 XERCES_CPP_NAMESPACE::DOMDocument *dom = 00048 XML_Helper_type::XML_HELPER.create_dom (file); 00049 00050 if (dom == 0) 00051 { 00052 if (DCPS_debug_level > 1) 00053 { 00054 ACE_ERROR ((LM_ERROR, 00055 ACE_TEXT ("QOS_XML_File_Handler::init - ") 00056 ACE_TEXT ("Failed to open file %s\n"), 00057 file)); 00058 } 00059 return DDS::RETCODE_ERROR; 00060 } 00061 00062 XERCES_CPP_NAMESPACE::DOMElement *profile_dom = dom->getDocumentElement (); 00063 00064 if (DCPS_debug_level > 9) 00065 { 00066 ACE_DEBUG ((LM_TRACE, 00067 ACE_TEXT ("QOS_XML_File_Handler::init - ") 00068 ACE_TEXT ("DOMElement pointer: %u\n"), profile_dom)); 00069 } 00070 00071 ID_Map::TSS_ID_Map* TSS_ID_Map (ACE_Singleton<ID_Map::TSS_ID_Map, ACE_Null_Mutex>::instance()); 00072 (*TSS_ID_Map)->reset (); 00073 00074 this->profiles_ = dds::reader::dds (dom); 00075 } 00076 catch (const CORBA::Exception &ex) 00077 { 00078 ACE_ERROR ((LM_ERROR, 00079 ACE_TEXT ("QOS_XML_File_Handler::init - ") 00080 ACE_TEXT ("Caught CORBA exception whilst parsing XML <%C> into IDL: %C\n"), 00081 file, 00082 ex._info ().c_str ())); 00083 retcode = DDS::RETCODE_ERROR; 00084 } 00085 catch (...) 00086 { 00087 ACE_ERROR ((LM_ERROR, 00088 ACE_TEXT ("QOS_XML_File_Handler::init - ") 00089 ACE_TEXT ("Unexpected exception whilst parsing XML <%C> into IDL.\n"), 00090 file)); 00091 retcode = DDS::RETCODE_ERROR; 00092 } 00093 return retcode; 00094 }
::dds::qosProfile_seq OpenDDS::DCPS::QOS_XML_File_Handler::profiles_ [private] |