RDKit
Open-source cheminformatics and machine learning.
StereoGroup.h
Go to the documentation of this file.
1//
2// Copyright (C) 2018-2021 Greg Landrum and other RDKit contributors
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10/*! \file StereoGroup.h
11
12 \brief Defines the class StereoGroup which stores relationships between
13 the absolute configurations of atoms within a structure.
14
15*/
16
17#include <RDGeneral/export.h>
18#ifndef RD_StereoGroup_092018
19#define RD_StereoGroup_092018
20
21#include <vector>
22
23namespace RDKit {
24class Atom;
25
26// OR means that it is known to be one or the other, but not both
27// AND means that it is known to be a mix.
28enum class StereoGroupType {
30 STEREO_OR = 1,
31 STEREO_AND = 2
32};
33
34//! StereoGroup is a collection of atoms with a known stereochemical
35//! relationship
36/*!
37 Used to help represent a sample with unknown stereochemistry, or that is a mix
38 of diastereomers.
39
40 */
42 private:
44 std::vector<Atom*> d_atoms;
45
46 public:
47 StereoGroup() : d_atoms(0u) {}
48 // Takes control of atoms if possible.
49 StereoGroup(StereoGroupType grouptype, std::vector<Atom*>&& atoms);
50 StereoGroup(StereoGroupType grouptype, const std::vector<Atom*>& atoms);
51 StereoGroup(const StereoGroup& other) = default;
52 StereoGroup& operator=(const StereoGroup& other) = default;
53 StereoGroup(StereoGroup&& other) = default;
54 StereoGroup& operator=(StereoGroup&& other) = default;
55
57 const std::vector<Atom*>& getAtoms() const;
58 // Seems odd to have to define these, but otherwise the SWIG wrappers
59 // won't build
60 bool operator==(const StereoGroup& other) const {
61 return (d_grouptype == other.d_grouptype) && (d_atoms == other.d_atoms);
62 }
63 bool operator!=(const StereoGroup& other) const {
64 return (d_grouptype != other.d_grouptype) || (d_atoms != other.d_atoms);
65 }
66};
68 const Atom* atom, std::vector<StereoGroup>& groups);
70 const std::vector<Atom*>& atoms, std::vector<StereoGroup>& groups);
71
72} // namespace RDKit
73
74#endif
The class for representing atoms.
Definition: Atom.h:68
StereoGroup & operator=(const StereoGroup &other)=default
StereoGroup & operator=(StereoGroup &&other)=default
StereoGroup(StereoGroupType grouptype, std::vector< Atom * > &&atoms)
StereoGroup(const StereoGroup &other)=default
StereoGroupType getGroupType() const
StereoGroup(StereoGroup &&other)=default
bool operator==(const StereoGroup &other) const
Definition: StereoGroup.h:60
StereoGroup(StereoGroupType grouptype, const std::vector< Atom * > &atoms)
bool operator!=(const StereoGroup &other) const
Definition: StereoGroup.h:63
const std::vector< Atom * > & getAtoms() const
#define RDKIT_GRAPHMOL_EXPORT
Definition: export.h:217
Std stuff.
Definition: Abbreviations.h:18
StereoGroupType
Definition: StereoGroup.h:28
RDKIT_GRAPHMOL_EXPORT void removeGroupsWithAtom(const Atom *atom, std::vector< StereoGroup > &groups)
RDKIT_GRAPHMOL_EXPORT void removeGroupsWithAtoms(const std::vector< Atom * > &atoms, std::vector< StereoGroup > &groups)