OpenDDS::DCPS::QOS_XML_Loader Class Reference

#include <QOS_XML_Loader.h>

Collaboration diagram for OpenDDS::DCPS::QOS_XML_Loader:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 QOS_XML_Loader (void)
 ~QOS_XML_Loader (void)
DDS::ReturnCode_t init (const ACE_TCHAR *qos_profile)



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

Private Member Functions

char * get_xml_file_name (const char *qos_profile)
char * get_profile_name (const char *qos_profile)

Private Attributes

QOS_XML_File_Handler xml_file_

Detailed Description

Definition at line 20 of file QOS_XML_Loader.h.


Constructor & Destructor Documentation

OpenDDS::DCPS::QOS_XML_Loader::QOS_XML_Loader ( void   ) 

Definition at line 11 of file QOS_XML_Loader.cpp.

00012   {
00013   }

OpenDDS::DCPS::QOS_XML_Loader::~QOS_XML_Loader ( void   ) 

Definition at line 15 of file QOS_XML_Loader.cpp.

00016   {
00017   }


Member Function Documentation

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_datareader_qos ( DDS::DataReaderQos dr_qos,
const char *  qos_profile,
const char *  topic_name 
)

These methods have DDS QOS, a profile and a topic_name as input.

The DDS QOS is passed by reference. This library fills this QOS and will return it to the callee.

qos_profile should be the same profile string as the one passed to the init method.

If the profile name is correct, the methods will invoke the corresponding method in the XML_File_Intf class.

Definition at line 183 of file QOS_XML_Loader.cpp.

