LCOV - code coverage report
Current view: top level - disks2/fathom/slaves/sigma2/cgm-occ-cov/build/itaps - CGMAIterator.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 0 21 0.0 %
Date: 2020-06-30 00:58:45 Functions: 0 6 0.0 %
Branches: 0 34 0.0 %

           Branch data     Line data    Source code
       1                 :            : /**
       2                 :            :  * Copyright 2006 Sandia Corporation.  Under the terms of Contract
       3                 :            :  * DE-AC04-94AL85000 with Sandia Coroporation, the U.S. Government
       4                 :            :  * retains certain rights in this software.
       5                 :            :  * 
       6                 :            :  * This library is free software; you can redistribute it and/or
       7                 :            :  * modify it under the terms of the GNU Lesser General Public
       8                 :            :  * License as published by the Free Software Foundation; either
       9                 :            :  * version 2.1 of the License, or (at your option) any later version.
      10                 :            :  * 
      11                 :            :  */
      12                 :            : /* (2006) [email protected] */
      13                 :            : /* Renamed from TSTTGIterator to CGMAIterator - J.Kraftcheck - 2007/6/15 */
      14                 :            : 
      15                 :            : #ifndef CGMA_ITERATOR_HPP
      16                 :            : #define CGMA_ITERATOR_HPP
      17                 :            : 
      18                 :            : class RefEntity;
      19                 :            : 
      20                 :            : #include <DLIList.hpp>
      21                 :            : #include <vector>
      22                 :            : #include <algorithm>
      23                 :            : 
      24                 :          0 : class CGMAIterator
      25                 :            : {
      26                 :            : public:
      27                 :            : 
      28                 :            :   /**\brief Constructor
      29                 :            :    *
      30                 :            :    *\param list  The list of entities to iterate over
      31                 :            :    *\param size  Default query size - stored but not used by this class
      32                 :            :    */
      33                 :          0 :   CGMAIterator( DLIList<RefEntity*>& list, int size ) 
      34         [ #  # ]:          0 :     : mArray(list.size()),
      35                 :          0 :       mIter(mArray.begin()),
      36 [ #  # ][ #  # ]:          0 :       mSize(size)
                 [ #  # ]
      37                 :            :   {
      38 [ #  # ][ #  # ]:          0 :     list.copy_to( &mArray[0] );
      39                 :          0 :   }
      40                 :            :   
      41                 :            :   /**\brief Reset iterator */
      42         [ #  # ]:          0 :   void reset() { mIter = mArray.begin(); }
      43                 :            :   
      44                 :            :   /**\brief Get and step 
      45                 :            :    *
      46                 :            :    *\param array  allocated array of pointers to RefEntitys.
      47                 :            :    *              must be allocated by caller and contain at least
      48                 :            :    *              array_size entries.
      49                 :            :    *\param array_size  As input, the requested number of entries to
      50                 :            :    *              retreive and step over.  As output, either the
      51                 :            :    *              input value or a smaller value if there are insufficient
      52                 :            :    *              entries remaining.
      53                 :            :    */
      54                 :          0 :   bool next( RefEntity** array, int& array_size )
      55                 :            :   {
      56         [ #  # ]:          0 :     if (array_size <= 0) {
      57                 :          0 :       array_size = 0;
      58                 :            :     }
      59                 :            :     else {
      60 [ #  # ][ #  # ]:          0 :       std::vector<RefEntity*>::const_iterator end = mArray.end();
      61 [ #  # ][ #  # ]:          0 :       if ((end - mIter) > array_size)
      62         [ #  # ]:          0 :         end = mIter + array_size;
      63         [ #  # ]:          0 :       RefEntity** ptr = std::copy( mIter, end, array );
      64                 :          0 :       array_size = ptr - array;
      65         [ #  # ]:          0 :       mIter += array_size;
      66                 :            :     }
      67         [ #  # ]:          0 :     return mIter == mArray.end();
      68                 :            :   }
      69                 :            :  
      70                 :            :   /**\brief Get the saved default request size 
      71                 :            :    *        NOTE:  This is *not* the number of entities iterated over.
      72                 :            :    *
      73                 :            :    * Get saved default request size.  This value is saved in the
      74                 :            :    * iterator class for convenience.  It has no affect on the
      75                 :            :    * behavior of the class.  
      76                 :            :    *
      77                 :            :    * Note:  This is neither the number of entities iterated over 
      78                 :            :    *        nor the remaining number of entities.
      79                 :            :    */        
      80                 :          0 :   int size() const { return mSize; }
      81                 :            :   
      82                 :          0 :   bool at_end() const
      83         [ #  # ]:          0 :     { return mIter == mArray.end(); }
      84                 :            : 
      85                 :            : private:
      86                 :            : 
      87                 :            :   std::vector<RefEntity*> mArray;
      88                 :            :   std::vector<RefEntity*>::const_iterator mIter;
      89                 :            :   int mSize;
      90                 :            : };
      91                 :            : 
      92                 :            : #endif
      93                 :            : 

Generated by: LCOV version 1.11