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

Method enable

dds/DCPS/DataWriterImpl.cpp:1323–1582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1321#endif // !defined (DDS_HAS_MINIMUM_BIT)
1322
1323DDS::ReturnCode_t
1324DataWriterImpl::enable()
1325{
1326 //According spec:
1327 // - Calling enable on an already enabled Entity returns OK and has no
1328 // effect.
1329 // - Calling enable on an Entity whose factory is not enabled will fail
1330 // and return PRECONDITION_NOT_MET.
1331
1332 if (this->is_enabled()) {
1333 return DDS::RETCODE_OK;
1334 }
1335
1336 RcHandle<PublisherImpl> publisher = this->publisher_servant_.lock();
1337 if (!publisher || !publisher->is_enabled()) {
1338 return DDS::RETCODE_PRECONDITION_NOT_MET;
1339 }
1340
1341 if (!topic_servant_->is_enabled()) {
1342 return DDS::RETCODE_PRECONDITION_NOT_MET;
1343 }
1344
1345 RcHandle<DomainParticipantImpl> participant = participant_servant_.lock();
1346 if (participant) {
1347 dp_id_ = participant->get_id();
1348 }
1349
1350 // Note: do configuration based on QoS in enable() because
1351 // before enable is called the QoS can be changed -- even
1352 // for Changeable=NO
1353
1354 // Configure WriteDataContainer constructor parameters from qos.
1355
1356 const bool reliable = qos_.reliability.kind == DDS::RELIABLE_RELIABILITY_QOS;
1357
1358 CORBA::Long const max_samples_per_instance =
1359 (qos_.resource_limits.max_samples_per_instance == DDS::LENGTH_UNLIMITED)
1360 ? 0x7fffffff : qos_.resource_limits.max_samples_per_instance;
1361
1362 CORBA::Long max_instances = 0, max_total_samples = 0;
1363
1364 if (qos_.resource_limits.max_samples != DDS::LENGTH_UNLIMITED) {
1365 n_chunks_ = static_cast<size_t>(qos_.resource_limits.max_samples);
1366
1367 if (qos_.resource_limits.max_instances == DDS::LENGTH_UNLIMITED ||
1368 (qos_.resource_limits.max_samples < qos_.resource_limits.max_instances)
1369 || (qos_.resource_limits.max_samples <
1370 (qos_.resource_limits.max_instances * max_samples_per_instance))) {
1371 max_total_samples = reliable ? qos_.resource_limits.max_samples : 0;
1372 }
1373 }
1374
1375 if (reliable && qos_.resource_limits.max_instances != DDS::LENGTH_UNLIMITED)
1376 max_instances = qos_.resource_limits.max_instances;
1377
1378 const CORBA::Long history_depth =
1379 (qos_.history.kind == DDS::KEEP_ALL_HISTORY_QOS ||
1380 qos_.history.depth == DDS::LENGTH_UNLIMITED) ? 0x7fffffff : qos_.history.depth;

Callers

nothing calls this directly

Calls 15

keep_countClass · 0.85
cdr_encapsulationFunction · 0.85
rchandle_fromFunction · 0.85
LogGuidFunction · 0.85
is_enabledMethod · 0.80
liveliness_factorMethod · 0.80
set_deadline_periodMethod · 0.80
get_discoveryMethod · 0.80
pre_writerMethod · 0.80

Tested by

no test coverage detected