RDKit
Open-source cheminformatics and machine learning.
Sort.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 <vector>
14 #include "Priority.h"
15 
16 namespace RDKit {
17 namespace CIPLabeler {
18 
19 class SequenceRule;
20 class Edge;
21 class Node;
22 
23 /**
24  * A simple insertion sort for substituents. The number of substituents is not
25  * likely to be large enough that doing a merge sort would make a difference
26  *
27  */
28 class Sort {
29 
30 public:
31  Sort(const SequenceRule *comparator);
32 
33  Sort(std::vector<const SequenceRule *> comparators);
34 
35  const std::vector<const SequenceRule *> &getRules() const;
36 
37  Priority prioritize(const Node *node, std::vector<Edge *> &edges,
38  bool deep = true) const;
39 
40  std::vector<std::vector<Edge *>>
41  getGroups(const std::vector<Edge *> &sorted) const;
42 
43 private:
44  const std::vector<const SequenceRule *> d_rules;
45 
46  int compareSubstituents(const Node *node, const Edge *a, const Edge *b,
47  bool deep) const;
48 }; // namespace CIPLabeler
49 
50 } // namespace CIPLabeler
51 } // namespace RDKit
std::vector< std::vector< Edge * > > getGroups(const std::vector< Edge * > &sorted) const
const std::vector< const SequenceRule * > & getRules() const
Sort(std::vector< const SequenceRule * > comparators)
Priority prioritize(const Node *node, std::vector< Edge * > &edges, bool deep=true) const
Sort(const SequenceRule *comparator)
Std stuff.
Definition: Abbreviations.h:17