| 69 | TopicMap Parser::topic_map_; |
| 70 | |
| 71 | int |
| 72 | Parser::parse(const char* filename) |
| 73 | { |
| 74 | ACE_Configuration_Heap config; |
| 75 | config.open(); |
| 76 | ACE_Ini_ImpExp import(config); |
| 77 | int status = import.import_config(filename); |
| 78 | if (status) { |
| 79 | ACE_ERROR((LM_ERROR, |
| 80 | ACE_TEXT("(%P|%t) ERROR: Initialize() ") |
| 81 | ACE_TEXT("import_config () returned %d\n"), |
| 82 | status)); |
| 83 | return status; |
| 84 | } |
| 85 | |
| 86 | status = parse_sections(config, DATAWRITER_QOS_SECTION, false) || |
| 87 | parse_sections(config, DATAREADER_QOS_SECTION, false) || |
| 88 | parse_sections(config, PUBLISHER_QOS_SECTION, false) || |
| 89 | parse_sections(config, SUBSCRIBER_QOS_SECTION, false) || |
| 90 | parse_sections(config, TOPIC_SECTION, true) || |
| 91 | parse_sections(config, CONNECTION_SECTION, true); |
| 92 | |
| 93 | if (status) |
| 94 | return status; |
| 95 | |
| 96 | status = TheServiceParticipant->load_configuration(config, |
| 97 | filename); |
| 98 | |
| 99 | if (status) |
| 100 | return status; |
| 101 | |
| 102 | const DDS::DomainParticipantFactory_var dpf = TheParticipantFactory; |
| 103 | // For the configuration to be loaded. |
| 104 | ACE_UNUSED_ARG(dpf); |
| 105 | |
| 106 | for (ConnectionMap::const_iterator pos = connection_map_.begin(), limit = connection_map_.end(); |
| 107 | pos != limit; |
| 108 | ++pos) { |
| 109 | const ConnectionSettings& conn = pos->second; |
| 110 | OpenDDS::DCPS::GUID_t id = build_id(conn); |
| 111 | |
| 112 | switch (conn.direction_) { |
| 113 | case FACE::SOURCE: |
| 114 | { |
| 115 | OPENDDS_STRING topic_name = conn.topic_name_; |
| 116 | |
| 117 | DDS::DataWriterQos qos(TheServiceParticipant->initial_DataWriterQos()); |
| 118 | if (conn.datawriter_qos_set()) { |
| 119 | QosMap::const_iterator p = qos_map_.find(conn.datawriter_qos_name()); |
| 120 | if (p != qos_map_.end()) { |
| 121 | p->second.apply_to(qos); |
| 122 | } else { |
| 123 | ACE_ERROR((LM_ERROR, |
| 124 | ACE_TEXT("(%P|%t) ERROR: Could not find datawriterqos/%s\n"), |
| 125 | conn.datawriter_qos_name())); |
| 126 | return -1; |
| 127 | } |
| 128 | } |
no test coverage detected