OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
OpenDDS::DCPS::QOS_XML_Loader Class Reference

#include <QOS_XML_Loader.h>

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

Public Member Functions

 QOS_XML_Loader (XML::XML_Error_Handler *error_handler=0)
 
 ~QOS_XML_Loader ()
 
DDS::ReturnCode_t init (const ACE_TCHAR *qos_profile)
 
DDS::ReturnCode_t get_datawriter_qos (DDS::DataWriterQos &dw_qos, const ACE_TCHAR *qos_profile, const ACE_TCHAR *topic_name)
 
DDS::ReturnCode_t get_datareader_qos (DDS::DataReaderQos &dr_qos, const ACE_TCHAR *qos_profile, const ACE_TCHAR *topic_name)
 
DDS::ReturnCode_t get_publisher_qos (DDS::PublisherQos &pub_qos, const ACE_TCHAR *qos_profile)
 
DDS::ReturnCode_t get_subscriber_qos (DDS::SubscriberQos &sub_qos, const ACE_TCHAR *qos_profile)
 
DDS::ReturnCode_t get_topic_qos (DDS::TopicQos &topic_qos, const ACE_TCHAR *qos_profile, const ACE_TCHAR *topic_name)
 
DDS::ReturnCode_t get_participant_qos (DDS::DomainParticipantQos &part_qos, const ACE_TCHAR *qos_profile)
 

Private Member Functions

ACE_TString get_xml_file_name (const ACE_TCHAR *qos_profile)
 
