LCOV - code coverage report
Current view: top level - alg/viewshed - combiner.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 6 6 100.0 %
Date: 2024-11-21 22:18:42 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  * (c) 2024 info@hobu.co
       3             :  *
       4             :  * SPDX-License-Identifier: MIT
       5             :  ****************************************************************************/
       6             : 
       7             : #ifndef VIEWSHED_COMBINER_H_INCLUDED
       8             : #define VIEWSHED_COMBINER_H_INCLUDED
       9             : 
      10             : #include "cumulative.h"
      11             : #include "viewshed_types.h"
      12             : 
      13             : namespace gdal
      14             : {
      15             : namespace viewshed
      16             : {
      17             : 
      18             : /// Reads completed viewshed rasters and sums them together. When the
      19             : /// summed values may exceed the 8-bit limit, push it on the output
      20             : /// queue.
      21             : class Combiner
      22             : {
      23             :   public:
      24             :     /// Constructor
      25             :     /// @param inputQueue  Reference to input queue of datasets
      26             :     /// @param outputQueue  Reference to output queue of datasets
      27           1 :     Combiner(Cumulative::DatasetQueue &inputQueue,
      28             :              Cumulative::DatasetQueue &outputQueue)
      29           1 :         : m_inputQueue(inputQueue), m_outputQueue(outputQueue)
      30             :     {
      31           1 :     }
      32             : 
      33             :     /// Copy ctor. Allows initialization in a vector of Combiners.
      34             :     /// @param src  Source Combiner.
      35             :     // cppcheck-suppress missingMemberCopy
      36           3 :     Combiner(const Combiner &src)
      37           3 :         : m_inputQueue(src.m_inputQueue), m_outputQueue(src.m_outputQueue)
      38             :     {
      39           3 :     }
      40             : 
      41             :     void queueOutputBuffer();
      42             :     void run();
      43             : 
      44             :   private:
      45             :     Cumulative::DatasetQueue &m_inputQueue;
      46             :     Cumulative::DatasetQueue &m_outputQueue;
      47             :     DatasetPtr m_dataset{};
      48             :     size_t m_count{0};
      49             : 
      50             :     void sum(DatasetPtr srcDs);
      51             : };
      52             : 
      53             : }  // namespace viewshed
      54             : }  // namespace gdal
      55             : 
      56             : #endif

Generated by: LCOV version 1.14