LCOV - code coverage report
Current view: top level - src/esys/repo/manifest - group_manifest.cpp (source / functions) Hit Total Coverage
Test: esysrepo_coverage.info Lines: 19 31 61.3 %
Date: 2026-08-01 10:43:40 Functions: 7 11 63.6 %

          Line data    Source code
       1             : /*!
       2             :  * \file esys/repo/manifest/group_manifest.cpp
       3             :  * \brief
       4             :  *
       5             :  * \cond
       6             :  * __legal_b__
       7             :  *
       8             :  * Copyright (c) 2021 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/manifest/group.h"
      20             : #include "esys/repo/manifest/repository.h"
      21             : 
      22             : #include <boost/filesystem.hpp>
      23             : 
      24             : namespace esys::repo::manifest
      25             : {
      26             : 
      27           4 : Group::Group()
      28           4 :     : std::enable_shared_from_this<Group>()
      29             : {
      30           4 : }
      31             : 
      32          30 : Group::Group(const std::string &name)
      33             :     : std::enable_shared_from_this<Group>()
      34          30 :     , m_name(name)
      35             : {
      36          30 : }
      37             : 
      38          34 : Group::~Group() = default;
      39             : 
      40           4 : void Group::set_name(const std::string &name)
      41             : {
      42           4 :     m_name = name;
      43           4 : }
      44             : 
      45          70 : const std::string &Group::get_name() const
      46             : {
      47          70 :     return m_name;
      48             : }
      49             : 
      50         100 : void Group::add_repo(std::shared_ptr<Repository> repo)
      51             : {
      52         100 :     get_repos().push_back(repo);
      53         100 :     m_map_repos_by_name[repo->get_name()] = repo;
      54         100 :     m_map_repos_by_path[repo->get_path()] = repo;
      55         100 : }
      56             : 
      57         110 : std::vector<std::shared_ptr<Repository>> &Group::get_repos()
      58             : {
      59         110 :     return m_repos;
      60             : }
      61             : 
      62           0 : const std::vector<std::shared_ptr<Repository>> &Group::get_repos() const
      63             : {
      64           0 :     return m_repos;
      65             : }
      66             : 
      67           0 : std::shared_ptr<Repository> Group::find_repo_by_path(const std::string &path)
      68             : {
      69           0 :     boost::filesystem::path gen_path = path;
      70             : 
      71           0 :     auto it = m_map_repos_by_path.find(gen_path.generic_path().string());
      72             : 
      73           0 :     if (it == m_map_repos_by_path.end()) return nullptr;
      74           0 :     return it->second;
      75           0 : }
      76             : 
      77           0 : std::shared_ptr<Repository> Group::find_repo_by_name(const std::string &name)
      78             : {
      79           0 :     auto it = m_map_repos_by_name.find(name);
      80             : 
      81           0 :     if (it == m_map_repos_by_name.end()) return nullptr;
      82           0 :     return it->second;
      83             : }
      84             : 
      85             : } // namespace esys::repo::manifest

Generated by: LCOV version 1.14