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 18 of file QOS_XML_Loader.h.


Constructor & Destructor Documentation

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

Definition at line 10 of file QOS_XML_Loader.cpp.

00011   {
00012   }

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

Definition at line 14 of file QOS_XML_Loader.cpp.

00015   {
00016   }


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 182 of file QOS_XML_Loader.cpp.

References OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::QOS_XML_File_Handler::get_datareader_qos(), get_profile_name(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

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

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 402 of file QOS_XML_Loader.cpp.

References OpenDDS::DCPS::DCPS_debug_level, OpenDDS::DCPS::QOS_XML_File_Handler::get_participant_qos(), get_profile_name(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

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

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

Definition at line 54 of file QOS_XML_Loader.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

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

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

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 238 of file QOS_XML_Loader.cpp.

References OpenDDS::DCPS::DCPS_debug_level, get_profile_name(), OpenDDS::DCPS::QOS_XML_File_Handler::get_publisher_qos(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

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

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 291 of file QOS_XML_Loader.cpp.

References OpenDDS::DCPS::DCPS_debug_level, get_profile_name(), OpenDDS::DCPS::QOS_XML_File_Handler::get_subscriber_qos(), DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

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

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.

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

Definition at line 20 of file QOS_XML_Loader.cpp.

References OpenDDS::DCPS::DCPS_debug_level.

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

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.


Member Data Documentation

QOS_XML_File_Handler OpenDDS::DCPS::QOS_XML_Loader::xml_file_ [private]

Definition at line 84 of file QOS_XML_Loader.h.

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


The documentation for this class was generated from the following files:
Generated on Fri Feb 12 20:06:21 2016 for OpenDDS by  doxygen 1.4.7