RDKit
Open-source cheminformatics and machine learning.
StereoGroup.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2018 T5 Informatics GmbH
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 
23 namespace RDKit {
24 class 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.
28 enum class StereoGroupType {
29  STEREO_ABSOLUTE = 0,
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:
43  StereoGroupType d_grouptype;
44  std::vector<Atom*> d_atoms;
45 
46  public:
47  StereoGroup() : d_grouptype(StereoGroupType::STEREO_ABSOLUTE), d_atoms(0u){};
48  // Takes control of atoms if possible.
49  StereoGroup(StereoGroupType grouptype, std::vector<Atom*>&& atoms);
50  StereoGroupType getGroupType() const;
51  const std::vector<Atom*>& getAtoms() const;
52  // Seems odd to have to define these, but otherwise the SWIG wrappers
53  // won't build
54  bool operator==(const StereoGroup& other) const {
55  return (d_grouptype == other.d_grouptype) && (d_atoms == other.d_atoms);
56  };
57  bool operator!=(const StereoGroup& other) const {
58  return (d_grouptype != other.d_grouptype) || (d_atoms != other.d_atoms);
59  };
60 };
62  const Atom* atom, std::vector<StereoGroup>& groups);
64  const std::vector<Atom*>& atoms, std::vector<StereoGroup>& groups);
65 
66 } // namespace RDKit
67 
68 #endif
bool operator!=(const StereoGroup &other) const
Definition: StereoGroup.h:57
#define RDKIT_GRAPHMOL_EXPORT
Definition: export.h:294
Std stuff.
Definition: Atom.h:30
RDKIT_GRAPHMOL_EXPORT void removeGroupsWithAtoms(const std::vector< Atom *> &atoms, std::vector< StereoGroup > &groups)
RDKIT_GRAPHMOL_EXPORT void removeGroupsWithAtom(const Atom *atom, std::vector< StereoGroup > &groups)
StereoGroupType
Definition: StereoGroup.h:28
The class for representing atoms.
Definition: Atom.h:69
bool operator==(const StereoGroup &other) const
Definition: StereoGroup.h:54