OpenDDS  Snapshot(2023/04/07-19:43)
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
OpenDDS::DCPS::GroupRakeData Class Reference

#include <GroupRakeData.h>

Classes

class  SortedSetCmp
 

Public Member Functions

 GroupRakeData ()
 
bool insert_sample (ReceivedDataElement *sample, ReceivedDataElementList *rdel, SubscriptionInstance_rch i, size_t index_in_instance)
 
void get_datareaders (DDS::DataReaderSeq &readers)
 
bool copy_to_user ()
 
void reset ()
 
RakeData get_data ()
 

Private Member Functions

 GroupRakeData (const GroupRakeData &)
 
GroupRakeDataoperator= (const GroupRakeData &)
 
typedef OPENDDS_MULTISET_CMP (RakeData, SortedSetCmp) SortedSet
 

Private Attributes

SortedSet sorted_
 
SortedSet::iterator current_sample_
 

Detailed Description

Rake is an abbreviation for "read or take". This class manages the results from a read() or take() operation, which are the received_data and the info_seq sequences passed in by-reference from the user.

Definition at line 33 of file GroupRakeData.h.

Constructor & Destructor Documentation

◆ GroupRakeData() [1/2]

OpenDDS::DCPS::GroupRakeData::GroupRakeData ( )

Definition at line 19 of file GroupRakeData.cpp.

20 {
21 }

◆ GroupRakeData() [2/2]

OpenDDS::DCPS::GroupRakeData::GroupRakeData ( const GroupRakeData )
private

Member Function Documentation

◆ copy_to_user()

bool OpenDDS::DCPS::GroupRakeData::copy_to_user ( )

◆ get_data()

RakeData OpenDDS::DCPS::GroupRakeData::get_data ( )

Definition at line 71 of file GroupRakeData.cpp.

References current_sample_, and OPENDDS_END_VERSIONED_NAMESPACE_DECL.

72 {
73  RakeData data = *this->current_sample_;
74  ++this->current_sample_;
75  return data;
76 }
SortedSet::iterator current_sample_
Definition: GroupRakeData.h:82

◆ get_datareaders()

void OpenDDS::DCPS::GroupRakeData::get_datareaders ( DDS::DataReaderSeq readers)

Definition at line 44 of file GroupRakeData.cpp.

References OpenDDS::DCPS::RcHandle< T >::in(), and sorted_.

Referenced by OpenDDS::DCPS::SubscriberImpl::get_datareaders().

45 {
46  ACE_UNUSED_ARG(readers);
47 #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE
48  readers.length(static_cast<CORBA::ULong>(this->sorted_.size()));
49  CORBA::ULong i = 0;
50  SortedSet::iterator itEnd = this->sorted_.end();
51  for (SortedSet::iterator it = this->sorted_.begin(); it != itEnd; ++it) {
52  RcHandle<DDS::DataReader> reader = it->si_->instance_state_->data_reader().lock();
53  if (reader) {
54  readers[i++] = DDS::DataReader::_duplicate(reader.in());
55  } else {
56  readers.length(readers.length() - 1);
57  }
58  }
59 #endif
60 }
ACE_CDR::ULong ULong

◆ insert_sample()

bool OpenDDS::DCPS::GroupRakeData::insert_sample ( ReceivedDataElement sample,
ReceivedDataElementList rdel,
SubscriptionInstance_rch  i,
size_t  index_in_instance 
)

Returns false if the sample will definitely not be part of the resulting dataset, however if this returns true it still may be excluded (due to sorting and max_samples).

Definition at line 24 of file GroupRakeData.cpp.

References current_sample_, sorted_, and OpenDDS::DCPS::ReceivedDataElement::valid_data_.

Referenced by OpenDDS::DCPS::DataReaderImpl::get_ordered_data().

28 {
29  // Ignore DISPOSE and UNREGISTER messages in case they are sent
30  // in the group coherent changes, but it shouldn't.
31  if (!sample->valid_data_) {
32  return false;
33  }
34 
35  RakeData rd = {sample, rdel, instance, index_in_instance};
36  this->sorted_.insert(rd);
37 
38  this->current_sample_ = this->sorted_.begin();
39  return true;
40 }
SortedSet::iterator current_sample_
Definition: GroupRakeData.h:82

◆ OPENDDS_MULTISET_CMP()

typedef OpenDDS::DCPS::GroupRakeData::OPENDDS_MULTISET_CMP ( RakeData  ,
SortedSetCmp   
)
private

◆ operator=()

GroupRakeData& OpenDDS::DCPS::GroupRakeData::operator= ( const GroupRakeData )
private

◆ reset()

void OpenDDS::DCPS::GroupRakeData::reset ( void  )

Definition at line 64 of file GroupRakeData.cpp.

References sorted_.

65 {
66  this->sorted_.clear();
67 }

Member Data Documentation

◆ current_sample_

SortedSet::iterator OpenDDS::DCPS::GroupRakeData::current_sample_
private

Definition at line 82 of file GroupRakeData.h.

Referenced by get_data(), and insert_sample().

◆ sorted_

SortedSet OpenDDS::DCPS::GroupRakeData::sorted_
private

Definition at line 80 of file GroupRakeData.h.

Referenced by get_datareaders(), insert_sample(), and reset().


The documentation for this class was generated from the following files: