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  public:
30  Sort(const SequenceRule *comparator);
31 
32  Sort(std::vector<const SequenceRule *> comparators);
33 
34  const std::vector<const SequenceRule *> &getRules() const;
35 
36  Priority prioritize(const Node *node, std::vector<Edge *> &edges,
37  bool deep = true) const;
38 
39  std::vector<std::vector<Edge *>> getGroups(
40  const std::vector<Edge *> &sorted) const;
41 
42  private:
43  const std::vector<const SequenceRule *> d_rules;
44 
45  int compareSubstituents(const Node *node, const Edge *a, const Edge *b,
46  bool deep) const;
47 }; // namespace CIPLabeler
48 
49 } // namespace CIPLabeler
50 } // 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:19