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

Method enable

dds/DCPS/DataReaderImpl.cpp:1101–1293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1099#endif // !defined (DDS_HAS_MINIMUM_BIT)
1100
1101DDS::ReturnCode_t
1102DataReaderImpl::enable()
1103{
1104 // According to spec:
1105 // - Calling enable on an already enabled Entity has no effect and returns OK.
1106 // - Calling enable on an Entity whose factory is not enabled will fail
1107 // and return PRECONDITION_NOT_MET.
1108
1109 if (this->is_enabled()) {
1110 return DDS::RETCODE_OK;
1111 }
1112
1113 RcHandle<SubscriberImpl> subscriber = get_subscriber_servant();
1114 if (!subscriber) {
1115 return DDS::RETCODE_ERROR;
1116 }
1117
1118 if (!subscriber->is_enabled()) {
1119 return DDS::RETCODE_PRECONDITION_NOT_MET;
1120 }
1121
1122 if (topic_servant_ && !topic_servant_->is_enabled()) {
1123 return DDS::RETCODE_PRECONDITION_NOT_MET;
1124 }
1125
1126 RcHandle<DomainParticipantImpl> participant = participant_servant_.lock();
1127 if (participant) {
1128 dp_id_ = participant->get_id();
1129 }
1130
1131 if (topic_servant_) {
1132 set_reader_effective_data_rep_qos(qos_.representation.value);
1133 if (!topic_servant_->check_data_representation(qos_.representation.value, false)) {
1134 return DDS::RETCODE_ERROR;
1135 }
1136 }
1137
1138 if (qos_.history.kind == DDS::KEEP_ALL_HISTORY_QOS) {
1139 // The spec says qos_.history.depth is "has no effect"
1140 // when history.kind = KEEP_ALL so use max_samples_per_instance
1141 depth_ = qos_.resource_limits.max_samples_per_instance;
1142
1143 } else { // qos_.history.kind == DDS::KEEP_LAST_HISTORY_QOS
1144 depth_ = qos_.history.depth;
1145 }
1146
1147 if (depth_ == DDS::LENGTH_UNLIMITED) {
1148 // DDS::LENGTH_UNLIMITED is negative so make it a positive
1149 // value that is, for all intents and purposes, unlimited
1150 // and we can use it for comparisons.
1151 // WARNING: The client risks running out of memory in this case.
1152 depth_ = ACE_INT32_MAX;
1153 }
1154
1155 if (qos_.resource_limits.max_samples != DDS::LENGTH_UNLIMITED) {
1156 n_chunks_ = static_cast<size_t>(qos_.resource_limits.max_samples);
1157 }
1158

Callers

nothing calls this directly

Calls 15

rchandle_fromFunction · 0.85
LogGuidFunction · 0.85
get_guidFunction · 0.85
is_enabledMethod · 0.80
get_discoveryMethod · 0.80
pre_readerMethod · 0.80
set_enabledMethod · 0.80
enable_transportMethod · 0.80
get_filter_class_nameMethod · 0.80
topic_nameMethod · 0.80

Tested by

no test coverage detected