References ACE_TEXT(), OpenDDS::DCPS::DCPS_debug_level, ACE_OS::free(), OpenDDS::DCPS::QOS_XML_File_Handler::get_datareader_qos(), get_profile_name(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

00187   {
00188     if (!qos_profile)
00189       {
00190         if (DCPS_debug_level > 9)
00191           {
00192             ACE_DEBUG ((LM_DEBUG,
00193               ACE_TEXT ("QOS_XML_Loader::get_datareader_qos - ")
00194               ACE_TEXT ("No QOS profile provided. Can't do anything, ")
00195               ACE_TEXT ("returning\n")));
00196           }
00197 
00198         return DDS::RETCODE_OK;
00199       }
00200 
00201     char* profile_name = this->get_profile_name (qos_profile);
00202 
00203     if (!profile_name)
00204       {
00205         if (DCPS_debug_level > 5)
00206           {
00207             ACE_ERROR ((LM_ERROR,
00208               ACE_TEXT ("QOS_XML_Loader::get_datareader_qos - ")
00209               ACE_TEXT ("Error parsing profile string <%C>, returning.\n"),
00210               qos_profile));
00211           }
00212         return ::DDS::RETCODE_BAD_PARAMETER;
00213       }
00214 
00215     DDS::ReturnCode_t retcode = DDS::RETCODE_OK;
00216 
00217     try
00218       {
00219         retcode = this->xml_file_.get_datareader_qos (dr_qos,
00220                                                       profile_name,
00221                                                       topic_name);
00222       }
00223     catch (...)
00224       {
00225         if (DCPS_debug_level > 5)
00226           {
00227             ACE_ERROR ((LM_ERROR,
00228               ACE_TEXT ("QOS_XML_Loader::get_datareader_qos - ")
00229               ACE_TEXT ("Caught unexpected exception.\n")));
00230           }
00231         retcode = ::DDS::RETCODE_ERROR;
00232       }
00233     ACE_OS::free (profile_name);
00234 
00235     return retcode;
00236   }

Here is the call graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_datawriter_qos ( DDS::DataWriterQos dw_qos,
const char *  qos_profile,
const char *  topic_name 
)

These methods have DDS QOS, a profile and a topic_name as input.

The DDS QOS is passed by reference. This library fills this QOS and will return it to the callee.

qos_profile should be the same profile string as the one passed to the init method.

If the profile name is correct, the methods will invoke the corresponding method in the XML_File_Intf class.

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_participant_qos ( DDS::DomainParticipantQos part_qos,
const char *  qos_profile 
)

These methods have DDS QOS, a profile and a topic_name as input.

The DDS QOS is passed by reference. This library fills this QOS and will return it to the callee.

qos_profile should be the same profile string as the one passed to the init method.

If the profile name is correct, the methods will invoke the corresponding method in the XML_File_Intf class.

Definition at line 403 of file QOS_XML_Loader.cpp.

References ACE_TEXT(), OpenDDS::DCPS::DCPS_debug_level, ACE_OS::free(), OpenDDS::DCPS::QOS_XML_File_Handler::get_participant_qos(), get_profile_name(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

00406   {
00407     if (!qos_profile)
00408       {
00409         if (DCPS_debug_level > 9)
00410           {
00411             ACE_DEBUG ((LM_DEBUG,
00412               ACE_TEXT ("QOS_XML_Loader::get_participant_qos - ")
00413               ACE_TEXT ("No QOS profile provided. Can't do anything, ")
00414               ACE_TEXT ("returning\n")));
00415           }
00416 
00417         return DDS::RETCODE_OK;
00418       }
00419 
00420     char* profile_name = this->get_profile_name (qos_profile);
00421 
00422     if (!profile_name)
00423       {
00424         if (DCPS_debug_level > 5)
00425           {
00426             ACE_ERROR ((LM_ERROR,
00427               ACE_TEXT ("QOS_XML_Loader::get_participant_qos - ")
00428               ACE_TEXT ("Error parsing profile string <%C>, returning.\n"),
00429               qos_profile));
00430           }
00431         return ::DDS::RETCODE_BAD_PARAMETER;
00432       }
00433 
00434     DDS::ReturnCode_t retcode = DDS::RETCODE_OK;
00435 
00436     try
00437       {
00438         retcode = this->xml_file_.get_participant_qos (part_qos, profile_name);
00439       }
00440     catch (...)
00441       {
00442         if (DCPS_debug_level > 5)
00443           {
00444             ACE_ERROR ((LM_ERROR,
00445               ACE_TEXT ("QOS_XML_Loader::get_participant_qos - ")
00446               ACE_TEXT ("Caught unexpected exception.\n")));
00447           }
00448         retcode = DDS::RETCODE_ERROR;
00449       }
00450 
00451     ACE_OS::free (profile_name);
00452 
00453     return retcode;
00454   }

Here is the call graph for this function:

char * OpenDDS::DCPS::QOS_XML_Loader::get_profile_name ( const char *  qos_profile  )  [private]

Definition at line 55 of file QOS_XML_Loader.cpp.

References OpenDDS::DCPS::DCPS_debug_level, ACE_Tokenizer_T< class >::delimiter_replace(), ACE_OS::free(), LM_ERROR, ACE_Tokenizer_T< class >::next(), and ACE_OS::strdup().

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

00056   {
00057     if (qos_profile)
00058       {
00059         char* buf = ACE_OS::strdup (qos_profile);
00060         ACE_Tokenizer_T<char> tok (buf);
00061         tok.delimiter_replace ('#', 0);
00062         const char * lib_name = tok.next ();
00063         const char * prof_name = tok.next ();
00064 
00065         if (lib_name == 0 || prof_name == 0 || tok.next () != 0)
00066           {
00067             ACE_OS::free (buf);
00068             if (DCPS_debug_level > 5)
00069               {
00070                 ACE_ERROR ((LM_ERROR,
00071                               "get_profile_name <%C> - "
00072                               "Error: malformed qos_profile. Expected format: "
00073                               "<xml_file_base_name>#<profile_name>\n",
00074                               qos_profile));
00075               }
00076             return 0;
00077           }
00078 
00079         char * ret = ACE_OS::strdup (prof_name);
00080         ACE_OS::free (buf);
00081         return ret;
00082       }
00083 
00084     return 0;
00085   }

Here is the call graph for this function:

Here is the caller graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_publisher_qos ( DDS::PublisherQos pub_qos,
const char *  qos_profile 
)

These methods have DDS QOS, a profile and a topic_name as input.

The DDS QOS is passed by reference. This library fills this QOS and will return it to the callee.

qos_profile should be the same profile string as the one passed to the init method.

If the profile name is correct, the methods will invoke the corresponding method in the XML_File_Intf class.

Definition at line 239 of file QOS_XML_Loader.cpp.

References ACE_TEXT(), OpenDDS::DCPS::DCPS_debug_level, ACE_OS::free(), get_profile_name(), OpenDDS::DCPS::QOS_XML_File_Handler::get_publisher_qos(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

00242   {
00243     if (!qos_profile)
00244       {
00245         if (DCPS_debug_level > 9)
00246           {
00247             ACE_DEBUG ((LM_DEBUG,
00248               ACE_TEXT ("QOS_XML_Loader::get_publisher_qos - ")
00249               ACE_TEXT ("No QOS profile provided. Can't do anything, ")
00250               ACE_TEXT ("returning\n")));
00251           }
00252 
00253         return DDS::RETCODE_OK;
00254       }
00255 
00256     char* profile_name = this->get_profile_name (qos_profile);
00257 
00258     if (!profile_name)
00259       {
00260         if (DCPS_debug_level > 5)
00261           {
00262             ACE_ERROR ((LM_ERROR,
00263               ACE_TEXT ("QOS_XML_Loader::get_publisher_qos - ")
00264               ACE_TEXT ("Error parsing profile string <%C>, returning.\n"),
00265               qos_profile));
00266           }
00267         return ::DDS::RETCODE_BAD_PARAMETER;
00268       }
00269 
00270     DDS::ReturnCode_t retcode = DDS::RETCODE_OK;
00271 
00272     try
00273       {
00274         retcode = this->xml_file_.get_publisher_qos (pub_qos, profile_name);
00275       }
00276     catch (...)
00277       {
00278         if (DCPS_debug_level > 5)
00279           {
00280             ACE_ERROR ((LM_ERROR,
00281               ACE_TEXT ("QOS_XML_Loader::get_publisher_qos - ")
00282               ACE_TEXT ("Caught unexpected exception.\n")));
00283           }
00284         retcode = DDS::RETCODE_ERROR;
00285       }
00286     ACE_OS::free (profile_name);
00287 
00288     return retcode;
00289   }

Here is the call graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_subscriber_qos ( DDS::SubscriberQos sub_qos,
const char *  qos_profile 
)

These methods have DDS QOS, a profile and a topic_name as input.

The DDS QOS is passed by reference. This library fills this QOS and will return it to the callee.

qos_profile should be the same profile string as the one passed to the init method.

If the profile name is correct, the methods will invoke the corresponding method in the XML_File_Intf class.

Definition at line 292 of file QOS_XML_Loader.cpp.

References ACE_TEXT(), OpenDDS::DCPS::DCPS_debug_level, ACE_OS::free(), get_profile_name(), OpenDDS::DCPS::QOS_XML_File_Handler::get_subscriber_qos(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

00295   {
00296     if (!qos_profile)
00297       {
00298         if (DCPS_debug_level > 9)
00299           {
00300             ACE_DEBUG ((LM_DEBUG,
00301               ACE_TEXT ("QOS_XML_Loader::get_subscriber_qos - ")
00302               ACE_TEXT ("No QOS profile provided. Can't do anything, ")
00303               ACE_TEXT ("returning\n")));
00304           }
00305 
00306         return DDS::RETCODE_OK;
00307       }
00308 
00309     char* profile_name = this->get_profile_name (qos_profile);
00310 
00311     if (!profile_name)
00312       {
00313         if (DCPS_debug_level > 5)
00314           {
00315             ACE_ERROR ((LM_ERROR,
00316               ACE_TEXT ("QOS_XML_Loader::get_subscriber_qos - ")
00317               ACE_TEXT ("Error parsing profile string <%C>, returning.\n"),
00318               qos_profile));
00319           }
00320         return ::DDS::RETCODE_BAD_PARAMETER;
00321       }
00322 
00323     DDS::ReturnCode_t retcode = DDS::RETCODE_OK;
00324 
00325     try
00326       {
00327         retcode = this->xml_file_.get_subscriber_qos (sub_qos, profile_name);
00328       }
00329     catch (...)
00330       {
00331         if (DCPS_debug_level > 5)
00332           {
00333             ACE_ERROR ((LM_ERROR,
00334               ACE_TEXT ("QOS_XML_Loader::get_subscriber_qos - ")
00335               ACE_TEXT ("Caught unexpected exception.\n")));
00336           }
00337         retcode = DDS::RETCODE_ERROR;
00338       }
00339 
00340     ACE_OS::free (profile_name);
00341 
00342     return retcode;
00343   }

Here is the call graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_topic_qos ( DDS::TopicQos topic_qos,
const char *  qos_profile,
const ACE_TCHAR topic_name 
)

These methods have DDS QOS, a profile and a topic_name as input.

The DDS QOS is passed by reference. This library fills this QOS and will return it to the callee.

qos_profile should be the same profile string as the one passed to the init method.

If the profile name is correct, the methods will invoke the corresponding method in the XML_File_Intf class.

Definition at line 346 of file QOS_XML_Loader.cpp.

References ACE_TEXT(), OpenDDS::DCPS::DCPS_debug_level, ACE_OS::free(), get_profile_name(), OpenDDS::DCPS::QOS_XML_File_Handler::get_topic_qos(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

00350   {
00351     if (!qos_profile)
00352       {
00353         if (DCPS_debug_level > 9)
00354           {
00355             ACE_DEBUG ((LM_DEBUG,
00356               ACE_TEXT ("QOS_XML_Loader::get_topic_qos - ")
00357               ACE_TEXT ("No QOS profile provided. Can't do anything, ")
00358               ACE_TEXT ("returning\n")));
00359           }
00360 
00361         return DDS::RETCODE_OK;
00362       }
00363 
00364     char* profile_name = this->get_profile_name (qos_profile);
00365 
00366     if (!profile_name)
00367       {
00368         if (DCPS_debug_level > 5)
00369           {
00370             ACE_ERROR ((LM_ERROR,
00371               ACE_TEXT ("QOS_XML_Loader::get_topic_qos - ")
00372               ACE_TEXT ("Error parsing profile string <%C>, returning.\n"),
00373               qos_profile));
00374           }
00375         return ::DDS::RETCODE_BAD_PARAMETER;
00376       }
00377 
00378     DDS::ReturnCode_t retcode = DDS::RETCODE_OK;
00379 
00380     try
00381       {
00382         retcode = this->xml_file_.get_topic_qos (topic_qos,
00383                                                  profile_name,
00384                                                  topic_name);
00385       }
00386     catch (...)
00387       {
00388         if (DCPS_debug_level > 5)
00389           {
00390             ACE_ERROR ((LM_ERROR,
00391               ACE_TEXT ("QOS_XML_Loader::get_topic_qos - ")
00392               ACE_TEXT ("Caught unexpected exception.\n")));
00393           }
00394         retcode = DDS::RETCODE_ERROR;
00395       }
00396 
00397     ACE_OS::free (profile_name);
00398 
00399     return retcode;
00400   }

Here is the call graph for this function:

char * OpenDDS::DCPS::QOS_XML_Loader::get_xml_file_name ( const char *  qos_profile  )  [private]

Definition at line 21 of file QOS_XML_Loader.cpp.

References OpenDDS::DCPS::DCPS_debug_level, ACE_Tokenizer_T< class >::delimiter_replace(), ACE_OS::free(), LM_ERROR, ACE_OS::malloc(), ACE_Tokenizer_T< class >::next(), ACE_OS::strcat(), ACE_OS::strcpy(), ACE_OS::strdup(), and ACE_OS::strlen().

Referenced by init().

00022   {
00023     if (qos_profile)
00024       {
00025         char* buf = ACE_OS::strdup (qos_profile);
00026         ACE_Tokenizer_T<char> tok (buf);
00027         tok.delimiter_replace ('#', 0);
00028         const char * file_name = tok.next ();
00029 
00030         if (file_name == 0)
00031           {
00032             ACE_OS::free (buf);
00033             if (DCPS_debug_level > 5)
00034               {
00035                 ACE_ERROR ((LM_ERROR,
00036                               "get_xml_file_name <%C> - "
00037                               "Error: malformed qos_profile. Expected format: "
00038                               "<xml_file_base_name>#<profile_name>\n",
00039                               qos_profile));
00040               }
00041             return 0;
00042           }
00043 
00044         char * ret = (char*)ACE_OS::malloc (ACE_OS::strlen (file_name) + 5);
00045         ret = ACE_OS::strcpy (ret, file_name);
00046         ret = ACE_OS::strcat (ret, ".xml");
00047         ACE_OS::free (buf);
00048         return ret;
00049       }
00050 
00051     return 0;
00052   }

Here is the call graph for this function:

Here is the caller graph for this function:

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::init ( const ACE_TCHAR qos_profile  ) 

init

qos_profile profile should be formatted like:

qos_base_file_name_without_extension::profile_name_in_xml_file

Init parses this string and will append ".xml" to qos_base_file_name_without_extension. It'll than invoke the init method on the XML_File_Intf class.

Definition at line 89 of file QOS_XML_Loader.cpp.

References ACE_TEXT(), OpenDDS::DCPS::QOS_XML_File_Handler::add_search_path(), OpenDDS::DCPS::DCPS_debug_level, filename, ACE_OS::free(), get_xml_file_name(), OpenDDS::DCPS::QOS_XML_File_Handler::init(), LM_ERROR, DDS::RETCODE_BAD_PARAMETER, and xml_file_.

00090   {
00091     if (!qos_profile)
00092       {
00093         if (DCPS_debug_level > 5)
00094           {
00095             ACE_ERROR ((LM_ERROR,
00096               ACE_TEXT ("QOS_XML_Loader::init - ")
00097               ACE_TEXT ("Passed an empty qos_profile, returning.\n")));
00098           }
00099         return ::DDS::RETCODE_BAD_PARAMETER;
00100       }
00101 
00102     char *filename = this->get_xml_file_name (qos_profile);
00103 
00104     if (!filename)
00105       {
00106         if (DCPS_debug_level > 5)
00107           {
00108             ACE_ERROR ((LM_ERROR,
00109               ACE_TEXT ("QOS_XML_Loader::init - ")
00110               ACE_TEXT ("Unable to extract a file name from <%C>, returning.\n"),
00111               qos_profile));
00112           }
00113         return ::DDS::RETCODE_BAD_PARAMETER;
00114       }
00115 
00116     this->xml_file_.add_search_path (
00117       ACE_TEXT("DDS_ROOT"),
00118       ACE_TEXT("/docs/schema/"));
00119 
00120     DDS::ReturnCode_t const retcode =  this->xml_file_.init (filename);
00121 
00122     ACE_OS::free (filename);
00123 
00124     return retcode;
00125   }

Here is the call graph for this function:


Member Data Documentation


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