Line data Source code
1 : /*! 2 : * \file esys/repo/manifest/revisionsets_manifest.cpp 3 : * \brief RevisionSets collection (ADR-0020) 4 : * 5 : * \cond 6 : * __legal_b__ 7 : * 8 : * Copyright (c) 2026 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/revisionsets.h" 20 : 21 : namespace esys::repo::manifest 22 : { 23 : 24 59 : RevisionSets::RevisionSets() = default; 25 : 26 59 : RevisionSets::~RevisionSets() = default; 27 : 28 5 : void RevisionSets::add_revision_set(std::shared_ptr<RevisionSet> revision_set) 29 : { 30 5 : get_revision_sets().push_back(revision_set); 31 5 : m_map_by_name[revision_set->get_name()] = revision_set; 32 5 : } 33 : 34 12 : std::vector<std::shared_ptr<RevisionSet>> &RevisionSets::get_revision_sets() 35 : { 36 12 : return m_revision_sets; 37 : } 38 : 39 0 : const std::vector<std::shared_ptr<RevisionSet>> &RevisionSets::get_revision_sets() const 40 : { 41 0 : return m_revision_sets; 42 : } 43 : 44 14 : std::shared_ptr<RevisionSet> RevisionSets::find_by_name(const std::string &name) const 45 : { 46 14 : auto it = m_map_by_name.find(name); 47 14 : if (it == m_map_by_name.end()) return nullptr; 48 13 : return it->second; 49 : } 50 : 51 59 : void RevisionSets::clear() 52 : { 53 59 : m_revision_sets.clear(); 54 59 : m_map_by_name.clear(); 55 59 : } 56 : 57 : } // namespace esys::repo::manifest