Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
StereopermutatorList.h
Go to the documentation of this file.
1 
11 #ifndef INCLUDE_MOLASSEMBLER_STEREOPERMUTATOR_LIST_H
12 #define INCLUDE_MOLASSEMBLER_STEREOPERMUTATOR_LIST_H
13 
14 #include "Molassembler/Types.h"
16 
17 #include "boost/optional/optional_fwd.hpp"
18 #include <memory>
19 #include <vector>
20 
21 namespace Scine {
22 namespace Molassembler {
23 
24 class AtomStereopermutator;
25 class BondStereopermutator;
26 
30 class MASM_EXPORT StereopermutatorList {
31 private:
32  struct Impl;
33 
34 public:
37  template<typename Permutator>
38  class iterator {
39  public:
40  static_assert(
41  std::is_same<std::decay_t<Permutator>, AtomStereopermutator>::value
42  || std::is_same<std::decay_t<Permutator>, BondStereopermutator>::value,
43  "This type may not be instantiated for any type other than atom and bond stereopermutators"
44  );
45 
46  using iterator_category = std::forward_iterator_tag;
47  using difference_type = std::ptrdiff_t;
48  using value_type = Permutator;
49  using pointer = Permutator*;
50  using reference = Permutator&;
51 
52  iterator(iterator&& other) noexcept;
53  iterator& operator = (iterator&& other) noexcept;
54  iterator(const iterator& other);
55  iterator& operator = (const iterator& other);
56  ~iterator();
57 
58  iterator();
59 
60  using ImplType = std::conditional_t<
61  std::is_const<Permutator>::value,
64  >;
65  iterator(ImplType impl, bool begin);
66 
67  iterator& operator ++ ();
68  iterator operator ++ (int);
69  reference operator * () const;
70 
71  bool operator == (const iterator& other) const;
72  bool operator != (const iterator& other) const;
73 
74  private:
75  struct Impl;
76  std::unique_ptr<Impl> impl_;
77  };
78 
84 
89  StereopermutatorList& operator = (StereopermutatorList&& other) noexcept;
91  StereopermutatorList& operator = (const StereopermutatorList& other);
94 
97 
105 
113  BondStereopermutator& at(const BondIndex& index);
120  AtomStereopermutator& add(AtomStereopermutator stereopermutator);
121 
128  BondStereopermutator& add(BondStereopermutator stereopermutator);
129 
137  void applyPermutation(const std::vector<AtomIndex>& permutation);
138 
143  void clear();
144 
149  void clearBonds();
150 
155  boost::optional<AtomStereopermutator&> option(AtomIndex index);
156 
161  boost::optional<BondStereopermutator&> option(const BondIndex& edge);
162 
171  void propagateVertexRemoval(AtomIndex removedIndex);
172 
178  bool remove(AtomIndex index);
179 
185  bool remove(const BondIndex& edge);
186 
191  [[deprecated("Prefer remove")]]
192  void try_remove(AtomIndex index);
193 
198  [[deprecated("Prefer remove")]]
199  void try_remove(const BondIndex& edge);
201 
204 
211  const AtomStereopermutator& at(AtomIndex index) const;
212 
220  const BondStereopermutator& at(const BondIndex& index) const;
221 
226  bool compare(
227  const StereopermutatorList& other,
228  AtomEnvironmentComponents componentBitmask
229  ) const;
230 
235  bool empty() const;
236 
241  bool hasZeroAssignmentStereopermutators() const;
242 
247  bool hasUnassignedStereopermutators() const;
248 
253  boost::optional<const AtomStereopermutator&> option(AtomIndex index) const;
254 
259  boost::optional<const BondStereopermutator&> option(const BondIndex& edge) const;
260 
265  unsigned A() const;
266 
271  unsigned B() const;
272 
277  unsigned size() const;
279 
282 
286  IteratorRange<AtomStereopermutatorIterator> atomStereopermutators();
287 
292  IteratorRange<AtomStereopermutatorConstIterator> atomStereopermutators() const;
293 
298  IteratorRange<BondStereopermutatorIterator> bondStereopermutators();
299 
304  IteratorRange<BondStereopermutatorConstIterator> bondStereopermutators() const;
306 
309 
313  bool operator == (const StereopermutatorList& other) const;
315  bool operator != (const StereopermutatorList& other) const;
317 
318 private:
319  std::unique_ptr<Impl> impl_;
320 };
321 
322 } // namespace Molassembler
323 } // namespace Scine
324 #endif
Defines basic types widely shared across the project.
auto at(Container &&container)
Make functor calling at on arguments.
Definition: Functor.h:58
unsigned size(Shape shape)
Fetch the number of vertices of a shape.
AtomEnvironmentComponents
For bitmasks grouping components of immediate atom environments.
Definition: Types.h:103
Handles the steric permutation of substituents of a non-terminal central atom.
Definition: AtomStereopermutator.h:79
void remove(Container &container, const T &value)
Applies erase-remove idiom in-place to container.
Definition: Functional.h:289
Homogeneous pair of iterators with begin and end member fns.
Definition: IteratorRange.h:26
Handles specific relative arrangements of two atom stereopermutators joined by a bond.
Definition: BondStereopermutator.h:46
Manages all stereopermutators that are part of a Molecule.
Definition: StereopermutatorList.h:30
Range type.
std::size_t AtomIndex
Unsigned integer atom index type. Used to refer to particular atoms.
Definition: Types.h:51
Permutation applyPermutation(const Permutation &occupation, const Permutation &permutation)
Rotates a passed list of indices with a specified rotation vector.
Type used to refer to particular bonds. Orders first &lt; second.
Definition: Types.h:54
Definition: StereopermutatorList.h:38
Definition: StereopermutatorListImpl.h:19