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 static const int DUPLICATE = 0x6;
50
51 /**
52 * Node was created for an implicit hydrogen,
53 * the 'atom' value will be null.
54 */
55 static const int IMPL_HYDROGEN = 0x8;
56
57 Node() = delete;
58 Node(const Node &) = delete;
59 Node &operator=(const Node &) = delete;
60
61 Node(Digraph *g, std::vector<char> &&visit, Atom *atom,
62 boost::rational<int> &&frac, int dist, int flags);
63
65
66 Atom *getAtom() const;
67
68 int getDistance() const;
69
70 boost::rational<int> getAtomicNumFraction() const;
71
72 int getAtomicNum() const;
73
74 unsigned getMassNum() const;
75
76 double getAtomicMass() const;
77
79
80 bool isSet(int mask) const;
81
82 bool isDuplicate() const;
83
84 bool isTerminal() const;
85
86 bool isExpanded() const;
87
88 bool isVisited(int idx) const;
89
90 Node *newChild(int idx, Atom *atom) const;
91
92 Node *newBondDuplicateChild(int idx, Atom *atom) const;
93
94 Node *newRingDuplicateChild(int idx, Atom *atom) const;
95
97
98 void add(Edge *e);
99
101
102 const std::vector<Edge *> &getEdges() const;
103
104 std::vector<Edge *> getEdges(Atom *end) const;
105
106 std::vector<Edge *> getNonTerminalOutEdges() const;
107
108 private:
109 Digraph *dp_g;
110 Atom *dp_atom;
111 int d_dist;
112 boost::rational<int> d_atomic_num;
113 double d_atomic_mass;
115 int d_flags = 0x0;
116
117 std::vector<Edge *> d_edges;
118
119 std::vector<char> d_visit;
120
121 Node *newTerminalChild(int idx, Atom *atom, int flags) const;
122};
123
124} // namespace CIPLabeler
125} // 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
Digraph * getDigraph() const
Node * newImplicitHydrogenChild() const
void setAux(Descriptor desc)
static const int BOND_DUPLICATE
Definition Node.h:44
static const int RING_DUPLICATE
Definition Node.h:38
static const int DUPLICATE
Definition Node.h:49
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:55
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)