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

Method enable

dds/DCPS/ReplayerImpl.cpp:296–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296DDS::ReturnCode_t
297ReplayerImpl::enable()
298{
299 //According spec:
300 // - Calling enable on an already enabled Entity returns OK and has no
301 // effect.
302 // - Calling enable on an Entity whose factory is not enabled will fail
303 // and return PRECONDITION_NOT_MET.
304
305 if (this->is_enabled()) {
306 return DDS::RETCODE_OK;
307 }
308
309 // if (!this->publisher_servant_->is_enabled()) {
310 // return DDS::RETCODE_PRECONDITION_NOT_MET;
311 // }
312 //
313 const bool reliable = qos_.reliability.kind == DDS::RELIABLE_RELIABILITY_QOS;
314
315 if (qos_.resource_limits.max_samples != DDS::LENGTH_UNLIMITED) {
316 n_chunks_ = static_cast<size_t>(qos_.resource_limits.max_samples);
317 }
318 // +1 because we might allocate one before releasing another
319 // TBD - see if this +1 can be removed.
320 mb_allocator_.reset(new MessageBlockAllocator(n_chunks_ * association_chunk_multiplier_));
321 db_allocator_.reset(new DataBlockAllocator(n_chunks_+1));
322 header_allocator_.reset(new DataSampleHeaderAllocator(n_chunks_+1));
323
324 sample_list_element_allocator_.reset(new DataSampleElementAllocator(2 * n_chunks_));
325
326
327 if (DCPS_debug_level >= 2) {
328 ACE_DEBUG((LM_DEBUG,
329 "(%P|%t) ReplayerImpl::enable-mb"
330 " Cached_Allocator_With_Overflow %x with %d chunks\n",
331 mb_allocator_.get(),
332 n_chunks_));
333
334 ACE_DEBUG((LM_DEBUG,
335 "(%P|%t) ReplayerImpl::enable-db"
336 " Cached_Allocator_With_Overflow %x with %d chunks\n",
337 db_allocator_.get(),
338 n_chunks_));
339
340 ACE_DEBUG((LM_DEBUG,
341 "(%P|%t) ReplayerImpl::enable-header"
342 " Cached_Allocator_With_Overflow %x with %d chunks\n",
343 header_allocator_.get(),
344 n_chunks_));
345 }
346
347 this->set_enabled();
348
349 try {
350 this->enable_transport(reliable,
351 this->qos_.durability.kind > DDS::VOLATILE_DURABILITY_QOS, participant_servant_->get_id());
352
353 } catch (const Transport::Exception&) {

Callers

nothing calls this directly

Calls 12

cdr_encapsulationFunction · 0.85
rchandle_fromFunction · 0.85
is_enabledMethod · 0.80
set_enabledMethod · 0.80
enable_transportMethod · 0.80
get_discoveryMethod · 0.80
resetMethod · 0.45
getMethod · 0.45
get_idMethod · 0.45
add_publicationMethod · 0.45

Tested by

no test coverage detected