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
27class 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
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 =
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
73
74 Atom *getAtom() const;
75
76 int getDistance() const;
77
78 boost::rational<int> getAtomicNumFraction() const;
79
80 int getAtomicNum() const;
81
82 unsigned getMassNum() const;
83
84 double getAtomicMass() const;
85
87
88 bool isSet(int mask) const;
89
90 bool isDuplicate() const;
91
92 bool isDuplicateOrH() const;
93
94 bool isTerminal() const;
95
96 bool isExpanded() const;
97
98 bool isVisited(int idx) const;
99
100 Node *newChild(int idx, Atom *atom) const;
101
102 Node *newBondDuplicateChild(int idx, Atom *atom) const;
103
104 Node *newRingDuplicateChild(int idx, Atom *atom) const;
105
107
108 void add(Edge *e);
109
111
112 const std::vector<Edge *> &getEdges() const;
113
114 std::vector<Edge *> getEdges(Atom *end) const;
115
116 std::vector<Edge *> getNonTerminalOutEdges() const;
117
118 private:
119 Digraph *dp_g;
120 Atom *dp_atom;
121 int d_dist;
122 boost::rational<int> d_atomic_num;
123 double d_atomic_mass;
125 int d_flags = 0x0;
126
127 std::vector<Edge *> d_edges;
128
129 std::vector<char> d_visit;
130
131 Node *newTerminalChild(int idx, Atom *atom, int flags) const;
132};
133
134} // namespace CIPLabeler
135} // namespace RDKit
The class for representing atoms.
Definition Atom.h:75
Node * newRingDuplicateChild(int idx, Atom *atom) const
double getAtomicMass() const
Node * newBondDuplicateChild(int idx, Atom *atom) const
Node(const Node &)=delete
Node & operator=(const Node &)=delete
bool isDuplicateOrH() const
Digraph * getDigraph() const
Node * newImplicitHydrogenChild() const
void setAux(Descriptor desc)
static const int BOND_DUPLICATE
Definition Node.h:44
static const int DUPLICATE_OR_H
Definition Node.h:62
static const int RING_DUPLICATE
Definition Node.h:38
static const int DUPLICATE
Definition Node.h:50
const std::vector< Edge * > & getEdges() const
Atom * getAtom() const
std::vector< Edge * > getNonTerminalOutEdges() const
Node * newChild(int idx, Atom *atom) const
Descriptor getAux() const
std::vector< Edge * > getEdges(Atom *end) const
bool isSet(int mask) const
unsigned getMassNum() const
static const int EXPANDED
Definition Node.h:32
static const int IMPL_HYDROGEN
Definition Node.h:56
bool isDuplicate() const
boost::rational< int > getAtomicNumFraction() const
bool isVisited(int idx) const
Node(Digraph *g, std::vector< char > &&visit, Atom *atom, boost::rational< int > &&frac, int dist, int flags)
Std stuff.
bool rdvalue_is(const RDValue_cast_t)