29 #ifndef CDPL_CHEM_SUBSTRUCTUREEDITOR_HPP
30 #define CDPL_CHEM_SUBSTRUCTUREEDITOR_HPP
35 #include <unordered_set>
37 #include <boost/iterator/transform_iterator.hpp>
53 class StereoDescriptor;
64 typedef std::vector<Pattern> PatternList;
71 typedef boost::transform_iterator<GetMolGraphFunc, PatternList::iterator>
PatternIterator;
175 bool edit(Molecule& mol,
const AtomMapping& mapping);
177 bool editAtomStereoDescriptors(Molecule& mol)
const;
178 bool editBondStereoDescriptors(Molecule& mol)
const;
180 void getExcludeMatches(
const MolecularGraph& molgraph);
182 bool createMatchedAtomAndBondMask(
const MolecularGraph& molgraph,
const AtomBondMapping& mapping,
185 Chem::Atom* getMappedAtomForID(
const AtomMapping& mapping, std::size_t
id)
const;
186 const Chem::Atom* getNeighbor(
const Atom* ctr_atom,
const Atom* excl_nbr)
const;
188 template <
typename T>
189 void copyProperty(
const T& src_cntnr,
T& tgt_cntnr,
const Base::LookupKey& key)
const;
191 template <
typename VT,
typename T>
192 bool copyPropertyWithChangeCheck(
const T& src_cntnr,
T& tgt_cntnr,
const Base::LookupKey& key)
const;
194 bool setStereoDescriptorWithChangeCheck(Atom& atom,
const StereoDescriptor& descr)
const;
195 bool setStereoDescriptorWithChangeCheck(Bond& bond,
const StereoDescriptor& descr)
const;
200 typedef std::vector<Util::BitSet*> BitSetList;
201 typedef std::vector<Atom*> AtomArray;
202 typedef std::unordered_set<Atom*> AtomSet;
203 typedef std::unordered_set<Bond*> BondSet;
205 const MolecularGraph* molGraph;
206 PatternList searchPatterns;
207 PatternList excludePatterns;
209 BitSetList excludeMatches;
210 AtomArray resPtnAtomMapping;
211 AtomSet hybStateUpdateAtoms;
212 AtomSet configUpdateAtoms;
213 BondSet configUpdateBonds;
214 BitSetCache bitSetCache;
Definition of the type CDPL::Util::BitSet.
Definition of the preprocessor macro CDPL_CHEM_API.
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of the class CDPL::Chem::MolecularGraph.
Definition of the class CDPL::Util::ObjectStack.
Definition of the class CDPL::Chem::SubstructureSearch.
An unique lookup key for control-parameter and property values.
Definition: LookupKey.hpp:54
Atom.
Definition: Atom.hpp:52
MolecularGraph.
Definition: MolecularGraph.hpp:52
std::shared_ptr< MolecularGraph > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MolecularGraph instances.
Definition: MolecularGraph.hpp:58
Molecule.
Definition: Molecule.hpp:49
SubstructureEditor.
Definition: SubstructureEditor.hpp:60
PatternIterator getExcludePatternsEnd()
ConstPatternIterator getExcludePatternsBegin() const
ConstPatternIterator getExcludePatternsEnd() const
const MolecularGraph::SharedPointer & getSearchPattern(std::size_t idx) const
const MolecularGraph::SharedPointer & getResultPattern() const
void addExcludePattern(const MolecularGraph::SharedPointer &molgraph)
Appends a new substructure exclude pattern to the current set of patterns.
boost::transform_iterator< GetMolGraphFunc, PatternList::iterator > PatternIterator
Definition: SubstructureEditor.hpp:71
void removeExcludePattern(const PatternIterator &it)
std::size_t edit(const MolecularGraph &molgraph, Molecule &res_mol)
void removeSearchPattern(std::size_t idx)
void setResultPattern(const MolecularGraph::SharedPointer &pattern)
PatternIterator getSearchPatternsBegin()
PatternIterator getSearchPatternsEnd()
PatternIterator getExcludePatternsBegin()
SubstructureEditor()
Constructs the SubstructureEditor instance.
SubstructureEditor(const SubstructureEditor &editor)
Constructs a copy of the SubstructureEditor instance editor.
~SubstructureEditor()
Destructor.
ConstPatternIterator getSearchPatternsEnd() const
void clear()
Clears the current editing result pattern and the sets of substructure search and exclude patterns.
std::shared_ptr< SubstructureEditor > SharedPointer
Definition: SubstructureEditor.hpp:68
ConstPatternIterator getSearchPatternsBegin() const
void addSearchPattern(const MolecularGraph::SharedPointer &molgraph)
Appends a new substructure search pattern to the current set of patterns.
boost::transform_iterator< GetMolGraphFunc, PatternList::const_iterator > ConstPatternIterator
Definition: SubstructureEditor.hpp:70
SubstructureEditor & operator=(const SubstructureEditor &gen)
Copies the state of the SubstructureEditor instance gen.
std::size_t getNumSearchPatterns() const
const MolecularGraph::SharedPointer & getExcludePattern(std::size_t idx) const
void clearSearchPatterns()
Clears the current set of substructuresearch patterns.
void clearExcludePatterns()
Clears the current set of substructure exclude patterns.
std::size_t getNumExcludePatterns() const
void removeExcludePattern(std::size_t idx)
void removeSearchPattern(const PatternIterator &it)
std::size_t edit(Molecule &mol)
SubstructureSearch.
Definition: SubstructureSearch.hpp:64
std::shared_ptr< SubstructureSearch > SharedPointer
Definition: SubstructureSearch.hpp:73
constexpr unsigned int T
Specifies Hydrogen (Tritium).
Definition: AtomType.hpp:67
boost::dynamic_bitset BitSet
A dynamic bitset class.
Definition: BitSet.hpp:46
The namespace of the Chemical Data Processing Library.