Chemical Data Processing Library C++ API - Version 1.1.1
HierarchyView.hpp
Go to the documentation of this file.
1 /*
2  * HierarchyView.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_BIOMOL_HIERARCHYVIEW_HPP
30 #define CDPL_BIOMOL_HIERARCHYVIEW_HPP
31 
32 #include <cstddef>
33 #include <vector>
34 #include <unordered_map>
35 #include <mutex>
36 #include <memory>
37 
38 #include <boost/iterator/indirect_iterator.hpp>
39 
43 
44 
45 namespace CDPL
46 {
47 
48  namespace Biomol
49  {
50 
55  {
56 
57  typedef std::shared_ptr<HierarchyViewModel> ModelPtr;
58  typedef std::vector<ModelPtr> ModelList;
59 
60  public:
64  typedef std::shared_ptr<HierarchyView> SharedPointer;
65 
66  typedef boost::indirect_iterator<ModelList::const_iterator, const HierarchyViewModel> ConstModelIterator;
67 
72 
78 
79  const ResidueList& getResidues() const;
80 
81  std::size_t getNumModels() const;
82 
83  const HierarchyViewModel& getModel(std::size_t idx) const;
84 
85  bool hasModelWithNumber(std::size_t num) const;
86 
87  const HierarchyViewModel& getModelByNumber(std::size_t num) const;
88 
90 
92 
94 
96 
101  void build(const Chem::MolecularGraph& molgraph);
102 
103  private:
104  void initModelList() const;
105 
106  typedef std::unordered_map<std::size_t, ModelPtr> IDToModelMap;
107 
108  const Chem::MolecularGraph* molGraph;
109  mutable ResidueList residues;
110  mutable ModelList models;
111  mutable IDToModelMap idToModelMap;
112  mutable bool initResidues;
113  mutable bool initModels;
114  mutable std::mutex initMutex;
115  };
116  } // namespace Biomol
117 } // namespace CDPL
118 
119 #endif // CDPL_BIOMOL_HIERARCHYVIEW_HPP
CDPL::Biomol::HierarchyViewModel
HierarchyViewModel.
Definition: HierarchyViewModel.hpp:56
CDPL::Biomol::HierarchyView::ConstModelIterator
boost::indirect_iterator< ModelList::const_iterator, const HierarchyViewModel > ConstModelIterator
Definition: HierarchyView.hpp:66
CDPL::Biomol::HierarchyView::getResidues
const ResidueList & getResidues() const
CDPL::Biomol::HierarchyView::getModelByNumber
const HierarchyViewModel & getModelByNumber(std::size_t num) const
CDPL::Biomol::HierarchyView::SharedPointer
std::shared_ptr< HierarchyView > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated HierarchyView instances.
Definition: HierarchyView.hpp:64
CDPL::Biomol::HierarchyView::getModelsBegin
ConstModelIterator getModelsBegin() const
CDPL::Biomol::HierarchyView::end
ConstModelIterator end() const
CDPL::Chem::MolecularGraph
MolecularGraph.
Definition: MolecularGraph.hpp:52
CDPL::Biomol::HierarchyView::HierarchyView
HierarchyView()
Constructs an empty HierarchyView instance.
CDPL::Biomol::HierarchyView::begin
ConstModelIterator begin() const
CDPL::Biomol::HierarchyView::hasModelWithNumber
bool hasModelWithNumber(std::size_t num) const
CDPL::Biomol::HierarchyView::HierarchyView
HierarchyView(const Chem::MolecularGraph &molgraph)
Constructs a HierarchyView instance for the molecular graph molgraph.
CDPL::Biomol::ResidueList
Implements the extraction of residues in biological macromolecules.
Definition: ResidueList.hpp:52
CDPL::Biomol::HierarchyView::getModelsEnd
ConstModelIterator getModelsEnd() const
CDPL::Biomol::HierarchyView::getNumModels
std::size_t getNumModels() const
ResidueList.hpp
Definition of the class CDPL::Biomol::ResidueList.
APIPrefix.hpp
Definition of the preprocessor macro CDPL_BIOMOL_API.
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Biomol::HierarchyView
A datastructure allowing a hierarchical view on biological macromolecules.
Definition: HierarchyView.hpp:55
CDPL_BIOMOL_API
#define CDPL_BIOMOL_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Biomol::HierarchyView::build
void build(const Chem::MolecularGraph &molgraph)
Build the hierarchy view for the molecular graph molgraph.
CDPL::Biomol::HierarchyView::getModel
const HierarchyViewModel & getModel(std::size_t idx) const
HierarchyViewModel.hpp
Definition of the class CDPL::Biomol::HierarchyViewModel.