ACE_TString get_profile_name (const ACE_TCHAR *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

◆ QOS_XML_Loader()

OpenDDS::DCPS::QOS_XML_Loader::QOS_XML_Loader ( XML::XML_Error_Handler *  error_handler = 0)

Pass an optional which is called back when there are any errors parsing the input XML. The QOS_XML_Loader will assume ownership when a pointer is passed

Definition at line 11 of file QOS_XML_Loader.cpp.

12  : xml_file_ (error_handler)
13  {
14  }
QOS_XML_File_Handler xml_file_

◆ ~QOS_XML_Loader()

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

Definition at line 16 of file QOS_XML_Loader.cpp.

17  {
18  }

Member Function Documentation

◆ get_datareader_qos()

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_datareader_qos ( DDS::DataReaderQos dr_qos,
const ACE_TCHAR 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 180 of file QOS_XML_Loader.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::DCPS_debug_level, ACE_String_Base< char >::empty(), OpenDDS::DCPS::QOS_XML_Handler::get_datareader_qos(), get_profile_name(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

184  {
185  if (!qos_profile)
186  {
187  if (DCPS_debug_level > 9)
188  {
189  ACE_DEBUG((LM_DEBUG,
190  ACE_TEXT("QOS_XML_Loader::get_datareader_qos - ")
191  ACE_TEXT("No QOS profile provided. Can't do anything, ")
192  ACE_TEXT("returning\n")));
193  }
194 
195  return DDS::RETCODE_OK;
196  }
197 
198  const ACE_TString profile_name = get_profile_name(qos_profile);
199 
200  if (profile_name.empty())
201  {
202  if (DCPS_debug_level > 5)
203  {
204  ACE_ERROR((LM_ERROR,
205  ACE_TEXT("QOS_XML_Loader::get_datareader_qos - ")
206  ACE_TEXT("Error parsing profile string <%s>, returning.\n"),
207  qos_profile));
208  }
210  }
211 
213 
214  try
215  {
216  retcode = xml_file_.get_datareader_qos(dr_qos,
217  profile_name.c_str(),
218  topic_name);
219  }
220  catch (...)
221  {
222  if (DCPS_debug_level > 5)
223  {
224  ACE_ERROR((LM_ERROR,
225  ACE_TEXT("QOS_XML_Loader::get_datareader_qos - ")
226  ACE_TEXT("Caught unexpected exception.\n")));
227  }
228  retcode = ::DDS::RETCODE_ERROR;
229  }
230 
231  return retcode;
232  }
#define ACE_DEBUG(X)
#define ACE_ERROR(X)
const char * c_str(void) const
const ReturnCode_t RETCODE_OK
const ReturnCode_t RETCODE_BAD_PARAMETER
const ReturnCode_t RETCODE_ERROR
bool empty(void) const
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
ACE_TString get_profile_name(const ACE_TCHAR *qos_profile)
DDS::ReturnCode_t get_datareader_qos(::DDS::DataReaderQos &dr_qos, const ACE_TCHAR *profile_name, const ACE_TCHAR *topic_name)
Definition: XML_Intf.cpp:208
QOS_XML_File_Handler xml_file_

◆ get_datawriter_qos()

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_datawriter_qos ( DDS::DataWriterQos dw_qos,
const ACE_TCHAR 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 125 of file QOS_XML_Loader.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::DCPS_debug_level, ACE_String_Base< char >::empty(), OpenDDS::DCPS::QOS_XML_Handler::get_datawriter_qos(), get_profile_name(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

129  {
130  if (!qos_profile)
131  {
132  if (DCPS_debug_level > 9)
133  {
134  ACE_DEBUG((LM_DEBUG,
135  ACE_TEXT("QOS_XML_Loader::get_datawriter_qos - ")
136  ACE_TEXT("No QOS profile provided. Can't do anything, ")
137  ACE_TEXT("returning\n")));
138  }
139 
140  return DDS::RETCODE_OK;
141  }
142 
143  const ACE_TString profile_name = get_profile_name(qos_profile);
144 
145  if (profile_name.empty())
146  {
147  if (DCPS_debug_level > 5)
148  {
149  ACE_ERROR((LM_ERROR,
150  ACE_TEXT("QOS_XML_Loader::get_datawriter_qos - ")
151  ACE_TEXT("Error parsing profile string <%s>, returning.\n"),
152  qos_profile));
153  }
155  }
156 
158 
159  try
160  {
161  retcode = xml_file_.get_datawriter_qos(dw_qos,
162  profile_name.c_str(),
163  topic_name);
164  }
165  catch (...)
166  {
167  if (DCPS_debug_level > 5)
168  {
169  ACE_ERROR((LM_ERROR,
170  ACE_TEXT("QOS_XML_Loader::get_datawriter_qos - ")
171  ACE_TEXT("Caught unexpected exception.\n")));
172  }
173  retcode = DDS::RETCODE_ERROR;
174  }
175 
176  return retcode;
177  }
#define ACE_DEBUG(X)
#define ACE_ERROR(X)
const char * c_str(void) const
const ReturnCode_t RETCODE_OK
const ReturnCode_t RETCODE_BAD_PARAMETER
DDS::ReturnCode_t get_datawriter_qos(::DDS::DataWriterQos &dw_qos, const ACE_TCHAR *profile_name, const ACE_TCHAR *topic_name)
Definition: XML_Intf.cpp:170
const ReturnCode_t RETCODE_ERROR
bool empty(void) const
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
ACE_TString get_profile_name(const ACE_TCHAR *qos_profile)
QOS_XML_File_Handler xml_file_

◆ get_participant_qos()

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_participant_qos ( DDS::DomainParticipantQos part_qos,
const ACE_TCHAR 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 394 of file QOS_XML_Loader.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::DCPS_debug_level, ACE_String_Base< char >::empty(), OpenDDS::DCPS::QOS_XML_Handler::get_participant_qos(), get_profile_name(), LM_DEBUG, LM_ERROR, OPENDDS_END_VERSIONED_NAMESPACE_DECL, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

397  {
398  if (!qos_profile)
399  {
400  if (DCPS_debug_level > 9)
401  {
402  ACE_DEBUG((LM_DEBUG,
403  ACE_TEXT("QOS_XML_Loader::get_participant_qos - ")
404  ACE_TEXT("No QOS profile provided. Can't do anything, ")
405  ACE_TEXT("returning\n")));
406  }
407 
408  return DDS::RETCODE_OK;
409  }
410 
411  const ACE_TString profile_name = get_profile_name(qos_profile);
412 
413  if (profile_name.empty())
414  {
415  if (DCPS_debug_level > 5)
416  {
417  ACE_ERROR((LM_ERROR,
418  ACE_TEXT("QOS_XML_Loader::get_participant_qos - ")
419  ACE_TEXT("Error parsing profile string <%s>, returning.\n"),
420  qos_profile));
421  }
423  }
424 
426 
427  try
428  {
429  retcode = xml_file_.get_participant_qos(part_qos, profile_name.c_str());
430  }
431  catch (...)
432  {
433  if (DCPS_debug_level > 5)
434  {
435  ACE_ERROR((LM_ERROR,
436  ACE_TEXT("QOS_XML_Loader::get_participant_qos - ")
437  ACE_TEXT("Caught unexpected exception.\n")));
438  }
439  retcode = DDS::RETCODE_ERROR;
440  }
441 
442  return retcode;
443  }
#define ACE_DEBUG(X)
#define ACE_ERROR(X)
const char * c_str(void) const
const ReturnCode_t RETCODE_OK
const ReturnCode_t RETCODE_BAD_PARAMETER
const ReturnCode_t RETCODE_ERROR
DDS::ReturnCode_t get_participant_qos(::DDS::DomainParticipantQos &sub_qos, const ACE_TCHAR *profile_name)
Definition: XML_Intf.cpp:354
bool empty(void) const
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
ACE_TString get_profile_name(const ACE_TCHAR *qos_profile)
QOS_XML_File_Handler xml_file_

◆ get_profile_name()

ACE_TString OpenDDS::DCPS::QOS_XML_Loader::get_profile_name ( const ACE_TCHAR qos_profile)
private

Definition at line 54 of file QOS_XML_Loader.cpp.

References ACE_ERROR, 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_datawriter_qos(), get_participant_qos(), get_publisher_qos(), get_subscriber_qos(), and get_topic_qos().

55  {
56  if (qos_profile)
57  {
58  ACE_TCHAR* buf = ACE_OS::strdup(qos_profile);
60  tok.delimiter_replace('#', 0);
61  const ACE_TCHAR * lib_name = tok.next();
62  const ACE_TCHAR * prof_name = tok.next();
63 
64  if (lib_name == 0 || prof_name == 0 || tok.next() != 0)
65  {
66  ACE_OS::free(buf);
67  if (DCPS_debug_level > 5)
68  {
69  ACE_ERROR((LM_ERROR,
70  "get_profile_name <%s> - "
71  "Error: malformed qos_profile. Expected format: "
72  "<xml_file_base_name>#<profile_name>\n",
73  qos_profile));
74  }
75  return ACE_TString();
76  }
77 
78  ACE_TString ret(prof_name);
79  ACE_OS::free(buf);
80  return ret;
81  }
82 
83  return ACE_TString();
84  }
#define ACE_ERROR(X)
void free(void *)
char ACE_TCHAR
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
char * strdup(const char *s)

◆ get_publisher_qos()

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_publisher_qos ( DDS::PublisherQos pub_qos,
const ACE_TCHAR 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 235 of file QOS_XML_Loader.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::DCPS_debug_level, ACE_String_Base< char >::empty(), get_profile_name(), OpenDDS::DCPS::QOS_XML_Handler::get_publisher_qos(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

238  {
239  if (!qos_profile)
240  {
241  if (DCPS_debug_level > 9)
242  {
243  ACE_DEBUG((LM_DEBUG,
244  ACE_TEXT("QOS_XML_Loader::get_publisher_qos - ")
245  ACE_TEXT("No QOS profile provided. Can't do anything, ")
246  ACE_TEXT("returning\n")));
247  }
248 
249  return DDS::RETCODE_OK;
250  }
251 
252  const ACE_TString profile_name = get_profile_name(qos_profile);
253 
254  if (profile_name.empty())
255  {
256  if (DCPS_debug_level > 5)
257  {
258  ACE_ERROR((LM_ERROR,
259  ACE_TEXT("QOS_XML_Loader::get_publisher_qos - ")
260  ACE_TEXT("Error parsing profile string <%s>, returning.\n"),
261  qos_profile));
262  }
264  }
265 
267 
268  try
269  {
270  retcode = xml_file_.get_publisher_qos(pub_qos, profile_name.c_str());
271  }
272  catch (...)
273  {
274  if (DCPS_debug_level > 5)
275  {
276  ACE_ERROR((LM_ERROR,
277  ACE_TEXT("QOS_XML_Loader::get_publisher_qos - ")
278  ACE_TEXT("Caught unexpected exception.\n")));
279  }
280  retcode = DDS::RETCODE_ERROR;
281  }
282 
283  return retcode;
284  }
#define ACE_DEBUG(X)
#define ACE_ERROR(X)
const char * c_str(void) const
DDS::ReturnCode_t get_publisher_qos(::DDS::PublisherQos &pub_qos, const ACE_TCHAR *profile_name)
Definition: XML_Intf.cpp:284
const ReturnCode_t RETCODE_OK
const ReturnCode_t RETCODE_BAD_PARAMETER
const ReturnCode_t RETCODE_ERROR
bool empty(void) const
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
ACE_TString get_profile_name(const ACE_TCHAR *qos_profile)
QOS_XML_File_Handler xml_file_

◆ get_subscriber_qos()

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_subscriber_qos ( DDS::SubscriberQos sub_qos,
const ACE_TCHAR 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 287 of file QOS_XML_Loader.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::DCPS_debug_level, ACE_String_Base< char >::empty(), get_profile_name(), OpenDDS::DCPS::QOS_XML_Handler::get_subscriber_qos(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

290  {
291  if (!qos_profile)
292  {
293  if (DCPS_debug_level > 9)
294  {
295  ACE_DEBUG((LM_DEBUG,
296  ACE_TEXT("QOS_XML_Loader::get_subscriber_qos - ")
297  ACE_TEXT("No QOS profile provided. Can't do anything, ")
298  ACE_TEXT("returning\n")));
299  }
300 
301  return DDS::RETCODE_OK;
302  }
303 
304  const ACE_TString profile_name = get_profile_name(qos_profile);
305 
306  if (profile_name.empty())
307  {
308  if (DCPS_debug_level > 5)
309  {
310  ACE_ERROR((LM_ERROR,
311  ACE_TEXT("QOS_XML_Loader::get_subscriber_qos - ")
312  ACE_TEXT("Error parsing profile string <%s>, returning.\n"),
313  qos_profile));
314  }
316  }
317 
319 
320  try
321  {
322  retcode = xml_file_.get_subscriber_qos(sub_qos, profile_name.c_str());
323  }
324  catch (...)
325  {
326  if (DCPS_debug_level > 5)
327  {
328  ACE_ERROR((LM_ERROR,
329  ACE_TEXT("QOS_XML_Loader::get_subscriber_qos - ")
330  ACE_TEXT("Caught unexpected exception.\n")));
331  }
332  retcode = DDS::RETCODE_ERROR;
333  }
334 
335  return retcode;
336  }
#define ACE_DEBUG(X)
#define ACE_ERROR(X)
const char * c_str(void) const
DDS::ReturnCode_t get_subscriber_qos(::DDS::SubscriberQos &sub_qos, const ACE_TCHAR *profile_name)
Definition: XML_Intf.cpp:319
const ReturnCode_t RETCODE_OK
const ReturnCode_t RETCODE_BAD_PARAMETER
const ReturnCode_t RETCODE_ERROR
bool empty(void) const
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
ACE_TString get_profile_name(const ACE_TCHAR *qos_profile)
QOS_XML_File_Handler xml_file_

◆ get_topic_qos()

DDS::ReturnCode_t OpenDDS::DCPS::QOS_XML_Loader::get_topic_qos ( DDS::TopicQos topic_qos,
const ACE_TCHAR 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 339 of file QOS_XML_Loader.cpp.

References ACE_DEBUG, ACE_ERROR, ACE_TEXT(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::DCPS_debug_level, ACE_String_Base< char >::empty(), get_profile_name(), OpenDDS::DCPS::QOS_XML_Handler::get_topic_qos(), LM_DEBUG, LM_ERROR, DDS::RETCODE_BAD_PARAMETER, DDS::RETCODE_ERROR, DDS::RETCODE_OK, and xml_file_.

343  {
344  if (!qos_profile)
345  {
346  if (DCPS_debug_level > 9)
347  {
348  ACE_DEBUG((LM_DEBUG,
349  ACE_TEXT("QOS_XML_Loader::get_topic_qos - ")
350  ACE_TEXT("No QOS profile provided. Can't do anything, ")
351  ACE_TEXT("returning\n")));
352  }
353 
354  return DDS::RETCODE_OK;
355  }
356 
357  const ACE_TString profile_name = get_profile_name(qos_profile);
358 
359  if (profile_name.empty())
360  {
361  if (DCPS_debug_level > 5)
362  {
363  ACE_ERROR((LM_ERROR,
364  ACE_TEXT("QOS_XML_Loader::get_topic_qos - ")
365  ACE_TEXT("Error parsing profile string <%s>, returning.\n"),
366  qos_profile));
367  }
369  }
370 
372 
373  try
374  {
375  retcode = xml_file_.get_topic_qos(topic_qos,
376  profile_name.c_str(),
377  topic_name);
378  }
379  catch (...)
380  {
381  if (DCPS_debug_level > 5)
382  {
383  ACE_ERROR((LM_ERROR,
384  ACE_TEXT("QOS_XML_Loader::get_topic_qos - ")
385  ACE_TEXT("Caught unexpected exception.\n")));
386  }
387  retcode = DDS::RETCODE_ERROR;
388  }
389 
390  return retcode;
391  }
#define ACE_DEBUG(X)
#define ACE_ERROR(X)
const char * c_str(void) const
const ReturnCode_t RETCODE_OK
const ReturnCode_t RETCODE_BAD_PARAMETER
DDS::ReturnCode_t get_topic_qos(::DDS::TopicQos &tp_qos, const ACE_TCHAR *profile_name, const ACE_TCHAR *topic_name)
Definition: XML_Intf.cpp:246
const ReturnCode_t RETCODE_ERROR
bool empty(void) const
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
ACE_TString get_profile_name(const ACE_TCHAR *qos_profile)
QOS_XML_File_Handler xml_file_

◆ get_xml_file_name()

ACE_TString OpenDDS::DCPS::QOS_XML_Loader::get_xml_file_name ( const ACE_TCHAR qos_profile)
private

Definition at line 21 of file QOS_XML_Loader.cpp.

References ACE_ERROR, ACE_TEXT(), 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 init().

22  {
23  if (qos_profile)
24  {
25  ACE_TCHAR* buf = ACE_OS::strdup(qos_profile);
27  tok.delimiter_replace('#', 0);
28  const ACE_TCHAR * file_name = tok.next();
29 
30  if (file_name == 0)
31  {
32  ACE_OS::free(buf);
33  if (DCPS_debug_level > 5)
34  {
35  ACE_ERROR((LM_ERROR,
36  "get_xml_file_name <%s> - "
37  "Error: malformed qos_profile. Expected format: "
38  "<xml_file_base_name>#<profile_name>\n",
39  qos_profile));
40  }
41  return ACE_TString();
42  }
43 
44  ACE_TString ret(file_name);
45  ret += ACE_TEXT(".xml");
46  ACE_OS::free(buf);
47  return ret;
48  }
49 
50  return ACE_TString();
51  }
#define ACE_ERROR(X)
void free(void *)
char ACE_TCHAR
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
char * strdup(const char *s)

◆ init()

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

References ACE_ERROR, ACE_TEXT(), OpenDDS::DCPS::QOS_XML_File_Handler::add_search_path(), ACE_String_Base< char >::c_str(), OpenDDS::DCPS::DCPS_debug_level, ACE_String_Base< char >::empty(), get_xml_file_name(), OpenDDS::DCPS::QOS_XML_File_Handler::init(), LM_ERROR, DDS::RETCODE_BAD_PARAMETER, and xml_file_.

89  {
90  if (!qos_profile)
91  {
92  if (DCPS_debug_level > 5)
93  {
94  ACE_ERROR((LM_ERROR,
95  ACE_TEXT("QOS_XML_Loader::init - ")
96  ACE_TEXT("Passed an empty qos_profile, returning.\n")));
97  }
99  }
100 
101  const ACE_TString filename = get_xml_file_name(qos_profile);
102 
103  if (filename.empty())
104  {
105  if (DCPS_debug_level > 5)
106  {
107  ACE_ERROR((LM_ERROR,
108  ACE_TEXT("QOS_XML_Loader::init - ")
109  ACE_TEXT("Unable to extract a file name from <%s>, returning.\n"),
110  qos_profile));
111  }
113  }
114 
116  ACE_TEXT("DDS_ROOT"),
117  ACE_TEXT("/docs/schema/"));
118 
119  DDS::ReturnCode_t const retcode = xml_file_.init(filename.c_str());
120 
121  return retcode;
122  }
#define ACE_ERROR(X)
const char * c_str(void) const
const ReturnCode_t RETCODE_BAD_PARAMETER
void add_search_path(const ACE_TCHAR *environment, const ACE_TCHAR *relpath)
ACE_TString get_xml_file_name(const ACE_TCHAR *qos_profile)
bool empty(void) const
OpenDDS_Dcps_Export unsigned int DCPS_debug_level
Definition: debug.cpp:30
ACE_TEXT("TCP_Factory")
DDS::ReturnCode_t init(const ACE_TCHAR *file)
QOS_XML_File_Handler xml_file_

Member Data Documentation

◆ xml_file_

QOS_XML_File_Handler OpenDDS::DCPS::QOS_XML_Loader::xml_file_
private

The documentation for this class was generated from the following files: