Line data Source code
1 : /* 2 : * 3 : * 4 : * Distributed under the OpenDDS License. 5 : * See: http://www.opendds.org/license.html 6 : */ 7 : 8 : #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/ 9 : #include "GroupRakeData.h" 10 : #include "SubscriptionInstance.h" 11 : #include "DataReaderImpl.h" 12 : #include "QueryConditionImpl.h" 13 : 14 : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 15 : 16 : namespace OpenDDS { 17 : namespace DCPS { 18 : 19 0 : GroupRakeData::GroupRakeData() 20 : { 21 0 : } 22 : 23 : 24 0 : bool GroupRakeData::insert_sample(ReceivedDataElement* sample, 25 : ReceivedDataElementList* rdel, 26 : SubscriptionInstance_rch instance, 27 : size_t index_in_instance) 28 : { 29 : // Ignore DISPOSE and UNREGISTER messages in case they are sent 30 : // in the group coherent changes, but it shouldn't. 31 0 : if (!sample->valid_data_) { 32 0 : return false; 33 : } 34 : 35 0 : RakeData rd = {sample, rdel, instance, index_in_instance}; 36 0 : this->sorted_.insert(rd); 37 : 38 0 : this->current_sample_ = this->sorted_.begin(); 39 0 : return true; 40 0 : } 41 : 42 : 43 : void 44 0 : GroupRakeData::get_datareaders(DDS::DataReaderSeq & readers) 45 : { 46 : ACE_UNUSED_ARG(readers); 47 : #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 48 0 : readers.length(static_cast<CORBA::ULong>(this->sorted_.size())); 49 0 : CORBA::ULong i = 0; 50 0 : SortedSet::iterator itEnd = this->sorted_.end(); 51 0 : for (SortedSet::iterator it = this->sorted_.begin(); it != itEnd; ++it) { 52 0 : RcHandle<DDS::DataReader> reader = it->si_->instance_state_->data_reader().lock(); 53 0 : if (reader) { 54 0 : readers[i++] = DDS::DataReader::_duplicate(reader.in()); 55 : } else { 56 0 : readers.length(readers.length() - 1); 57 : } 58 0 : } 59 : #endif 60 0 : } 61 : 62 : 63 : void 64 0 : GroupRakeData::reset() 65 : { 66 0 : this->sorted_.clear(); 67 0 : } 68 : 69 : 70 : RakeData 71 0 : GroupRakeData::get_data() 72 : { 73 0 : RakeData data = *this->current_sample_; 74 0 : ++this->current_sample_; 75 0 : return data; 76 : } 77 : 78 : } // namespace DCPS 79 : } // namespace OpenDDS 80 : 81 : OPENDDS_END_VERSIONED_NAMESPACE_DECL