BALL  1.5.0
smartsParser.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_STRUCTURE_SMARTES_PARSER_H
6 #define BALL_STRUCTURE_SMARTES_PARSER_H
7 
8 #ifndef BALL_COMMON_H
9  # include <BALL/common.h>
10 #endif
11 
12 #include <map>
13 #include <set>
14 
15 // needed for MSVC:
16 #undef CW_DEFAULT
17 
18 namespace BALL
19 {
20  // forward declarations
21  class Bond;
22  class Atom;
23  class Element;
24 
36  {
37  public:
38 
40  {
41  ANY_ZE = 1,
43  Z,
44  E
45  };
46 
49  {
50  CHIRAL_CLASS_UNSPECIFIED = 1,
53  CW_DEFAULT, // TH
55  CCW_DEFAULT, // TH
57  CW_TH, // tetrahdral
61  CW_AL, // allene-like
65  CW_SP, // square planar
69  CW_TB, //trigonal bipyramidal
73  CW_OH, // octahedral
76  CCW_OH_OR_UNSPECIFIED
77  };
78 
87  {
88  AND,
89  OR,
91  NOOP
92  };
93 
94 
96  class SPAtom;
97 
106  {
107  public:
108 
111  {
112  SINGLE = 1,
123  ANY
124  };
125 
129  SPBond();
131 
133  SPBond(SPBondOrder bond_order);
134 
136  SPBond(SPAtom* first, SPAtom* second, SPBondOrder bond_order);
137 
139  virtual ~SPBond() ;
141 
145  ZEIsomerType getZEType() const { return ze_type_; }
147 
149  void setZEType(ZEIsomerType type) { ze_type_ = type; }
150 
152  void setBondOrder(SPBondOrder bond_order);
153 
155  SPBondOrder getBondOrder() const { return bond_order_; }
156 
158  bool isNot() const { return not_; }
159 
161  void setNot(bool is_not) { not_ = is_not; }
162 
163  // returns true if the SPBond matches the given bond
164  bool equals(const Bond* bond) const;
166 
167  protected:
168 
171 
174 
176  bool not_;
177  };
178 
189  {
190  public:
191 
194  {
195  ISOTOPE = 1,
209  SYMBOL
210  };
211 
214  {
219  };
220 
222  struct Property
223  {
224  public:
225 
229  Property(PropertyType type, int value);
231 
233  Property(PropertyType type, bool value);
234 
236  Property(PropertyType type, const Element* value);
237 
240 
242  virtual ~Property();
244 
246  void operator = (const Property& rhs);
247 
251  PropertyType getType() const { return type_; }
253 
255  PropertyValue getValue() const { return value_; }
257 
258  private:
259 
261  Property();
262 
264  PropertyType type_;
265 
267  PropertyValue value_;
268  };
269 
307  SPAtom();
309 
311  SPAtom(const String& symbol);
312 
314  virtual ~SPAtom() ;
316 
317 
321  void setProperty(PropertyType type, int int_value);
323 
325  void setProperty(PropertyType type, bool flag);
326 
328  void setProperty(PropertyType type, const Element* element);
329 
331  void setProperty(PropertyType type, ChiralClass chirality);
332 
334  void setProperty(Property property);
335 
338 
341 
343  bool hasProperty(PropertyType type) const;
344 
347 
350 
352  Size getDefaultValence(const Atom* atom) const;
353 
355  Size countRealValences(const Atom* atom) const;
356 
360 
364  bool equals(const Atom* atom) const;
367 
368  protected:
369 
372 
374  std::map<PropertyType, PropertyValue> properties_;
375 
377  std::set<PropertyType> not_properties_;
378  };
379 
381  class SPNode;
382 
386  {
387  public:
388 
392  SPEdge();
394 
396  SPEdge(const SPEdge& sp_edge);
397 
399  virtual ~SPEdge();
401 
405  bool isInternal() const { return internal_; }
407 
409  void setInternal(bool internal) { internal_ = internal; }
410 
412  void setSPBond(SPBond* sp_bond) { bond_ = sp_bond; }
413 
415  SPBond* getSPBond() const { return bond_; }
416 
418  void setFirstSPNode(SPNode* first) { first_ = first; }
419 
421  SPNode* getFirstSPNode() const { return first_; }
422 
424  void setSecondSPNode(SPNode* second) { second_ = second; }
425 
427  SPNode* getSecondSPNode() const { return second_; }
428 
430  SPNode* getPartnerSPNode(SPNode* node) { return node == first_ ? second_ : first_; }
431 
433  bool isNot() const { return is_not_; }
434 
436  void setNot(bool is_not) { is_not_ = is_not; }
437 
439  void setFirstSPEdge(SPEdge* first) { first_edge_ = first; }
440 
442  SPEdge* getFirstSPEdge() const { return first_edge_; }
443 
445  void setSecondSPEdge(SPEdge* second) { second_edge_ = second; }
446 
448  SPEdge* getSecondSPEdge() const { return second_edge_; }
449 
451  void setLogicalOperator(LogicalOperator log_op) { log_op_ = log_op; }
452 
454  LogicalOperator getLogicalOperator() const { return log_op_; }
456 
457  protected:
458 
460  bool internal_;
461 
463  bool is_not_;
464 
467 
470 
473 
476 
479 
482  };
483 
487  {
488  public:
489 
493  typedef std::vector<SPEdge*>::iterator EdgeIterator;
495 
497  typedef std::vector<SPEdge*>::const_iterator EdgeConstIterator;
499 
500 
504  SPNode();
506 
508  SPNode(SPAtom* atom);
509 
511  SPNode(SPNode* first, LogicalOperator log_op, SPNode* second);
512 
514  SPNode(const SPNode& sp_node);
515 
517  virtual ~SPNode();
519 
520 
524  bool isInternal() const { return internal_; }
526 
528  void setInternal(bool internal) { internal_ = internal; }
529 
531  bool isRecursive() const { return recursive_; }
532 
534  void setRecursive(bool recursive);
535 
537  void setComponentNumber(int no) { component_no_ = no; }
538 
540  Size getComponentNumber() const { return component_no_; }
541 
543  SPAtom* getSPAtom() const { return sp_atom_; }
544 
546  void setSPAtom(SPAtom* sp_atom) { sp_atom_ = sp_atom; }
547 
549  SPEdge* getFirstEdge() const { return first_edge_; }
550 
552  void setFirstEdge(SPEdge* first) { first_edge_ = first; }
553 
555  SPEdge* getSecondEdge() const { return second_edge_; }
556 
558  void setSecondEdge(SPEdge* second) { second_edge_ = second; }
559 
561  bool getNot() const { return is_not_; }
562 
564  void setNot(bool is_not) { is_not_ = is_not; }
565 
566 
568  //void setInBrackets() { in_brackets_ = true; }
569 
571  void addSPEdge(SPEdge* sp_edge) { edges_.push_back(sp_edge); }
572 
574  void setLogicalOperator(LogicalOperator log_op) { log_op_ = log_op; }
575 
577  LogicalOperator getLogicalOperator() const { return log_op_; }
578 
580  Size countEdges() const { return edges_.size(); }
582 
586  EdgeIterator begin() { return edges_.begin(); }
588 
590  EdgeIterator end() { return edges_.end(); }
591 
593  EdgeConstIterator begin() const { return edges_.begin(); }
594 
596  EdgeConstIterator end() const { return edges_.end(); }
598 
599  protected:
600 
602  bool internal_;
603 
605  bool is_not_;
606 
609 
611  //bool in_brackets_;
612 
615 
617  std::vector<SPEdge*> edges_;
618 
621 
624 
627 
630  };
631 
632 
636  SmartsParser();
638 
640  SmartsParser(const SmartsParser& parser);
641 
643  virtual ~SmartsParser();
645 
652  void parse(const String& s);
653 
657  SPAtom* createAtom(const String& symbol, bool in_bracket = false);
659 
661  void setRoot(SPNode* root) { root_ = root; }
662 
664  SPNode* getRoot() const { return root_; }
665 
667  void dumpTree();
668 
670  void clear();
671 
673  void addRingConnection(SPNode* spnode, Size index);
674 
676  std::map<Size, std::vector<SPNode*> > getRingConnections() const;
677 
679  void setSSSR(const std::vector<std::vector<Atom*> >& sssr);
680 
682  void setNeedsSSSR(bool needs_sssr) { needs_SSSR_ = needs_sssr; }
683 
685  bool getNeedsSSSR() const { return needs_SSSR_; }
686 
688  void setRecursive(bool recursive) { recursive_ = recursive; }
689 
691  bool isRecursive() const { return recursive_; }
692 
694  void setComponentGrouping(bool component_grouping) { component_grouping_ = component_grouping; }
695 
697  bool hasComponentGrouping() const { return component_grouping_; }
698 
700  struct State
701  {
704  const char* buffer;
705  };
706 
708  static State state;
709 
711  const std::set<SPNode*>& getNodes() const { return nodes_; }
712 
714  const std::set<SPEdge*>& getEdges() const { return edges_; }
715 
717  void addEdge(SPEdge* edge) { edges_.insert(edge); }
718 
720  void addNode(SPNode* node) { nodes_.insert(node); }
721 
723  bool hasRecursiveEdge(SPEdge* edge) const { return rec_edges_.find(edge) != rec_edges_.end(); }
724 
726  void addRecursiveEdge(SPEdge* edge) { rec_edges_.insert(edge); }
727 
731 
732  protected:
733 
736 
739 
742 
744  static vector<std::set<const Atom*> >* sssr_;
745 
747  void dumpTreeRecursive_(SPNode* node, Size depth);
748 
750  void dumpTreeRecursive_(SPEdge* edge, Size depth);
751 
753  std::map<Size, std::vector<SPNode*> > ring_connections_;
754 
757 
759  std::set<SPEdge*> edges_;
760 
762  std::set<SPNode*> nodes_;
763 
765  std::set<SPEdge*> rec_edges_;
766 
769 
772  };
773 
774 } // namespace BALL
775 
776 #endif // BALL_STRUCTURE_SMARTS_PARSER_H
777 
BALL::SmartsParser::CW_DEFAULT
@ CW_DEFAULT
Definition: smartsParser.h:53
BALL::SmartsParser::getRoot
SPNode * getRoot() const
returns the root SPNode of the tree
Definition: smartsParser.h:664
BALL::SmartsParser::SPNode::getFirstEdge
SPEdge * getFirstEdge() const
returns the first edge (for tree use)
Definition: smartsParser.h:549
BALL::SmartsParser::SPAtom::atom_
Atom * atom_
the atom which this sp_atom belongs to
Definition: smartsParser.h:371
BALL::SmartsParser::addRecursiveEdge
void addRecursiveEdge(SPEdge *edge)
adds a recursive edge to the tree
Definition: smartsParser.h:726
BALL::SmartsParser::SPEdge::getSecondSPNode
SPNode * getSecondSPNode() const
returns the second SPNode of this edge
Definition: smartsParser.h:427
BALL::SmartsParser::CCW_AL_OR_UNSPECIFIED
@ CCW_AL_OR_UNSPECIFIED
Definition: smartsParser.h:64
BALL_EXPORT
#define BALL_EXPORT
Definition: COMMON/global.h:50
BALL::SmartsParser::OR
@ OR
Definition: smartsParser.h:89
BALL::SmartsParser::SPBond::TRIPLE
@ TRIPLE
Definition: smartsParser.h:120
BALL::SmartsParser::CW_TH_OR_UNSPECIFIED
@ CW_TH_OR_UNSPECIFIED
Definition: smartsParser.h:58
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::SPBond::SINGLE_UP
@ SINGLE_UP
Definition: smartsParser.h:113
BALL::SmartsParser::setSSSR
void setSSSR(const std::vector< std::vector< Atom * > > &sssr)
sets the SSSR
BALL::SmartsParser::SPAtom::getDefaultValence
Size getDefaultValence(const Atom *atom) const
return the number of valences of the given atom
BALL::SmartsParser::SPEdge::isNot
bool isNot() const
returns true if negation is enabled
Definition: smartsParser.h:433
BALL::SmartsParser::SPBond::not_
bool not_
general negation flag
Definition: smartsParser.h:176
BALL::SmartsParser::dumpTreeRecursive_
void dumpTreeRecursive_(SPNode *node, Size depth)
dump method for the tree
BALL::SmartsParser::CCW_DEFAULT
@ CCW_DEFAULT
Definition: smartsParser.h:55
BALL::SmartsParser::dumpTreeRecursive_
void dumpTreeRecursive_(SPEdge *edge, Size depth)
dump method for the tree
BALL::SmartsParser::SPNode::log_op_
LogicalOperator log_op_
in brackets flag
Definition: smartsParser.h:614
BALL::SmartsParser::SPNode::internal_
bool internal_
internal flag
Definition: smartsParser.h:602
BALL::SmartsParser::component_no_
int component_no_
the actual component number
Definition: smartsParser.h:771
BALL::SmartsParser::SPAtom::Property::~Property
virtual ~Property()
Destructor.
BALL::SmartsParser::SPAtom::IN_NUM_RINGS
@ IN_NUM_RINGS
Definition: smartsParser.h:199
BALL::SmartsParser::SPEdge
Edge representation of the smarts parser graph.
Definition: smartsParser.h:386
BALL::SmartsParser::CW_SP_OR_UNSPECIFIED
@ CW_SP_OR_UNSPECIFIED
Definition: smartsParser.h:66
BALL::SmartsParser::SPBond::SINGLE_OR_AROMATIC
@ SINGLE_OR_AROMATIC
Definition: smartsParser.h:117
BALL::SmartsParser::SPAtom::EXPLICIT_HYDROGENS
@ EXPLICIT_HYDROGENS
Definition: smartsParser.h:203
BALL::Bond
Definition: bond.h:57
BALL::SmartsParser::SPNode::SPNode
SPNode(const SPNode &sp_node)
Copy constructor.
BALL::SmartsParser::state
static State state
static member for the parser itself
Definition: smartsParser.h:708
BALL::SmartsParser::CCW_SP
@ CCW_SP
Definition: smartsParser.h:67
BALL::SmartsParser::SPEdge::setSecondSPEdge
void setSecondSPEdge(SPEdge *second)
set the second SPEdge (second tree child)
Definition: smartsParser.h:445
BALL::SmartsParser::AND
@ AND
Definition: smartsParser.h:88
BALL::SmartsParser::SPBond::~SPBond
virtual ~SPBond()
Destructor.
BALL::SmartsParser::CCW_TB
@ CCW_TB
Definition: smartsParser.h:71
BALL::SmartsParser::CW_OH
@ CW_OH
Definition: smartsParser.h:73
BALL::SmartsParser::SPNode::sp_atom_
SPAtom * sp_atom_
SPAtom associated with this SPNode.
Definition: smartsParser.h:626
BALL::SmartsParser::SPNode::setInternal
void setInternal(bool internal)
sets the internal flag
Definition: smartsParser.h:528
BALL::SmartsParser::addRingConnection
void addRingConnection(SPNode *spnode, Size index)
adds a ring connection, SPNode with an index used in the SMARTS pattern
BALL::SmartsParser::SPBond::SINGLE_DOWN
@ SINGLE_DOWN
Definition: smartsParser.h:115
BALL::SmartsParser::State::buffer
const char * buffer
Definition: smartsParser.h:704
BALL::SmartsParser
Definition: smartsParser.h:36
BALL::SmartsParser::SPEdge::is_not_
bool is_not_
negation flag
Definition: smartsParser.h:463
BALL::SmartsParser::needs_SSSR_
bool needs_SSSR_
sssr needed flag
Definition: smartsParser.h:735
BALL::SmartsParser::SPAtom::CHARGE
@ CHARGE
Definition: smartsParser.h:196
BALL::SmartsParser::State
Parser state (used by the parser itself)
Definition: smartsParser.h:701
BALL::Atom
Definition: atom.h:90
BALL::SmartsParser::SPBond::setZEType
void setZEType(ZEIsomerType type)
sets the Z/E isomer type
Definition: smartsParser.h:149
BALL::SmartsParser::SPEdge::getLogicalOperator
LogicalOperator getLogicalOperator() const
returns the asociated logical operator (for the child edges)
Definition: smartsParser.h:454
BALL::SmartsParser::SPAtom::Property
Property struct of smarts parser atom.
Definition: smartsParser.h:223
BALL::SmartsParser::SPEdge::setFirstSPNode
void setFirstSPNode(SPNode *first)
set the first SPNode of this edge
Definition: smartsParser.h:418
BALL::SmartsParser::SPBond::SINGLE_UP_OR_ANY
@ SINGLE_UP_OR_ANY
Definition: smartsParser.h:114
BALL::SmartsParser::SPAtom::IMPLICIT_HYDROGENS
@ IMPLICIT_HYDROGENS
Definition: smartsParser.h:205
BALL::SmartsParser::SPBond::IN_RING
@ IN_RING
Definition: smartsParser.h:122
BALL::Element
Definition: PTE.h:55
BALL::SmartsParser::SPNode::addSPEdge
void addSPEdge(SPEdge *sp_edge)
flag whether the pattern is in brackets
Definition: smartsParser.h:571
BALL::SmartsParser::SPBond::isNot
bool isNot() const
return true if a general negation is set
Definition: smartsParser.h:158
BALL::SmartsParser::SPEdge::getFirstSPNode
SPNode * getFirstSPNode() const
returns the first SPNode of this edge
Definition: smartsParser.h:421
BALL::SmartsParser::SPAtom::setProperty
void setProperty(PropertyType type, const Element *element)
sets a Element
BALL::SmartsParser::SPEdge::getFirstSPEdge
SPEdge * getFirstSPEdge() const
returns the first SPEdge (first tree child)
Definition: smartsParser.h:442
BALL::SmartsParser::SPNode::EdgeConstIterator
std::vector< SPEdge * >::const_iterator EdgeConstIterator
constant edge iterator
Definition: smartsParser.h:497
BALL::SmartsParser::CCW_AL
@ CCW_AL
Definition: smartsParser.h:63
BALL::SmartsParser::getNeedsSSSR
bool getNeedsSSSR() const
returns true if the SMARTS pattern contains ring related parts
Definition: smartsParser.h:685
BALL::SmartsParser::dumpTree
void dumpTree()
dumps the tree to cerr
BALL::String
Definition: string.h:57
BALL::SmartsParser::SPAtom
Smarts Parser Atom class.
Definition: smartsParser.h:189
BALL::SmartsParser::CCW_SP_OR_UNSPECIFIED
@ CCW_SP_OR_UNSPECIFIED
Definition: smartsParser.h:68
BALL::SmartsParser::hasComponentGrouping
bool hasComponentGrouping() const
returns true if the component level grouping was enabled
Definition: smartsParser.h:697
BALL::SmartsParser::CW_TB
@ CW_TB
Definition: smartsParser.h:69
BALL::SmartsParser::SPNode::getSPAtom
SPAtom * getSPAtom() const
returns the associated SPAtom
Definition: smartsParser.h:543
BALL::SmartsParser::SPEdge::getSPBond
SPBond * getSPBond() const
returns the corresponding SPBond of this edge
Definition: smartsParser.h:415
BALL::SmartsParser::SPNode::getSecondEdge
SPEdge * getSecondEdge() const
returns the second edge (for tree use)
Definition: smartsParser.h:555
BALL::SmartsParser::SPAtom::PropertyValue::chiral_class_value
ChiralClass chiral_class_value
Definition: smartsParser.h:218
BALL::SmartsParser::SPNode::begin
EdgeConstIterator begin() const
non-mutable access to begin of edges list
Definition: smartsParser.h:593
BALL::SmartsParser::SPAtom::setProperty
void setProperty(PropertyType type, ChiralClass chirality)
sets a chirality value
BALL::SmartsParser::SPEdge::getPartnerSPNode
SPNode * getPartnerSPNode(SPNode *node)
returns the partner; either the first or the second SPNode
Definition: smartsParser.h:430
BALL::SmartsParser::~SmartsParser
virtual ~SmartsParser()
Destructor.
BALL::SmartsParser::parse
void parse(const String &s)
BALL::SmartsParser::CCW_TH_OR_UNSPECIFIED
@ CCW_TH_OR_UNSPECIFIED
Definition: smartsParser.h:60
BALL
Definition: constants.h:13
BALL::SmartsParser::SPBond::DOUBLE
@ DOUBLE
Definition: smartsParser.h:119
BALL::SmartsParser::CCW_OH
@ CCW_OH
Definition: smartsParser.h:75
BALL::SmartsParser::SPAtom::not_properties_
std::set< PropertyType > not_properties_
the properties which are negated
Definition: smartsParser.h:377
BALL::SmartsParser::isRecursive
bool isRecursive() const
returns true if the tree represents a recursive SMARTS pattern
Definition: smartsParser.h:691
BALL::SmartsParser::SPAtom::Property::Property
Property(PropertyType type, ChiralClass value)
Detailed constructor with type and chiral class definition.
BALL::SmartsParser::SPEdge::~SPEdge
virtual ~SPEdge()
Destructor.
BALL::SmartsParser::SPAtom::properties_
std::map< PropertyType, PropertyValue > properties_
the properties of this SPAtom
Definition: smartsParser.h:374
BALL::SmartsParser::SPNode::~SPNode
virtual ~SPNode()
Destructor.
BALL::SmartsParser::SPAtom::VALENCE
@ VALENCE
Definition: smartsParser.h:204
BALL::SmartsParser::SPBond::setBondOrder
void setBondOrder(SPBondOrder bond_order)
sets the bond order
BALL::SmartsParser::SPNode::setSecondEdge
void setSecondEdge(SPEdge *second)
sets the second edge (for tree use)
Definition: smartsParser.h:558
BALL::SmartsParser::SPEdge::getSecondSPEdge
SPEdge * getSecondSPEdge() const
returns the second SPEdge (second tree child)
Definition: smartsParser.h:448
BALL::SmartsParser::SPNode::edges_
std::vector< SPEdge * > edges_
edges list
Definition: smartsParser.h:617
BALL::SmartsParser::SPNode::end
EdgeConstIterator end() const
non-mutable access to end of edges list
Definition: smartsParser.h:596
BALL::SmartsParser::CW_AL
@ CW_AL
Definition: smartsParser.h:61
BALL::SmartsParser::CCW_DEFAULT_OR_UNSPECIFIED
@ CCW_DEFAULT_OR_UNSPECIFIED
Definition: smartsParser.h:56
BALL::SmartsParser::State::current_parser
SmartsParser * current_parser
Definition: smartsParser.h:703
BALL::SmartsParser::SPBond::NOT_NECESSARILY_CONNECTED
@ NOT_NECESSARILY_CONNECTED
Definition: smartsParser.h:121
BALL::SmartsParser::getEdges
const std::set< SPEdge * > & getEdges() const
returns the edges stored in the tree
Definition: smartsParser.h:714
BALL::PDB::Atom
char Atom[5]
Definition: PDBdefs.h:257
BALL::SmartsParser::SPEdge::first_
SPNode * first_
first SPNode
Definition: smartsParser.h:466
BALL::SmartsParser::SPAtom::AROMATIC
@ AROMATIC
Definition: smartsParser.h:197
BALL::SmartsParser::SPAtom::Property::Property
Property(PropertyType type, bool value)
Detailed constructor with type and flag.
BALL::SmartsParser::CW_TH
@ CW_TH
Definition: smartsParser.h:57
BALL::SmartsParser::SPEdge::second_edge_
SPEdge * second_edge_
second SPEdge
Definition: smartsParser.h:478
BALL::SmartsParser::current_parser_
static SmartsParser * current_parser_
current instance
Definition: smartsParser.h:756
BALL::SmartsParser::SPNode::setRecursive
void setRecursive(bool recursive)
sets the recursive flag
BALL::SmartsParser::SPAtom::SPAtom
SPAtom(const String &symbol)
copy constructor
BALL::SmartsParser::SPAtom::addPropertiesFromSPAtom
void addPropertiesFromSPAtom(SPAtom *sp_atom)
adds properties from another SPAtom
BALL::SmartsParser::SPBond::SPBondOrder
SPBondOrder
the bond orders supported by SMARTS-patterns
Definition: smartsParser.h:111
BALL::SmartsParser::SPNode::recursive_
bool recursive_
recursive flag
Definition: smartsParser.h:608
BALL::SmartsParser::SPNode::getComponentNumber
Size getComponentNumber() const
returns the component number
Definition: smartsParser.h:540
BALL::SmartsParser::component_grouping_
bool component_grouping_
component level grouping flag
Definition: smartsParser.h:741
BALL::SmartsParser::SPNode::setNot
void setNot(bool is_not)
sets the negation flag
Definition: smartsParser.h:564
BALL::SmartsParser::SPNode::setLogicalOperator
void setLogicalOperator(LogicalOperator log_op)
sets the logical operator associated with the SPNode
Definition: smartsParser.h:574
BALL::SmartsParser::SPBond::bond_order_
SPBondOrder bond_order_
the bond order
Definition: smartsParser.h:173
BALL_SIZE_TYPE
BALL::SmartsParser::SPAtom::CHIRALITY
@ CHIRALITY
Definition: smartsParser.h:208
BALL::SmartsParser::SPEdge::setInternal
void setInternal(bool internal)
set this edge to a internal edge
Definition: smartsParser.h:409
BALL::SmartsParser::SPAtom::Property::getValue
PropertyValue getValue() const
returns the value of the property
Definition: smartsParser.h:255
BALL::SmartsParser::SPAtom::PropertyType
PropertyType
enum of all properties possible for a smarts parser atom
Definition: smartsParser.h:194
BALL::SmartsParser::SPAtom::~SPAtom
virtual ~SPAtom()
destructor
BALL::SmartsParser::SPEdge::second_
SPNode * second_
second SPNode
Definition: smartsParser.h:469
BALL::SmartsParser::CW_OH_OR_UNSPECIFIED
@ CW_OH_OR_UNSPECIFIED
Definition: smartsParser.h:74
BALL::SmartsParser::getRingConnections
std::map< Size, std::vector< SPNode * > > getRingConnections() const
returns the ring connections sorted by index from SMARTS pattern
BALL::SmartsParser::SPBond::ze_type_
ZEIsomerType ze_type_
Z/E isomer type.
Definition: smartsParser.h:170
BALL::SmartsParser::SPNode::is_not_
bool is_not_
negotiation flag
Definition: smartsParser.h:605
BALL::SmartsParser::setRecursive
void setRecursive(bool recursive)
sets the recursive flag
Definition: smartsParser.h:688
BALL::SmartsParser::SmartsParser
SmartsParser(const SmartsParser &parser)
Copy constructor.
BALL::SmartsParser::SPNode::SPNode
SPNode(SPAtom *atom)
Detailed constructor with an atom.
BALL::SmartsParser::CW_SP
@ CW_SP
Definition: smartsParser.h:65
BALL::SmartsParser::root_
SPNode * root_
the root node of the tree
Definition: smartsParser.h:768
BALL::SmartsParser::CCW_TB_OR_UNSPECIFIED
@ CCW_TB_OR_UNSPECIFIED
Definition: smartsParser.h:72
BALL::SmartsParser::SPEdge::setSecondSPNode
void setSecondSPNode(SPNode *second)
sets the second SPNode of this edge
Definition: smartsParser.h:424
BALL::SmartsParser::CCW_TH
@ CCW_TH
Definition: smartsParser.h:59
BALL::SmartsParser::SPNode::end
EdgeIterator end()
mutable access to end of edges list
Definition: smartsParser.h:590
BALL::SmartsParser::hasRecursiveEdge
bool hasRecursiveEdge(SPEdge *edge) const
returns true if the tree has the given recursive edge
Definition: smartsParser.h:723
BALL::SmartsParser::SPNode::setComponentNumber
void setComponentNumber(int no)
set the component no of the component level grouping
Definition: smartsParser.h:537
BALL::SmartsParser::SPAtom::PropertyValue::bool_value
bool bool_value
Definition: smartsParser.h:216
BALL::SmartsParser::setRoot
void setRoot(SPNode *root)
sets the root SPNode of the tree
Definition: smartsParser.h:661
BALL::SmartsParser::CW_TB_OR_UNSPECIFIED
@ CW_TB_OR_UNSPECIFIED
Definition: smartsParser.h:70
BALL::SmartsParser::ChiralClass
ChiralClass
chiral class definitions CW = clock wise, CCW = counter clock wise
Definition: smartsParser.h:49
BALL::SmartsParser::SPAtom::CONNECTED
@ CONNECTED
Definition: smartsParser.h:202
BALL::SmartsParser::SPNode::countEdges
Size countEdges() const
counts the number of edges
Definition: smartsParser.h:580
BALL::SmartsParser::SPAtom::PropertyValue::int_value
int int_value
Definition: smartsParser.h:215
BALL::SmartsParser::SPAtom::RING_CONNECTED
@ RING_CONNECTED
Definition: smartsParser.h:207
BALL::SmartsParser::SPEdge::setNot
void setNot(bool is_not)
set the negation flag
Definition: smartsParser.h:436
BALL::Property
BALL_SIZE_TYPE Property
Definition: COMMON/global.h:165
BALL::SmartsParser::setNextComponentNumberToSubTree
void setNextComponentNumberToSubTree(SPNode *spnode)
gets the next component no and assigns it to the subtree
BALL::SmartsParser::setNeedsSSSR
void setNeedsSSSR(bool needs_sssr)
sets the sssr needed flag
Definition: smartsParser.h:682
BALL::SmartsParser::SPEdge::setLogicalOperator
void setLogicalOperator(LogicalOperator log_op)
sets the associated logical operator (for the child edges)
Definition: smartsParser.h:451
BALL::SmartsParser::SPAtom::countProperties
Size countProperties() const
returns the number of properties
BALL::SmartsParser::SPAtom::setNotProperty
void setNotProperty(PropertyType type)
negotiates the property definition
BALL::SmartsParser::NONE
@ NONE
Definition: smartsParser.h:42
BALL::SmartsParser::SPBond::SINGLE_DOWN_OR_ANY
@ SINGLE_DOWN_OR_ANY
Definition: smartsParser.h:116
BALL::SmartsParser::SPAtom::Property::Property
Property(PropertyType type, const Element *value)
Detailed constructor with type and Element.
BALL::SmartsParser::SPNode::second_edge_
SPEdge * second_edge_
second edge
Definition: smartsParser.h:623
BALL::SmartsParser::SPEdge::log_op_
LogicalOperator log_op_
logical operator associated with the SPEdges
Definition: smartsParser.h:481
BALL::SmartsParser::SPAtom::PropertyValue::element_value
const Element * element_value
Definition: smartsParser.h:217
common.h
BALL::SmartsParser::SPEdge::setFirstSPEdge
void setFirstSPEdge(SPEdge *first)
set the first SPEdge (first tree child)
Definition: smartsParser.h:439
BALL::SmartsParser::SPAtom::ALIPHATIC
@ ALIPHATIC
Definition: smartsParser.h:198
BALL::SmartsParser::SPNode::setSPAtom
void setSPAtom(SPAtom *sp_atom)
set the associated SPAtom
Definition: smartsParser.h:546
BALL::SmartsParser::nodes_
std::set< SPNode * > nodes_
the nodes
Definition: smartsParser.h:762
BALL::SmartsParser::SPNode::component_no_
int component_no_
component level
Definition: smartsParser.h:629
BALL::SmartsParser::rec_edges_
std::set< SPEdge * > rec_edges_
the recursive edges
Definition: smartsParser.h:765
BALL::SmartsParser::SPNode::first_edge_
SPEdge * first_edge_
first edge
Definition: smartsParser.h:620
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::SPAtom::setProperty
void setProperty(Property property)
sets a property
BALL::SmartsParser::clear
void clear()
clear the tree
BALL::SmartsParser::SPAtom::setProperty
void setProperty(PropertyType type, bool flag)
sets a flag
BALL::SmartsParser::SPEdge::first_edge_
SPEdge * first_edge_
first SPEdge
Definition: smartsParser.h:475
BALL::SmartsParser::SPNode::getLogicalOperator
LogicalOperator getLogicalOperator() const
returns the logical operator of the SPNode
Definition: smartsParser.h:577
BALL::SmartsParser::SPAtom::IN_RING_SIZE
@ IN_RING_SIZE
Definition: smartsParser.h:200
BALL::SmartsParser::SPAtom::IN_BRACKETS
@ IN_BRACKETS
Definition: smartsParser.h:201
BALL::SmartsParser::recursive_
bool recursive_
recursive flag
Definition: smartsParser.h:738
BALL::SmartsParser::SPBond::getBondOrder
SPBondOrder getBondOrder() const
returns the bond order
Definition: smartsParser.h:155
BALL::SmartsParser::SPNode
Representation of a node in the smarts parser graph.
Definition: smartsParser.h:487
BALL::SmartsParser::SPEdge::bond_
SPBond * bond_
associated bond
Definition: smartsParser.h:472
BALL::SmartsParser::SPBond::SPBond
SPBond(SPBondOrder bond_order)
Detailed constructor with bond order.
BALL::SmartsParser::SPEdge::internal_
bool internal_
internal flag
Definition: smartsParser.h:460
BALL::SmartsParser::SPEdge::setSPBond
void setSPBond(SPBond *sp_bond)
sets the corresponding SPBond of this edge
Definition: smartsParser.h:412
BALL::SmartsParser::SPNode::EdgeIterator
std::vector< SPEdge * >::iterator EdgeIterator
non-constant edge iterator
Definition: smartsParser.h:494
BALL::SmartsParser::SPAtom::DEGREE
@ DEGREE
Definition: smartsParser.h:206
BALL::Constants::E
BALL_EXTERN_VARIABLE const double E
Euler's number - base of the natural logarithm.
Definition: constants.h:38
BALL::SmartsParser::SPAtom::PropertyValue
possible types of the properties
Definition: smartsParser.h:214
BALL::SmartsParser::SPAtom::countRealValences
Size countRealValences(const Atom *atom) const
returns the number of available valences of the given atom
BALL::SmartsParser::ZEIsomerType
ZEIsomerType
Definition: smartsParser.h:40
BALL::SmartsParser::SPBond::AROMATIC
@ AROMATIC
Definition: smartsParser.h:118
BALL::SmartsParser::SPNode::setFirstEdge
void setFirstEdge(SPEdge *first)
sets the first edge (for tree use)
Definition: smartsParser.h:552
BALL::SmartsParser::SPBond::equals
bool equals(const Bond *bond) const
BALL::SmartsParser::edges_
std::set< SPEdge * > edges_
the edges
Definition: smartsParser.h:759
BALL::SmartsParser::CW_DEFAULT_OR_UNSPECIFIED
@ CW_DEFAULT_OR_UNSPECIFIED
Definition: smartsParser.h:54
BALL::SmartsParser::SPEdge::SPEdge
SPEdge(const SPEdge &sp_edge)
Copy constructor.
BALL::SmartsParser::SPBond::setNot
void setNot(bool is_not)
set the general negation to the bool given
Definition: smartsParser.h:161
BALL::SmartsParser::CW_AL_OR_UNSPECIFIED
@ CW_AL_OR_UNSPECIFIED
Definition: smartsParser.h:62
BALL::SmartsParser::setComponentGrouping
void setComponentGrouping(bool component_grouping)
sets the component level flag
Definition: smartsParser.h:694
BALL::SmartsParser::SPNode::SPNode
SPNode(SPNode *first, LogicalOperator log_op, SPNode *second)
Detailed constructor with two nodes and a logical operator.
BALL::SmartsParser::SPBond
Bond representation of the smarts parser.
Definition: smartsParser.h:106
BALL::SmartsParser::LogicalOperator
LogicalOperator
Definition: smartsParser.h:87
BALL::SmartsParser::SPAtom::getProperty
PropertyValue getProperty(PropertyType type)
returns a value of the given property type
BALL::SmartsParser::SPBond::SPBond
SPBond(SPAtom *first, SPAtom *second, SPBondOrder bond_order)
Detailed constructor with.
BALL::SmartsParser::Z
@ Z
Definition: smartsParser.h:43
BALL::SmartsParser::SPAtom::getNumberOfImplicitHydrogens
Size getNumberOfImplicitHydrogens(const Atom *atom) const
returns the number of implicit hydrogens of the given atom
BALL::SmartsParser::SPNode::getNot
bool getNot() const
returns the negation flag
Definition: smartsParser.h:561
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::NONCHIRAL_OR_UNSPECIFIED
@ NONCHIRAL_OR_UNSPECIFIED
Definition: smartsParser.h:52
BALL::SmartsParser::SPAtom::hasProperty
bool hasProperty(PropertyType type) const
returns true if the property is set
BALL::SmartsParser::addNode
void addNode(SPNode *node)
adds a node to the tree
Definition: smartsParser.h:720
BALL::SmartsParser::addEdge
void addEdge(SPEdge *edge)
adds an edge to the tree
Definition: smartsParser.h:717
BALL::SmartsParser::NONCHIRAL
@ NONCHIRAL
Definition: smartsParser.h:51
BALL::SmartsParser::State::char_count
Size char_count
Definition: smartsParser.h:702
BALL::SmartsParser::AND_LOW
@ AND_LOW
Definition: smartsParser.h:90