LCOV - code coverage report
Current view: top level - src/esys/repo/gitstats - data.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 11 17 64.7 %
Date: 2026-08-01 10:43:40 Functions: 4 6 66.7 %

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/gitstats/data.cpp
       3             :  * \brief
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2022 Michel Gillet
       9             :  * Distributed under the MIT License.
      10             :  * (See accompanying file LICENSE.txt or
      11             :  * copy at https://opensource.org/licenses/MIT)
      12             :  *
      13             :  * __legal_e__
      14             :  * \endcond
      15             :  *
      16             :  */
      17             : 
      18             : #include "esys/repo/esysrepo_prec.h"
      19             : #include "esys/repo/gitstats/data.h"
      20             : 
      21             : namespace esys::repo::gitstats
      22             : {
      23             : 
      24           1 : Data::Data() = default;
      25             : 
      26           1 : Data::~Data() = default;
      27             : 
      28           0 : std::shared_ptr<DataYear> Data::get_year(unsigned int year)
      29             : {
      30           0 :     auto it = m_year_map.find(year);
      31             : 
      32           0 :     if (it == m_year_map.end()) return nullptr;
      33             : 
      34           0 :     return it->second;
      35             : }
      36             : 
      37           4 : std::shared_ptr<DataYear> Data::get_year_or_new(unsigned int year)
      38             : {
      39           4 :     auto it = m_year_map.find(year);
      40             : 
      41           4 :     if (it != m_year_map.end()) return it->second;
      42             : 
      43           1 :     auto year_p = std::make_shared<DataYear>(year);
      44           1 :     m_year_map[year] = year_p;
      45             : 
      46           1 :     return year_p;
      47           4 : }
      48             : 
      49           2 : std::map<unsigned int, std::shared_ptr<DataYear>> &Data::get_year_map()
      50             : {
      51           2 :     return m_year_map;
      52             : }
      53             : 
      54           0 : const std::map<unsigned int, std::shared_ptr<DataYear>> &Data::get_year_map() const
      55             : {
      56           0 :     return m_year_map;
      57             : }
      58             : 
      59             : } // namespace esys::repo::gitstats

Generated by: LCOV version 1.14