MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / init

Method init

dds/DCPS/MultiTopicDataReaderBase.cpp:91–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89namespace DCPS {
90
91void MultiTopicDataReaderBase::init(const DDS::DataReaderQos& dr_qos,
92 DDS::DataReaderListener_ptr a_listener, DDS::StatusMask mask,
93 SubscriberImpl* parent, MultiTopicImpl* multitopic)
94{
95 using namespace std;
96 DDS::DataReader_var dr = multitopic->get_type_support()->create_datareader();
97 resulting_reader_ = DataReaderEx::_narrow(dr);
98 DataReaderImpl* resulting_impl =
99 dynamic_cast<DataReaderImpl*>(resulting_reader_.in());
100
101 if (!resulting_impl) {
102 ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: MultiTopicDataReaderBase::init: ")
103 ACE_TEXT("Failed to get DataReaderImpl.\n")));
104 return;
105 }
106
107 resulting_impl->enable_multi_topic(multitopic);
108 resulting_impl->raw_latency_buffer_size() = parent->raw_latency_buffer_size();
109 resulting_impl->raw_latency_buffer_type() = parent->raw_latency_buffer_type();
110
111 DDS::DomainParticipant_var participant = parent->get_participant();
112 DomainParticipantImpl* dpi = dynamic_cast<DomainParticipantImpl*>(participant.in());
113 if (!dpi) {
114 ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: MultiTopicDataReaderBase::init: ")
115 ACE_TEXT("Failed to get DomainParticipantImpl.\n")));
116 return;
117 }
118 resulting_impl->init(multitopic, dr_qos, a_listener, mask, dpi, parent);
119
120 init_typed(resulting_reader_);
121
122 std::map<OPENDDS_STRING, OPENDDS_STRING> fieldToTopic;
123
124 // key: name of field that's a key for the 'join'
125 // mapped: set of topicNames that have this key in common
126 std::map<OPENDDS_STRING, set<OPENDDS_STRING> > joinKeys;
127
128 listener_.reset(new Listener(this));
129
130 const vector<OPENDDS_STRING>& selection = multitopic->get_selection();
131 for (size_t i = 0; i < selection.size(); ++i) {
132
133 const DDS::Duration_t no_wait = {0, 0};
134 DDS::Topic_var t = participant->find_topic(selection[i].c_str(), no_wait);
135 if (!t.in()) {
136 throw runtime_error("Topic: " + selection[i] + " not found.");
137 }
138
139
140 QueryPlan& qp = query_plans_[selection[i]];
141 {
142 ACE_WRITE_GUARD(ACE_RW_Thread_Mutex, write_guard, qp_lock_);
143 qp.data_reader_ =
144 parent->create_datareader(t, DATAREADER_QOS_USE_TOPIC_QOS,
145 listener_.get(), ALL_STATUS_MASK);
146 }
147 if (!qp.data_reader_.in()) {
148 throw runtime_error("Could not create incoming DataReader "

Callers

nothing calls this directly

Calls 15

MatchesIncomingNameClass · 0.85
enable_multi_topicMethod · 0.80
getFieldNamesMethod · 0.80
SubjectFieldSpecClass · 0.70
create_datareaderMethod · 0.45
get_type_supportMethod · 0.45
inMethod · 0.45
get_participantMethod · 0.45
resetMethod · 0.45
sizeMethod · 0.45
find_topicMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected