char* QOS_XML_Loader::get_profile_name (const char * qos_profile) { if (qos_profile) { char* buf = ACE_OS::strdup (qos_profile); ACE_Tokenizer_T<char> tok (buf); tok.delimiter_replace ('#', 0); const char * lib_name = tok.next (); const char * prof_name = tok.next (); if (lib_name == 0 || prof_name == 0 || tok.next () != 0) { ACE_OS::free (buf); if (DCPS_debug_level > 5) { ACE_ERROR ((LM_ERROR, "get_profile_name <%C> - " "Error: malformed qos_profile. Expected format: " "<xml_file_base_name>#<profile_name>\n", qos_profile)); } return 0; } char * ret = ACE_OS::strdup (prof_name); ACE_OS::free (buf); return ret; } return 0; }
char* QOS_XML_Loader::get_xml_file_name (const char * qos_profile) { if (qos_profile) { char* buf = ACE_OS::strdup (qos_profile); ACE_Tokenizer_T<char> tok (buf); tok.delimiter_replace ('#', 0); const char * file_name = tok.next (); if (file_name == 0) { ACE_OS::free (buf); if (DCPS_debug_level > 5) { ACE_ERROR ((LM_ERROR, "get_xml_file_name <%C> - " "Error: malformed qos_profile. Expected format: " "<xml_file_base_name>#<profile_name>\n", qos_profile)); } return 0; } char * ret = (char*)ACE_OS::malloc (ACE_OS::strlen (file_name) + 5); ret = ACE_OS::strcpy (ret, file_name); ret = ACE_OS::strcat (ret, ".xml"); ACE_OS::free (buf); return ret; } return 0; }
char * get_library_name (const char * qos_profile) { char* buf = ACE_OS::strdup (qos_profile); ACE_Tokenizer_T<char> tok (buf); tok.delimiter_replace ('#', 0); const char * lib_name = tok.next (); if (lib_name == 0) { ACE_OS::free (buf); DDS4CCM_ERROR (DDS4CCM_LOG_LEVEL_ERROR, (LM_ERROR, DDS4CCM_INFO "get_library_name <%C> - " "Error: malformed qos_profile. Expected format: " "<library_name>#<profile_name>\n", qos_profile)); return 0; } char * ret = ACE_OS::strdup (lib_name); ACE_OS::free (buf); return ret; }
void split_qos (const char * qos) { char* buf = ACE_OS::strdup (qos); ACE_Tokenizer_T<char> tok (buf); tok.delimiter_replace ('#', 0); for (char *p = tok.next (); p; p = tok.next ()) { if (!lib_name_) { lib_name_ = ACE_OS::strdup (p); } else if (!prof_name_) { prof_name_ = ACE_OS::strdup (p); } } ACE_OS::free (buf); ACE_DEBUG ((LM_DEBUG, "Sender : Found QoS profile %C %C\n", lib_name_, prof_name_)); }