Loading...
Searching...
No Matches
smartsParser.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_STRUCTURE_SMARTES_PARSER_H
#define BALL_STRUCTURE_SMARTES_PARSER_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
#include <map>
#include <set>
// needed for MSVC:
#undef CW_DEFAULT
namespace BALL
{
// forward declarations
class Bond;
class Atom;
class Element;
class BALL_EXPORT SmartsParser
{
public:
enum ZEIsomerType
{
ANY_ZE = 1,
NONE,
Z,
E
};
enum ChiralClass
{
CHIRAL_CLASS_UNSPECIFIED = 1,
NONCHIRAL,
NONCHIRAL_OR_UNSPECIFIED,
CW_DEFAULT, // TH
CW_DEFAULT_OR_UNSPECIFIED,
CCW_DEFAULT, // TH
CCW_DEFAULT_OR_UNSPECIFIED,
CW_TH, // tetrahdral
CW_TH_OR_UNSPECIFIED,
CCW_TH,
CCW_TH_OR_UNSPECIFIED,
CW_AL, // allene-like
CW_AL_OR_UNSPECIFIED,
CCW_AL,
CCW_AL_OR_UNSPECIFIED,
CW_SP, // square planar
CW_SP_OR_UNSPECIFIED,
CCW_SP,
CCW_SP_OR_UNSPECIFIED,
CW_TB, //trigonal bipyramidal
CW_TB_OR_UNSPECIFIED,
CCW_TB,
CCW_TB_OR_UNSPECIFIED,
CW_OH, // octahedral
CW_OH_OR_UNSPECIFIED,
CCW_OH,
CCW_OH_OR_UNSPECIFIED
};
enum LogicalOperator
{
AND,
OR,
AND_LOW,
NOOP
};
class SPAtom;
class BALL_EXPORT SPBond
{
public:
enum SPBondOrder
{
SINGLE = 1,
SINGLE_UP,
SINGLE_UP_OR_ANY,
SINGLE_DOWN,
SINGLE_DOWN_OR_ANY,
SINGLE_OR_AROMATIC,
AROMATIC,
DOUBLE,
TRIPLE,
NOT_NECESSARILY_CONNECTED,
IN_RING,
ANY
};
SPBond();
SPBond(SPBondOrder bond_order);
SPBond(SPAtom* first, SPAtom* second, SPBondOrder bond_order);
virtual ~SPBond() ;
ZEIsomerType getZEType() const { return ze_type_; }
void setZEType(ZEIsomerType type) { ze_type_ = type; }
void setBondOrder(SPBondOrder bond_order);
SPBondOrder getBondOrder() const { return bond_order_; }
bool isNot() const { return not_; }
void setNot(bool is_not) { not_ = is_not; }
// returns true if the SPBond matches the given bond
bool equals(const Bond* bond) const;
protected:
ZEIsomerType ze_type_;
SPBondOrder bond_order_;
bool not_;
};
class BALL_EXPORT SPAtom
{
public:
enum PropertyType
{
ISOTOPE = 1,
CHARGE,
AROMATIC,
ALIPHATIC,
IN_NUM_RINGS,
IN_RING_SIZE,
IN_BRACKETS,
CONNECTED,
EXPLICIT_HYDROGENS,
VALENCE,
IMPLICIT_HYDROGENS,
DEGREE,
RING_CONNECTED,
CHIRALITY,
SYMBOL
};
union PropertyValue
{
int int_value;
bool bool_value;
const Element* element_value;
ChiralClass chiral_class_value;
};
struct Property
{
public:
Property(PropertyType type, int value);
Property(PropertyType type, bool value);
Property(PropertyType type, const Element* value);
Property(PropertyType type, ChiralClass value);
virtual ~Property();
void operator = (const Property& rhs);
PropertyType getType() const { return type_; }
PropertyValue getValue() const { return value_; }
private:
Property();
PropertyType type_;
PropertyValue value_;
};
SPAtom();
SPAtom(const String& symbol);
virtual ~SPAtom() ;
void setProperty(PropertyType type, int int_value);
void setProperty(PropertyType type, bool flag);
void setProperty(PropertyType type, const Element* element);
void setProperty(PropertyType type, ChiralClass chirality);
void setProperty(Property property);
void addPropertiesFromSPAtom(SPAtom* sp_atom);
void setNotProperty(PropertyType type);
bool hasProperty(PropertyType type) const;
PropertyValue getProperty(PropertyType type);
Size countProperties() const;
Size getDefaultValence(const Atom* atom) const;
Size countRealValences(const Atom* atom) const;
Size getNumberOfImplicitHydrogens(const Atom* atom) const;
bool equals(const Atom* atom) const;
protected:
Atom* atom_;
std::map<PropertyType, PropertyValue> properties_;
std::set<PropertyType> not_properties_;
};
class SPNode;
class BALL_EXPORT SPEdge
{
public:
SPEdge();
SPEdge(const SPEdge& sp_edge);
virtual ~SPEdge();
bool isInternal() const { return internal_; }
void setInternal(bool internal) { internal_ = internal; }
void setSPBond(SPBond* sp_bond) { bond_ = sp_bond; }
SPBond* getSPBond() const { return bond_; }
void setFirstSPNode(SPNode* first) { first_ = first; }
SPNode* getFirstSPNode() const { return first_; }
void setSecondSPNode(SPNode* second) { second_ = second; }
SPNode* getSecondSPNode() const { return second_; }
SPNode* getPartnerSPNode(SPNode* node) { return node == first_ ? second_ : first_; }
bool isNot() const { return is_not_; }
void setNot(bool is_not) { is_not_ = is_not; }
void setFirstSPEdge(SPEdge* first) { first_edge_ = first; }
SPEdge* getFirstSPEdge() const { return first_edge_; }
void setSecondSPEdge(SPEdge* second) { second_edge_ = second; }
SPEdge* getSecondSPEdge() const { return second_edge_; }
void setLogicalOperator(LogicalOperator log_op) { log_op_ = log_op; }
LogicalOperator getLogicalOperator() const { return log_op_; }
protected:
bool internal_;
bool is_not_;
SPNode* first_;
SPNode* second_;
SPBond* bond_;
SPEdge* first_edge_;
SPEdge* second_edge_;
LogicalOperator log_op_;
};
class BALL_EXPORT SPNode
{
public:
typedef std::vector<SPEdge*>::iterator EdgeIterator;
typedef std::vector<SPEdge*>::const_iterator EdgeConstIterator;
SPNode();
SPNode(SPAtom* atom);
SPNode(SPNode* first, LogicalOperator log_op, SPNode* second);
SPNode(const SPNode& sp_node);
virtual ~SPNode();
bool isInternal() const { return internal_; }
void setInternal(bool internal) { internal_ = internal; }
bool isRecursive() const { return recursive_; }
void setRecursive(bool recursive);
void setComponentNumber(int no) { component_no_ = no; }
Size getComponentNumber() const { return component_no_; }
SPAtom* getSPAtom() const { return sp_atom_; }
void setSPAtom(SPAtom* sp_atom) { sp_atom_ = sp_atom; }
SPEdge* getFirstEdge() const { return first_edge_; }
void setFirstEdge(SPEdge* first) { first_edge_ = first; }
SPEdge* getSecondEdge() const { return second_edge_; }
void setSecondEdge(SPEdge* second) { second_edge_ = second; }
bool getNot() const { return is_not_; }
void setNot(bool is_not) { is_not_ = is_not; }
//void setInBrackets() { in_brackets_ = true; }
void addSPEdge(SPEdge* sp_edge) { edges_.push_back(sp_edge); }
void setLogicalOperator(LogicalOperator log_op) { log_op_ = log_op; }
LogicalOperator getLogicalOperator() const { return log_op_; }
Size countEdges() const { return edges_.size(); }
EdgeIterator begin() { return edges_.begin(); }
EdgeIterator end() { return edges_.end(); }
EdgeConstIterator begin() const { return edges_.begin(); }
EdgeConstIterator end() const { return edges_.end(); }
protected:
bool internal_;
bool is_not_;
bool recursive_;
//bool in_brackets_;
LogicalOperator log_op_;
std::vector<SPEdge*> edges_;
SPEdge* first_edge_;
SPEdge* second_edge_;
SPAtom* sp_atom_;
int component_no_;
};
SmartsParser();
SmartsParser(const SmartsParser& parser);
virtual ~SmartsParser();
void parse(const String& s);
SPAtom* createAtom(const String& symbol, bool in_bracket = false);
void setRoot(SPNode* root) { root_ = root; }
SPNode* getRoot() const { return root_; }
void dumpTree();
void clear();
void addRingConnection(SPNode* spnode, Size index);
std::map<Size, std::vector<SPNode*> > getRingConnections() const;
void setSSSR(const std::vector<std::vector<Atom*> >& sssr);
void setNeedsSSSR(bool needs_sssr) { needs_SSSR_ = needs_sssr; }
bool getNeedsSSSR() const { return needs_SSSR_; }
void setRecursive(bool recursive) { recursive_ = recursive; }
bool isRecursive() const { return recursive_; }
void setComponentGrouping(bool component_grouping) { component_grouping_ = component_grouping; }
bool hasComponentGrouping() const { return component_grouping_; }
struct State
{
Size char_count;
SmartsParser* current_parser;
const char* buffer;
};
static State state;
const std::set<SPNode*>& getNodes() const { return nodes_; }
const std::set<SPEdge*>& getEdges() const { return edges_; }
void addEdge(SPEdge* edge) { edges_.insert(edge); }
void addNode(SPNode* node) { nodes_.insert(node); }
bool hasRecursiveEdge(SPEdge* edge) const { return rec_edges_.find(edge) != rec_edges_.end(); }
void addRecursiveEdge(SPEdge* edge) { rec_edges_.insert(edge); }
void setNextComponentNumberToSubTree(SPNode* spnode);
protected:
bool needs_SSSR_;
bool recursive_;
bool component_grouping_;
static vector<std::set<const Atom*> >* sssr_;
void dumpTreeRecursive_(SPNode* node, Size depth);
void dumpTreeRecursive_(SPEdge* edge, Size depth);
std::map<Size, std::vector<SPNode*> > ring_connections_;
static SmartsParser* current_parser_;
std::set<SPEdge*> edges_;
std::set<SPNode*> nodes_;
std::set<SPEdge*> rec_edges_;
SPNode* root_;
int component_no_;
};
} // namespace BALL
#endif // BALL_STRUCTURE_SMARTS_PARSER_H
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::Atom
Definition atom.h:90
BALL::Bond
Definition bond.h:57
BALL::Element
Definition PTE.h:55
BALL::SmartsParser::SPAtom
Smarts Parser Atom class.
Definition smartsParser.h:189
BALL::SmartsParser::SPAtom::getProperty
PropertyValue getProperty(PropertyType type)
returns a value of the given property type
BALL::SmartsParser::SPAtom::setProperty
void setProperty(PropertyType type, ChiralClass chirality)
sets a chirality value
BALL::SmartsParser::SPAtom::setNotProperty
void setNotProperty(PropertyType type)
negotiates the property definition
BALL::SmartsParser::SPAtom::getDefaultValence
Size getDefaultValence(const Atom *atom) const
return the number of valences of the given atom
BALL::SmartsParser::SPAtom::SPAtom
SPAtom(const String &symbol)
copy constructor
BALL::SmartsParser::SPAtom::getNumberOfImplicitHydrogens
Size getNumberOfImplicitHydrogens(const Atom *atom) const
returns the number of implicit hydrogens of the given atom
BALL::SmartsParser::SPAtom::setProperty
void setProperty(PropertyType type, const Element *element)
sets a Element
BALL::SmartsParser::SPAtom::properties_
std::map< PropertyType, PropertyValue > properties_
the properties of this SPAtom
Definition smartsParser.h:374
BALL::SmartsParser::SPAtom::countProperties
Size countProperties() const
returns the number of properties
BALL::SmartsParser::SPAtom::SPAtom
SPAtom()
Default constructor.
BALL::SmartsParser::SPAtom::countRealValences
Size countRealValences(const Atom *atom) const
returns the number of available valences of the given atom
BALL::SmartsParser::SPAtom::PropertyType
PropertyType
enum of all properties possible for a smarts parser atom
Definition smartsParser.h:194
BALL::SmartsParser::SPAtom::AROMATIC
@ AROMATIC
Definition smartsParser.h:197
BALL::SmartsParser::SPAtom::DEGREE
@ DEGREE
Definition smartsParser.h:206
BALL::SmartsParser::SPAtom::EXPLICIT_HYDROGENS
@ EXPLICIT_HYDROGENS
Definition smartsParser.h:203
BALL::SmartsParser::SPAtom::IMPLICIT_HYDROGENS
@ IMPLICIT_HYDROGENS
Definition smartsParser.h:205
BALL::SmartsParser::SPAtom::CHIRALITY
@ CHIRALITY
Definition smartsParser.h:208
BALL::SmartsParser::SPAtom::CONNECTED
@ CONNECTED
Definition smartsParser.h:202
BALL::SmartsParser::SPAtom::VALENCE
@ VALENCE
Definition smartsParser.h:204
BALL::SmartsParser::SPAtom::SYMBOL
@ SYMBOL
Definition smartsParser.h:209
BALL::SmartsParser::SPAtom::ALIPHATIC
@ ALIPHATIC
Definition smartsParser.h:198
BALL::SmartsParser::SPAtom::ISOTOPE
@ ISOTOPE
Definition smartsParser.h:195
BALL::SmartsParser::SPAtom::IN_RING_SIZE
@ IN_RING_SIZE
Definition smartsParser.h:200
BALL::SmartsParser::SPAtom::IN_NUM_RINGS
@ IN_NUM_RINGS
Definition smartsParser.h:199
BALL::SmartsParser::SPAtom::RING_CONNECTED
@ RING_CONNECTED
Definition smartsParser.h:207
BALL::SmartsParser::SPAtom::IN_BRACKETS
@ IN_BRACKETS
Definition smartsParser.h:201
BALL::SmartsParser::SPAtom::CHARGE
@ CHARGE
Definition smartsParser.h:196
BALL::SmartsParser::SPAtom::not_properties_
std::set< PropertyType > not_properties_
the properties which are negated
Definition smartsParser.h:377
BALL::SmartsParser::SPAtom::hasProperty
bool hasProperty(PropertyType type) const
returns true if the property is set
BALL::SmartsParser::SPAtom::setProperty
void setProperty(PropertyType type, int int_value)
sets an int property
BALL::SmartsParser::SPAtom::atom_
Atom * atom_
the atom which this sp_atom belongs to
Definition smartsParser.h:371
BALL::SmartsParser::SPAtom::setProperty
void setProperty(PropertyType type, bool flag)
sets a flag
BALL::SmartsParser::SPAtom::setProperty
void setProperty(Property property)
sets a property
BALL::SmartsParser::SPAtom::equals
bool equals(const Atom *atom) const
returns true if the local properties of the atoms match
BALL::SmartsParser::SPAtom::~SPAtom
virtual ~SPAtom()
destructor
BALL::SmartsParser::SPAtom::addPropertiesFromSPAtom
void addPropertiesFromSPAtom(SPAtom *sp_atom)
adds properties from another SPAtom
BALL::SmartsParser::SPBond
Bond representation of the smarts parser.
Definition smartsParser.h:106
BALL::SmartsParser::SPBond::setBondOrder
void setBondOrder(SPBondOrder bond_order)
sets the bond order
BALL::SmartsParser::SPBond::setZEType
void setZEType(ZEIsomerType type)
sets the Z/E isomer type
Definition smartsParser.h:149
BALL::SmartsParser::SPBond::~SPBond
virtual ~SPBond()
Destructor.
BALL::SmartsParser::SPBond::bond_order_
SPBondOrder bond_order_
the bond order
Definition smartsParser.h:173
BALL::SmartsParser::SPBond::SPBond
SPBond()
Default constructor.
BALL::SmartsParser::SPBond::getZEType
ZEIsomerType getZEType() const
returns the Z/E isomer type
Definition smartsParser.h:146
BALL::SmartsParser::SPBond::getBondOrder
SPBondOrder getBondOrder() const
returns the bond order
Definition smartsParser.h:155
BALL::SmartsParser::SPBond::SPBond
SPBond(SPAtom *first, SPAtom *second, SPBondOrder bond_order)
Detailed constructor with.
BALL::SmartsParser::SPBond::isNot
bool isNot() const
return true if a general negation is set
Definition smartsParser.h:158
BALL::SmartsParser::SPBond::SPBond
SPBond(SPBondOrder bond_order)
Detailed constructor with bond order.
BALL::SmartsParser::SPBond::SPBondOrder
SPBondOrder
the bond orders supported by SMARTS-patterns
Definition smartsParser.h:111
BALL::SmartsParser::SPBond::NOT_NECESSARILY_CONNECTED
@ NOT_NECESSARILY_CONNECTED
Definition smartsParser.h:121
BALL::SmartsParser::SPBond::SINGLE_UP
@ SINGLE_UP
Definition smartsParser.h:113
BALL::SmartsParser::SPBond::DOUBLE
@ DOUBLE
Definition smartsParser.h:119
BALL::SmartsParser::SPBond::AROMATIC
@ AROMATIC
Definition smartsParser.h:118
BALL::SmartsParser::SPBond::SINGLE_UP_OR_ANY
@ SINGLE_UP_OR_ANY
Definition smartsParser.h:114
BALL::SmartsParser::SPBond::SINGLE_DOWN
@ SINGLE_DOWN
Definition smartsParser.h:115
BALL::SmartsParser::SPBond::ANY
@ ANY
Definition smartsParser.h:123
BALL::SmartsParser::SPBond::TRIPLE
@ TRIPLE
Definition smartsParser.h:120
BALL::SmartsParser::SPBond::SINGLE
@ SINGLE
Definition smartsParser.h:112
BALL::SmartsParser::SPBond::SINGLE_OR_AROMATIC
@ SINGLE_OR_AROMATIC
Definition smartsParser.h:117
BALL::SmartsParser::SPBond::IN_RING
@ IN_RING
Definition smartsParser.h:122
BALL::SmartsParser::SPBond::SINGLE_DOWN_OR_ANY
@ SINGLE_DOWN_OR_ANY
Definition smartsParser.h:116
BALL::SmartsParser::SPBond::setNot
void setNot(bool is_not)
set the general negation to the bool given
Definition smartsParser.h:161
BALL::SmartsParser::SPBond::ze_type_
ZEIsomerType ze_type_
Z/E isomer type.
Definition smartsParser.h:170
BALL::SmartsParser::SPBond::equals
bool equals(const Bond *bond) const
BALL::SmartsParser::SPBond::not_
bool not_
general negation flag
Definition smartsParser.h:176
BALL::SmartsParser::SPEdge
Edge representation of the smarts parser graph.
Definition smartsParser.h:386
BALL::SmartsParser::SPEdge::setFirstSPNode
void setFirstSPNode(SPNode *first)
set the first SPNode of this edge
Definition smartsParser.h:418
BALL::SmartsParser::SPEdge::SPEdge
SPEdge(const SPEdge &sp_edge)
Copy constructor.
BALL::SmartsParser::SPEdge::getPartnerSPNode
SPNode * getPartnerSPNode(SPNode *node)
returns the partner; either the first or the second SPNode
Definition smartsParser.h:430
BALL::SmartsParser::SPEdge::setSecondSPEdge
void setSecondSPEdge(SPEdge *second)
set the second SPEdge (second tree child)
Definition smartsParser.h:445
BALL::SmartsParser::SPEdge::getSecondSPNode
SPNode * getSecondSPNode() const
returns the second SPNode of this edge
Definition smartsParser.h:427
BALL::SmartsParser::SPEdge::getLogicalOperator
LogicalOperator getLogicalOperator() const
returns the asociated logical operator (for the child edges)
Definition smartsParser.h:454
BALL::SmartsParser::SPEdge::~SPEdge
virtual ~SPEdge()
Destructor.
BALL::SmartsParser::SPEdge::first_edge_
SPEdge * first_edge_
first SPEdge
Definition smartsParser.h:475
BALL::SmartsParser::SPEdge::bond_
SPBond * bond_
associated bond
Definition smartsParser.h:472
BALL::SmartsParser::SPEdge::getSecondSPEdge
SPEdge * getSecondSPEdge() const
returns the second SPEdge (second tree child)
Definition smartsParser.h:448
BALL::SmartsParser::SPEdge::isInternal
bool isInternal() const
returns true if this is a internal edge
Definition smartsParser.h:406
BALL::SmartsParser::SPEdge::setNot
void setNot(bool is_not)
set the negation flag
Definition smartsParser.h:436
BALL::SmartsParser::SPEdge::second_edge_
SPEdge * second_edge_
second SPEdge
Definition smartsParser.h:478
BALL::SmartsParser::SPEdge::getSPBond
SPBond * getSPBond() const
returns the corresponding SPBond of this edge
Definition smartsParser.h:415
BALL::SmartsParser::SPEdge::first_
SPNode * first_
first SPNode
Definition smartsParser.h:466
BALL::SmartsParser::SPEdge::is_not_
bool is_not_
negation flag
Definition smartsParser.h:463
BALL::SmartsParser::SPEdge::setSPBond
void setSPBond(SPBond *sp_bond)
sets the corresponding SPBond of this edge
Definition smartsParser.h:412
BALL::SmartsParser::SPEdge::setSecondSPNode
void setSecondSPNode(SPNode *second)
sets the second SPNode of this edge
Definition smartsParser.h:424
BALL::SmartsParser::SPEdge::internal_
bool internal_
internal flag
Definition smartsParser.h:460
BALL::SmartsParser::SPEdge::isNot
bool isNot() const
returns true if negation is enabled
Definition smartsParser.h:433
BALL::SmartsParser::SPEdge::second_
SPNode * second_
second SPNode
Definition smartsParser.h:469
BALL::SmartsParser::SPEdge::SPEdge
SPEdge()
Default constructor.
BALL::SmartsParser::SPEdge::getFirstSPEdge
SPEdge * getFirstSPEdge() const
returns the first SPEdge (first tree child)
Definition smartsParser.h:442
BALL::SmartsParser::SPEdge::getFirstSPNode
SPNode * getFirstSPNode() const
returns the first SPNode of this edge
Definition smartsParser.h:421
BALL::SmartsParser::SPEdge::setInternal
void setInternal(bool internal)
set this edge to a internal edge
Definition smartsParser.h:409
BALL::SmartsParser::SPEdge::setFirstSPEdge
void setFirstSPEdge(SPEdge *first)
set the first SPEdge (first tree child)
Definition smartsParser.h:439
BALL::SmartsParser::SPEdge::setLogicalOperator
void setLogicalOperator(LogicalOperator log_op)
sets the associated logical operator (for the child edges)
Definition smartsParser.h:451
BALL::SmartsParser::SPEdge::log_op_
LogicalOperator log_op_
logical operator associated with the SPEdges
Definition smartsParser.h:481
BALL::SmartsParser::SPNode
Representation of a node in the smarts parser graph.
Definition smartsParser.h:487
BALL::SmartsParser::SPNode::EdgeConstIterator
std::vector< SPEdge * >::const_iterator EdgeConstIterator
constant edge iterator
Definition smartsParser.h:497
BALL::SmartsParser::SPNode::getComponentNumber
Size getComponentNumber() const
returns the component number
Definition smartsParser.h:540
BALL::SmartsParser::SPNode::internal_
bool internal_
internal flag
Definition smartsParser.h:602
BALL::SmartsParser::SPNode::setSecondEdge
void setSecondEdge(SPEdge *second)
sets the second edge (for tree use)
Definition smartsParser.h:558
BALL::SmartsParser::SPNode::end
EdgeIterator end()
mutable access to end of edges list
Definition smartsParser.h:590
BALL::SmartsParser::SPNode::isInternal
bool isInternal() const
returns true if the SPNode is an internal node
Definition smartsParser.h:525
BALL::SmartsParser::SPNode::getSecondEdge
SPEdge * getSecondEdge() const
returns the second edge (for tree use)
Definition smartsParser.h:555
BALL::SmartsParser::SPNode::setInternal
void setInternal(bool internal)
sets the internal flag
Definition smartsParser.h:528
BALL::SmartsParser::SPNode::edges_
std::vector< SPEdge * > edges_
edges list
Definition smartsParser.h:617
BALL::SmartsParser::SPNode::isRecursive
bool isRecursive() const
returns true if the SPNode is a recursive node (from recursive SMARTS)
Definition smartsParser.h:531
BALL::SmartsParser::SPNode::setFirstEdge
void setFirstEdge(SPEdge *first)
sets the first edge (for tree use)
Definition smartsParser.h:552
BALL::SmartsParser::SPNode::addSPEdge
void addSPEdge(SPEdge *sp_edge)
flag whether the pattern is in brackets
Definition smartsParser.h:571
BALL::SmartsParser::SPNode::setRecursive
void setRecursive(bool recursive)
sets the recursive flag
BALL::SmartsParser::SPNode::begin
EdgeIterator begin()
mutable access to begin of edges list
Definition smartsParser.h:587
BALL::SmartsParser::SPNode::getSPAtom
SPAtom * getSPAtom() const
returns the associated SPAtom
Definition smartsParser.h:543
BALL::SmartsParser::SPNode::EdgeIterator
std::vector< SPEdge * >::iterator EdgeIterator
non-constant edge iterator
Definition smartsParser.h:494
BALL::SmartsParser::SPNode::sp_atom_
SPAtom * sp_atom_
SPAtom associated with this SPNode.
Definition smartsParser.h:626
BALL::SmartsParser::SPNode::setNot
void setNot(bool is_not)
sets the negation flag
Definition smartsParser.h:564
BALL::SmartsParser::SPNode::component_no_
int component_no_
component level
Definition smartsParser.h:629
BALL::SmartsParser::SPNode::is_not_
bool is_not_
negotiation flag
Definition smartsParser.h:605
BALL::SmartsParser::SPNode::setComponentNumber
void setComponentNumber(int no)
set the component no of the component level grouping
Definition smartsParser.h:537
BALL::SmartsParser::SPNode::countEdges
Size countEdges() const
counts the number of edges
Definition smartsParser.h:580
BALL::SmartsParser::SPNode::begin
EdgeConstIterator begin() const
non-mutable access to begin of edges list
Definition smartsParser.h:593
BALL::SmartsParser::SPNode::SPNode
SPNode(const SPNode &sp_node)
Copy constructor.
BALL::SmartsParser::SPNode::setSPAtom
void setSPAtom(SPAtom *sp_atom)
set the associated SPAtom
Definition smartsParser.h:546
BALL::SmartsParser::SPNode::SPNode
SPNode(SPAtom *atom)
Detailed constructor with an atom.
BALL::SmartsParser::SPNode::SPNode
SPNode()
Default constructor.
BALL::SmartsParser::SPNode::getFirstEdge
SPEdge * getFirstEdge() const
returns the first edge (for tree use)
Definition smartsParser.h:549
BALL::SmartsParser::SPNode::second_edge_
SPEdge * second_edge_
second edge
Definition smartsParser.h:623
BALL::SmartsParser::SPNode::getLogicalOperator
LogicalOperator getLogicalOperator() const
returns the logical operator of the SPNode
Definition smartsParser.h:577
BALL::SmartsParser::SPNode::log_op_
LogicalOperator log_op_
in brackets flag
Definition smartsParser.h:614
BALL::SmartsParser::SPNode::end
EdgeConstIterator end() const
non-mutable access to end of edges list
Definition smartsParser.h:596
BALL::SmartsParser::SPNode::setLogicalOperator
void setLogicalOperator(LogicalOperator log_op)
sets the logical operator associated with the SPNode
Definition smartsParser.h:574
BALL::SmartsParser::SPNode::recursive_
bool recursive_
recursive flag
Definition smartsParser.h:608
BALL::SmartsParser::SPNode::~SPNode
virtual ~SPNode()
Destructor.
BALL::SmartsParser::SPNode::getNot
bool getNot() const
returns the negation flag
Definition smartsParser.h:561
BALL::SmartsParser::SPNode::first_edge_
SPEdge * first_edge_
first edge
Definition smartsParser.h:620
BALL::SmartsParser::SPNode::SPNode
SPNode(SPNode *first, LogicalOperator log_op, SPNode *second)
Detailed constructor with two nodes and a logical operator.
BALL::SmartsParser::rec_edges_
std::set< SPEdge * > rec_edges_
the recursive edges
Definition smartsParser.h:765
BALL::SmartsParser::dumpTree
void dumpTree()
dumps the tree to cerr
BALL::SmartsParser::hasComponentGrouping
bool hasComponentGrouping() const
returns true if the component level grouping was enabled
Definition smartsParser.h:697
BALL::SmartsParser::component_no_
int component_no_
the actual component number
Definition smartsParser.h:771
BALL::SmartsParser::nodes_
std::set< SPNode * > nodes_
the nodes
Definition smartsParser.h:762
BALL::SmartsParser::getRingConnections
std::map< Size, std::vector< SPNode * > > getRingConnections() const
returns the ring connections sorted by index from SMARTS pattern
BALL::SmartsParser::SmartsParser
SmartsParser()
Default constructor.
BALL::SmartsParser::setNextComponentNumberToSubTree
void setNextComponentNumberToSubTree(SPNode *spnode)
gets the next component no and assigns it to the subtree
BALL::SmartsParser::getRoot
SPNode * getRoot() const
returns the root SPNode of the tree
Definition smartsParser.h:664
BALL::SmartsParser::recursive_
bool recursive_
recursive flag
Definition smartsParser.h:738
BALL::SmartsParser::component_grouping_
bool component_grouping_
component level grouping flag
Definition smartsParser.h:741
BALL::SmartsParser::root_
SPNode * root_
the root node of the tree
Definition smartsParser.h:768
BALL::SmartsParser::ring_connections_
std::map< Size, std::vector< SPNode * > > ring_connections_
the ring connection sorted by index of the SMARTS pattern
Definition smartsParser.h:753
BALL::SmartsParser::needs_SSSR_
bool needs_SSSR_
sssr needed flag
Definition smartsParser.h:735
BALL::SmartsParser::setSSSR
void setSSSR(const std::vector< std::vector< Atom * > > &sssr)
sets the SSSR
BALL::SmartsParser::ChiralClass
ChiralClass
chiral class definitions CW = clock wise, CCW = counter clock wise
Definition smartsParser.h:49
BALL::SmartsParser::CW_OH
@ CW_OH
Definition smartsParser.h:73
BALL::SmartsParser::CCW_OH_OR_UNSPECIFIED
@ CCW_OH_OR_UNSPECIFIED
Definition smartsParser.h:76
BALL::SmartsParser::CCW_OH
@ CCW_OH
Definition smartsParser.h:75
BALL::SmartsParser::CW_SP_OR_UNSPECIFIED
@ CW_SP_OR_UNSPECIFIED
Definition smartsParser.h:66
BALL::SmartsParser::CW_SP
@ CW_SP
Definition smartsParser.h:65
BALL::SmartsParser::NONCHIRAL
@ NONCHIRAL
Definition smartsParser.h:51
BALL::SmartsParser::CCW_SP_OR_UNSPECIFIED
@ CCW_SP_OR_UNSPECIFIED
Definition smartsParser.h:68
BALL::SmartsParser::CW_TH_OR_UNSPECIFIED
@ CW_TH_OR_UNSPECIFIED
Definition smartsParser.h:58
BALL::SmartsParser::CW_AL
@ CW_AL
Definition smartsParser.h:61
BALL::SmartsParser::CCW_AL_OR_UNSPECIFIED
@ CCW_AL_OR_UNSPECIFIED
Definition smartsParser.h:64
BALL::SmartsParser::CW_DEFAULT
@ CW_DEFAULT
Definition smartsParser.h:53
BALL::SmartsParser::CW_OH_OR_UNSPECIFIED
@ CW_OH_OR_UNSPECIFIED
Definition smartsParser.h:74
BALL::SmartsParser::CW_DEFAULT_OR_UNSPECIFIED
@ CW_DEFAULT_OR_UNSPECIFIED
Definition smartsParser.h:54
BALL::SmartsParser::CCW_DEFAULT_OR_UNSPECIFIED
@ CCW_DEFAULT_OR_UNSPECIFIED
Definition smartsParser.h:56
BALL::SmartsParser::CHIRAL_CLASS_UNSPECIFIED
@ CHIRAL_CLASS_UNSPECIFIED
Definition smartsParser.h:50
BALL::SmartsParser::CW_TH
@ CW_TH
Definition smartsParser.h:57
BALL::SmartsParser::CW_AL_OR_UNSPECIFIED
@ CW_AL_OR_UNSPECIFIED
Definition smartsParser.h:62
BALL::SmartsParser::CCW_TH_OR_UNSPECIFIED
@ CCW_TH_OR_UNSPECIFIED
Definition smartsParser.h:60
BALL::SmartsParser::CCW_TH
@ CCW_TH
Definition smartsParser.h:59
BALL::SmartsParser::CCW_TB_OR_UNSPECIFIED
@ CCW_TB_OR_UNSPECIFIED
Definition smartsParser.h:72
BALL::SmartsParser::CCW_SP
@ CCW_SP
Definition smartsParser.h:67
BALL::SmartsParser::NONCHIRAL_OR_UNSPECIFIED
@ NONCHIRAL_OR_UNSPECIFIED
Definition smartsParser.h:52
BALL::SmartsParser::CCW_AL
@ CCW_AL
Definition smartsParser.h:63
BALL::SmartsParser::CCW_TB
@ CCW_TB
Definition smartsParser.h:71
BALL::SmartsParser::CW_TB_OR_UNSPECIFIED
@ CW_TB_OR_UNSPECIFIED
Definition smartsParser.h:70
BALL::SmartsParser::CCW_DEFAULT
@ CCW_DEFAULT
Definition smartsParser.h:55
BALL::SmartsParser::CW_TB
@ CW_TB
Definition smartsParser.h:69
BALL::SmartsParser::addEdge
void addEdge(SPEdge *edge)
adds an edge to the tree
Definition smartsParser.h:717
BALL::SmartsParser::setRecursive
void setRecursive(bool recursive)
sets the recursive flag
Definition smartsParser.h:688
BALL::SmartsParser::getEdges
const std::set< SPEdge * > & getEdges() const
returns the edges stored in the tree
Definition smartsParser.h:714
BALL::SmartsParser::current_parser_
static SmartsParser * current_parser_
current instance
Definition smartsParser.h:756
BALL::SmartsParser::createAtom
SPAtom * createAtom(const String &symbol, bool in_bracket=false)
creates a new atom of symbol
BALL::SmartsParser::getNeedsSSSR
bool getNeedsSSSR() const
returns true if the SMARTS pattern contains ring related parts
Definition smartsParser.h:685
BALL::SmartsParser::state
static State state
static member for the parser itself
Definition smartsParser.h:708
BALL::SmartsParser::setNeedsSSSR
void setNeedsSSSR(bool needs_sssr)
sets the sssr needed flag
Definition smartsParser.h:682
BALL::SmartsParser::isRecursive
bool isRecursive() const
returns true if the tree represents a recursive SMARTS pattern
Definition smartsParser.h:691
BALL::SmartsParser::addRecursiveEdge
void addRecursiveEdge(SPEdge *edge)
adds a recursive edge to the tree
Definition smartsParser.h:726
BALL::SmartsParser::LogicalOperator
LogicalOperator
Definition smartsParser.h:87
BALL::SmartsParser::AND
@ AND
Definition smartsParser.h:88
BALL::SmartsParser::AND_LOW
@ AND_LOW
Definition smartsParser.h:90
BALL::SmartsParser::NOOP
@ NOOP
Definition smartsParser.h:91
BALL::SmartsParser::OR
@ OR
Definition smartsParser.h:89
BALL::SmartsParser::setRoot
void setRoot(SPNode *root)
sets the root SPNode of the tree
Definition smartsParser.h:661
BALL::SmartsParser::addRingConnection
void addRingConnection(SPNode *spnode, Size index)
adds a ring connection, SPNode with an index used in the SMARTS pattern
BALL::SmartsParser::SmartsParser
SmartsParser(const SmartsParser &parser)
Copy constructor.
BALL::SmartsParser::dumpTreeRecursive_
void dumpTreeRecursive_(SPEdge *edge, Size depth)
dump method for the tree
BALL::SmartsParser::ZEIsomerType
ZEIsomerType
Definition smartsParser.h:40
BALL::SmartsParser::NONE
@ NONE
Definition smartsParser.h:42
BALL::SmartsParser::ANY_ZE
@ ANY_ZE
Definition smartsParser.h:41
BALL::SmartsParser::E
@ E
Definition smartsParser.h:44
BALL::SmartsParser::Z
@ Z
Definition smartsParser.h:43
BALL::SmartsParser::addNode
void addNode(SPNode *node)
adds a node to the tree
Definition smartsParser.h:720
BALL::SmartsParser::parse
void parse(const String &s)
BALL::SmartsParser::~SmartsParser
virtual ~SmartsParser()
Destructor.
BALL::SmartsParser::edges_
std::set< SPEdge * > edges_
the edges
Definition smartsParser.h:759
BALL::SmartsParser::clear
void clear()
clear the tree
BALL::SmartsParser::hasRecursiveEdge
bool hasRecursiveEdge(SPEdge *edge) const
returns true if the tree has the given recursive edge
Definition smartsParser.h:723
BALL::SmartsParser::dumpTreeRecursive_
void dumpTreeRecursive_(SPNode *node, Size depth)
dump method for the tree
BALL::SmartsParser::getNodes
const std::set< SPNode * > & getNodes() const
returns the eodes stored in the tree
Definition smartsParser.h:711
BALL::SmartsParser::sssr_
static vector< std::set< const Atom * > > * sssr_
the sssr
Definition smartsParser.h:744
BALL::SmartsParser::setComponentGrouping
void setComponentGrouping(bool component_grouping)
sets the component level flag
Definition smartsParser.h:694
BALL::String
Definition string.h:57
common.h
BALL
Definition constants.h:13
BALL::Size
BALL_SIZE_TYPE Size
Definition COMMON/global.h:114
BALL::SmartsParser::SPAtom::Property
Property struct of smarts parser atom.
Definition smartsParser.h:223
BALL::SmartsParser::SPAtom::Property::Property
Property(PropertyType type, const Element *value)
Detailed constructor with type and Element.
BALL::SmartsParser::SPAtom::Property::~Property
virtual ~Property()
Destructor.
BALL::SmartsParser::SPAtom::Property::Property
Property(PropertyType type, int value)
Detailed constructor with type and int value.
BALL::SmartsParser::SPAtom::Property::getValue
PropertyValue getValue() const
returns the value of the property
Definition smartsParser.h:255
BALL::SmartsParser::SPAtom::Property::Property
Property(PropertyType type, ChiralClass value)
Detailed constructor with type and chiral class definition.
BALL::SmartsParser::SPAtom::Property::Property
Property(PropertyType type, bool value)
Detailed constructor with type and flag.
BALL::SmartsParser::SPAtom::Property::getType
PropertyType getType() const
returns the type of the property
Definition smartsParser.h:252
BALL::SmartsParser::State
Parser state (used by the parser itself).
Definition smartsParser.h:701
BALL::SmartsParser::State::char_count
Size char_count
Definition smartsParser.h:702
BALL::SmartsParser::State::current_parser
SmartsParser * current_parser
Definition smartsParser.h:703
BALL::SmartsParser::State::buffer
const char * buffer
Definition smartsParser.h:704
BALL::SmartsParser::SPAtom::PropertyValue
possible types of the properties
Definition smartsParser.h:214
BALL::SmartsParser::SPAtom::PropertyValue::bool_value
bool bool_value
Definition smartsParser.h:216
BALL::SmartsParser::SPAtom::PropertyValue::int_value
int int_value
Definition smartsParser.h:215
BALL::SmartsParser::SPAtom::PropertyValue::chiral_class_value
ChiralClass chiral_class_value
Definition smartsParser.h:218
BALL::SmartsParser::SPAtom::PropertyValue::element_value
const Element * element_value
Definition smartsParser.h:217