LCOV - code coverage report
Current view: top level - pairinteraction - Iter.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 6 100.0 %
Date: 2024-04-29 00:41:50 Functions: 8 8 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2016 Sebastian Weber, Henri Menke. All rights reserved.
       3             :  *
       4             :  * This file is part of the pairinteraction library.
       5             :  *
       6             :  * The pairinteraction library is free software: you can redistribute it and/or modify
       7             :  * it under the terms of the GNU Lesser General Public License as published by
       8             :  * the Free Software Foundation, either version 3 of the License, or
       9             :  * (at your option) any later version.
      10             :  *
      11             :  * The pairinteraction library is distributed in the hope that it will be useful,
      12             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14             :  * GNU Lesser General Public License for more details.
      15             :  *
      16             :  * You should have received a copy of the GNU Lesser General Public License
      17             :  * along with the pairinteraction library. If not, see <http://www.gnu.org/licenses/>.
      18             :  */
      19             : 
      20             : #ifndef ITER_H
      21             : #define ITER_H
      22             : 
      23             : template <class ContainerType, class ValueType>
      24             : class ConstIter {
      25             : public:
      26        7460 :     ConstIter(const ContainerType *p_vec, int pos) : _pos(pos), _p_vec(p_vec) {}
      27             : 
      28    12968270 :     bool operator!=(ConstIter const &other) const { return _pos != other._pos; }
      29             : 
      30    12964540 :     ValueType operator*() const { return _p_vec->get(_pos); }
      31             : 
      32    12964540 :     ConstIter &operator++() {
      33    12964540 :         ++_pos;
      34    12964540 :         return *this;
      35             :     }
      36             : 
      37             : private:
      38             :     int _pos;
      39             :     const ContainerType *_p_vec;
      40             : };
      41             : 
      42             : #endif

Generated by: LCOV version 1.14