RDKit: SequenceRule.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
SequenceRule.h
Go to the documentation of this file.
1//
2//
3// Copyright (C) 2020 Schrödinger, LLC
4//
5// @@ All Rights Reserved @@
6// This file is part of the RDKit.
7// The contents are covered by the terms of the BSD license
8// which is included in the file license.txt, found at the root
9// of the RDKit source tree.
10//
11#pragma once
12
13#include <stdexcept>
14#include <memory>
15#include <vector>
16#include "../CIPLabeler.h"
17
18#include "../Descriptor.h"
19#include "../Edge.h"
20#include "../Node.h"
21#include "../Sort.h"
22#include "Pairlist.h"
23
24namespace RDKit {
25namespace CIPLabeler {
26
27class CIPMol;
28
29namespace {
30template <typename T>
31inline int three_way_comparison(const T &x, const T &y) {
32 return x < y ? -1 : (x == y ? 0 : 1);
33}
34} // namespace
35
36 class SequenceRule {
37 public:
38 SequenceRule();
39
40 virtual ~SequenceRule();
41
42 Descriptor getBondLabel(const Edge *edge) const;
43
44 int getComparision(const Edge *a, const Edge *b) const;
45
46 virtual int getComparision(const Edge *a, const Edge *b, bool deep) const;
47
48 virtual const Sort *getSorter() const;
49
50 int recursiveCompare(const Edge *a, const Edge *b) const;
51
52 void setSorter(const Sort *sorter);
53
54 Priority sort(const Node *node, std::vector<Edge *> &edges, bool deep) const;
55
56 Priority sort(const Node *node, std::vector<Edge *> &edges) const;
57
58 virtual int compare(const Edge *a, const Edge *b) const = 0;
59
60 protected:
61 std::unique_ptr<const Sort> dp_sorter = nullptr;
62
63 private:
64 bool areUpEdges(Node *aNode, Node *bNode, Edge *aEdge, Edge *bEdge) const;
65};
66
67} // namespace CIPLabeler
68} // namespace RDKit
CIPLabeler.h
Descriptor.h
Edge.h
Node.h
Pairlist.h
Sort.h
RDKit::CIPLabeler::CIPMol
Definition CIPMol.h:66
RDKit::CIPLabeler::Edge
Definition Edge.h:23
RDKit::CIPLabeler::Node
Definition Node.h:27
RDKit::CIPLabeler::Priority
Definition Priority.h:21
RDKit::CIPLabeler::SequenceRule::recursiveCompare
int recursiveCompare(const Edge *a, const Edge *b) const
RDKit::CIPLabeler::SequenceRule::~SequenceRule
virtual ~SequenceRule()
RDKit::CIPLabeler::SequenceRule::getComparision
int getComparision(const Edge *a, const Edge *b) const
RDKit::CIPLabeler::SequenceRule::getSorter
virtual const Sort * getSorter() const
RDKit::CIPLabeler::SequenceRule::getBondLabel
Descriptor getBondLabel(const Edge *edge) const
RDKit::CIPLabeler::SequenceRule::getComparision
virtual int getComparision(const Edge *a, const Edge *b, bool deep) const
RDKit::CIPLabeler::SequenceRule::dp_sorter
std::unique_ptr< const Sort > dp_sorter
Definition SequenceRule.h:61
RDKit::CIPLabeler::SequenceRule::compare
virtual int compare(const Edge *a, const Edge *b) const =0
RDKit::CIPLabeler::SequenceRule::sort
Priority sort(const Node *node, std::vector< Edge * > &edges, bool deep) const
RDKit::CIPLabeler::SequenceRule::sort
Priority sort(const Node *node, std::vector< Edge * > &edges) const
RDKit::CIPLabeler::SequenceRule::setSorter
void setSorter(const Sort *sorter)
RDKit::CIPLabeler::SequenceRule::SequenceRule
SequenceRule()
RDKit::CIPLabeler::Sort
Definition Sort.h:28
RDKit::CIPLabeler
Definition CIPLabeler.h:27
RDKit::CIPLabeler::Descriptor
Descriptor
Definition Descriptor.h:25
RDKit
Std stuff.
Definition Abbreviations.h:19