LCOV - code coverage report
Current view: top level - DCPS - GroupRakeData.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 5 0.0 %
Date: 2023-04-30 01:32:43 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /*
       2             :  * Distributed under the OpenDDS License.
       3             :  * See: http://www.opendds.org/license.html
       4             :  */
       5             : 
       6             : #ifndef OPENDDS_DCPS_GROUPRAKEDATA_H
       7             : #define OPENDDS_DCPS_GROUPRAKEDATA_H
       8             : 
       9             : #include <ace/config-macros.h>
      10             : #ifndef ACE_LACKS_PRAGMA_ONCE
      11             : #  pragma once
      12             : #endif
      13             : 
      14             : #include "RakeData.h"
      15             : #include "Comparator_T.h"
      16             : #include "PoolAllocator.h"
      17             : #include "dcps_export.h"
      18             : 
      19             : #include <dds/DdsDcpsSubscriptionC.h>
      20             : #include <dds/DdsDcpsInfrastructureC.h>
      21             : 
      22             : OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL
      23             : 
      24             : namespace OpenDDS {
      25             : namespace DCPS {
      26             : 
      27             : /// Rake is an abbreviation for "read or take".  This class manages the
      28             : /// results from a read() or take() operation, which are the received_data
      29             : /// and the info_seq sequences passed in by-reference from the user.
      30             : class OpenDDS_Dcps_Export GroupRakeData {
      31             : public:
      32             :   GroupRakeData();
      33             : 
      34             :   /// Returns false if the sample will definitely not be part of the
      35             :   /// resulting dataset, however if this returns true it still may be
      36             :   /// excluded (due to sorting and max_samples).
      37             :   bool insert_sample(ReceivedDataElement* sample,
      38             :                      ReceivedDataElementList* rdel,
      39             :                      SubscriptionInstance_rch i,
      40             :                      size_t index_in_instance);
      41             : 
      42             :   void get_datareaders (DDS::DataReaderSeq & readers);
      43             : 
      44             :   bool copy_to_user();
      45             : 
      46             :   void reset ();
      47             : 
      48             :   RakeData get_data ();
      49             : 
      50             : private:
      51             : 
      52             : 
      53             :   GroupRakeData(const GroupRakeData&); // no copy construction
      54             :   GroupRakeData& operator=(const GroupRakeData&); // no assignment
      55             : 
      56             :   class SortedSetCmp {
      57             :   public:
      58           0 :     bool operator()(const RakeData& lhs, const RakeData& rhs) const {
      59           0 :       if (!cmp_.in()) {
      60             :         // The following assumes that if no comparator is set
      61             :         // then BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS is used.
      62           0 :         return lhs.rde_->source_timestamp_ < rhs.rde_->source_timestamp_;
      63             :       }
      64             : 
      65           0 :       return false;
      66             :     }
      67           0 :     SortedSetCmp(){}
      68             :     explicit SortedSetCmp(ComparatorBase::Ptr cmp) : cmp_(cmp){}
      69             : 
      70             :   private:
      71             :     ComparatorBase::Ptr cmp_;
      72             :   };
      73             : 
      74             :   typedef OPENDDS_MULTISET_CMP(RakeData, SortedSetCmp) SortedSet;
      75             : 
      76             :   // Contains data for QueryCondition/Ordered access
      77             :   SortedSet sorted_;
      78             : 
      79             :   SortedSet::iterator current_sample_;
      80             : };
      81             : 
      82             : } // namespace DCPS
      83             : } // namespace OpenDDS
      84             : 
      85             : OPENDDS_END_VERSIONED_NAMESPACE_DECL
      86             : 
      87             : #endif /* GROUPRAKEDATA_H  */

Generated by: LCOV version 1.16