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 namespace OpenDDS { 00015 namespace DCPS { 00016 00017 GroupRakeData::GroupRakeData() 00018 { 00019 } 00020 00021 00022 bool GroupRakeData::insert_sample(ReceivedDataElement* sample, 00023 SubscriptionInstance* instance, 00024 size_t index_in_instance) 00025 { 00026 // Ignore DISPOSE and UNREGISTER messages in case they are sent 00027 // in the group coherent changes, but it shouldn't. 00028 if (!sample->registered_data_) return false; 00029 00030 RakeData rd = {sample, instance, index_in_instance}; 00031 this->sorted_.insert(rd); 00032 00033 this->current_sample_ = this->sorted_.begin(); 00034 return true; 00035 } 00036 00037 00038 void 00039 GroupRakeData::get_datareaders(DDS::DataReaderSeq & readers) 00040 { 00041 ACE_UNUSED_ARG(readers); 00042 #ifndef OPENDDS_NO_OBJECT_MODEL_PROFILE 00043 readers.length(static_cast<CORBA::ULong>(this->sorted_.size())); 00044 int i = 0; 00045 SortedSet::iterator itEnd = this->sorted_.end(); 00046 for (SortedSet::iterator it = this->sorted_.begin(); it != itEnd; ++it) { 00047 readers[i++] = 00048 DDS::DataReader::_duplicate(it->si_->instance_state_.data_reader()); 00049 } 00050 #endif 00051 } 00052 00053 00054 void 00055 GroupRakeData::reset() 00056 { 00057 this->sorted_.clear(); 00058 } 00059 00060 00061 RakeData 00062 GroupRakeData::get_data() 00063 { 00064 RakeData data = *this->current_sample_; 00065 ++this->current_sample_; 00066 return data; 00067 } 00068 00069 } // namespace DCPS 00070 } // namespace OpenDDS