00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #include "DCPS/DdsDcps_pch.h" //Only the _pch include should start with DCPS/ 00009 #include "dds/DCPS/GroupRakeData.h" 00010 #include "dds/DCPS/SubscriptionInstance.h" 00011 #include "dds/DCPS/DataReaderImpl.h" 00012 #include "dds/DCPS/QueryConditionImpl.h" 00013 00014 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00015 00016 namespace OpenDDS { 00017 namespace DCPS { 00018 00019 GroupRakeData::GroupRakeData() 00020 { 00021 } 00022 00023 00024 bool GroupRakeData::insert_sample(ReceivedDataElement* sample, 00025 SubscriptionInstance_rch instance, 00026 size_t index_in_instance) 00027 { 00028 // Ignore DISPOSE and UNREGISTER messages in case they are sent 00029 // in the group coherent changes, but it shouldn't. 00030 if (!sample->registered_data_) return false; 00031 00032 RakeData rd = {sample, instance, index_in_instance}; 00033 this->sorted_.insert(rd); 00034 00035 this->current_sample_ = this->sorted_.begin(); 00036 return true; 00037 } 00038 00039 00040 void 00041 GroupRakeData::get_datareaders(DDS::DataReaderSeq & readers) 00042 { 00043 ACE_UNUSED_ARG(readers); 00044 #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 00045 readers.length(static_cast<CORBA::ULong>(this->sorted_.size())); 00046 CORBA::ULong i = 0; 00047 SortedSet::iterator itEnd = this->sorted_.end(); 00048 for (SortedSet::iterator it = this->sorted_.begin(); it != itEnd; ++it) { 00049 readers[i++] = 00050 DDS::DataReader::_duplicate(it->si_->instance_state_.data_reader()); 00051 } 00052 #endif 00053 } 00054 00055 00056 void 00057 GroupRakeData::reset() 00058 { 00059 this->sorted_.clear(); 00060 } 00061 00062 00063 RakeData 00064 GroupRakeData::get_data() 00065 { 00066 RakeData data = *this->current_sample_; 00067 ++this->current_sample_; 00068 return data; 00069 } 00070 00071 } // namespace DCPS 00072 } // namespace OpenDDS 00073 00074 OPENDDS_END_VERSIONED_NAMESPACE_DECL