RDKit: Node.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Node.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
15#include "Descriptor.h"
16#include "Mancude.h"
17#include "Edge.h"
18
19namespace RDKit {
20
21class Atom;
22
23namespace CIPLabeler {
24
25class Digraph;
26
27 class Node {
28 public:
29 /**
30 * Flag indicates whether the node has been expanded.
31 */
32 static const int EXPANDED = 0x1;
33
34 /**
35 * Flag indicates whether the node was duplicated
36 * at a ring closure.
37 */
38 static const int RING_DUPLICATE = 0x2;
39
40 /**
41 * Flag indicates whether the node was duplicated
42 * at a bond with order &gt; 1.
43 */
44 static const int BOND_DUPLICATE = 0x4;
45
46 /**
47 * Mask to check if a node is duplicated.
48 */
49
50 static const int DUPLICATE = RING_DUPLICATE | BOND_DUPLICATE;
51
52 /**
53 * Node was created for an implicit hydrogen,
54 * the 'atom' value will be null.
55 */
56 static const int IMPL_HYDROGEN = 0x8;
57
58 /**
59 * Mask to check if a node is duplicated or created for an implicit H (not a
60 * primary node).
61 */
62 static const int DUPLICATE_OR_H =
63 RING_DUPLICATE | BOND_DUPLICATE | IMPL_HYDROGEN;
64
65 Node() = delete;
66 Node(const Node &) = delete;
67 Node &operator=(const Node &) = delete;
68
69 Node(Digraph *g, std::vector<char> &&visit, Atom *atom,
70 boost::rational<int> &&frac, int dist, int flags);
71
72 Digraph *getDigraph() const;
73
74 Atom *getAtom() const;
75
76 unsigned int getAtomIdx() const;
77
78 int getDistance() const;
79
80 boost::rational<int> getAtomicNumFraction() const;
81
82 int getAtomicNum() const;
83
84 unsigned getMassNum() const;
85
86 double getAtomicMass() const;
87
88 Descriptor getAux() const;
89
90 bool isSet(int mask) const;
91
92 bool isDuplicate() const;
93
94 bool isDuplicateOrH() const;
95
96 bool isTerminal() const;
97
98 bool isExpanded() const;
99
100 bool isVisited(int idx) const;
101
102 Node *newChild(int idx, Atom *atom) const;
103
104 Node *newBondDuplicateChild(int idx, Atom *atom) const;
105
106 Node *newRingDuplicateChild(int idx, Atom *atom) const;
107
108 Node *newImplicitHydrogenChild() const;
109
110 void add(Edge *e);
111
112 void setAux(Descriptor desc);
113
114 const std::vector<Edge *> &getEdges() const;
115
116 std::vector<Edge *> getEdges(Atom *end) const;
117
118 std::vector<Edge *> getNonTerminalOutEdges() const;
119
120 private:
121 Digraph *dp_g;
122 Atom *dp_atom;
123 int d_dist;
124 boost::rational<int> d_atomic_num;
125 double d_atomic_mass;
126 Descriptor d_aux = Descriptor::NONE;
127 int d_flags = 0x0;
128
129 std::vector<Edge *> d_edges;
130
131 std::vector<char> d_visit;
132
133 Node *newTerminalChild(int idx, Atom *atom, int flags) const;
134};
135
136} // namespace CIPLabeler
137} // namespace RDKit
Descriptor.h
Edge.h
Mancude.h
RDKit::Atom
The class for representing atoms.
Definition Atom.h:74
RDKit::CIPLabeler::Digraph
Definition Digraph.h:48
RDKit::CIPLabeler::Edge
Definition Edge.h:23
RDKit::CIPLabeler::Node::getAtomicNum
int getAtomicNum() const
RDKit::CIPLabeler::Node::newRingDuplicateChild
Node * newRingDuplicateChild(int idx, Atom *atom) const
RDKit::CIPLabeler::Node::getAtomicMass
double getAtomicMass() const
RDKit::CIPLabeler::Node::newBondDuplicateChild
Node * newBondDuplicateChild(int idx, Atom *atom) const
RDKit::CIPLabeler::Node::Node
Node(const Node &)=delete
RDKit::CIPLabeler::Node::operator=
Node & operator=(const Node &)=delete
RDKit::CIPLabeler::Node::isDuplicateOrH
bool isDuplicateOrH() const
RDKit::CIPLabeler::Node::getDigraph
Digraph * getDigraph() const
RDKit::CIPLabeler::Node::newImplicitHydrogenChild
Node * newImplicitHydrogenChild() const
RDKit::CIPLabeler::Node::setAux
void setAux(Descriptor desc)
RDKit::CIPLabeler::Node::BOND_DUPLICATE
static const int BOND_DUPLICATE
Definition Node.h:44
RDKit::CIPLabeler::Node::getAtomIdx
unsigned int getAtomIdx() const
RDKit::CIPLabeler::Node::DUPLICATE_OR_H
static const int DUPLICATE_OR_H
Definition Node.h:62
RDKit::CIPLabeler::Node::RING_DUPLICATE
static const int RING_DUPLICATE
Definition Node.h:38
RDKit::CIPLabeler::Node::DUPLICATE
static const int DUPLICATE
Definition Node.h:50
RDKit::CIPLabeler::Node::getEdges
const std::vector< Edge * > & getEdges() const
RDKit::CIPLabeler::Node::getAtom
Atom * getAtom() const
RDKit::CIPLabeler::Node::getNonTerminalOutEdges
std::vector< Edge * > getNonTerminalOutEdges() const
RDKit::CIPLabeler::Node::newChild
Node * newChild(int idx, Atom *atom) const
RDKit::CIPLabeler::Node::getAux
Descriptor getAux() const
RDKit::CIPLabeler::Node::getEdges
std::vector< Edge * > getEdges(Atom *end) const
RDKit::CIPLabeler::Node::getDistance
int getDistance() const
RDKit::CIPLabeler::Node::isSet
bool isSet(int mask) const
RDKit::CIPLabeler::Node::getMassNum
unsigned getMassNum() const
RDKit::CIPLabeler::Node::add
void add(Edge *e)
RDKit::CIPLabeler::Node::EXPANDED
static const int EXPANDED
Definition Node.h:32
RDKit::CIPLabeler::Node::IMPL_HYDROGEN
static const int IMPL_HYDROGEN
Definition Node.h:56
RDKit::CIPLabeler::Node::isTerminal
bool isTerminal() const
RDKit::CIPLabeler::Node::isDuplicate
bool isDuplicate() const
RDKit::CIPLabeler::Node::Node
Node()=delete
RDKit::CIPLabeler::Node::getAtomicNumFraction
boost::rational< int > getAtomicNumFraction() const
RDKit::CIPLabeler::Node::isVisited
bool isVisited(int idx) const
RDKit::CIPLabeler::Node::Node
Node(Digraph *g, std::vector< char > &&visit, Atom *atom, boost::rational< int > &&frac, int dist, int flags)
RDKit::CIPLabeler::Node::isExpanded
bool isExpanded() const
RDKit::CIPLabeler
Definition CIPLabeler.h:27
RDKit::CIPLabeler::Descriptor
Descriptor
Definition Descriptor.h:25
RDKit::CIPLabeler::Descriptor::NONE
@ NONE
Definition Descriptor.h:26
RDKit
Std stuff.
Definition Abbreviations.h:19