5 #ifndef BALL_STRUCTURE_SMARTES_PARSER_H
6 #define BALL_STRUCTURE_SMARTES_PARSER_H
50 CHIRAL_CLASS_UNSPECIFIED = 1,
133 SPBond(SPBondOrder bond_order);
152 void setBondOrder(SPBondOrder bond_order);
161 void setNot(
bool is_not) { not_ = is_not; }
164 bool equals(
const Bond* bond)
const;
246 void operator = (
const Property& rhs);
321 void setProperty(PropertyType type,
int int_value);
325 void setProperty(PropertyType type,
bool flag);
328 void setProperty(PropertyType type,
const Element* element);
331 void setProperty(PropertyType type,
ChiralClass chirality);
334 void setProperty(
Property property);
337 void addPropertiesFromSPAtom(
SPAtom* sp_atom);
340 void setNotProperty(PropertyType type);
343 bool hasProperty(PropertyType type)
const;
346 PropertyValue getProperty(PropertyType type);
349 Size countProperties()
const;
352 Size getDefaultValence(
const Atom* atom)
const;
355 Size countRealValences(
const Atom* atom)
const;
358 Size getNumberOfImplicitHydrogens(
const Atom* atom)
const;
364 bool equals(
const Atom* atom)
const;
405 bool isInternal()
const {
return internal_; }
433 bool isNot()
const {
return is_not_; }
436 void setNot(
bool is_not) { is_not_ = is_not; }
524 bool isInternal()
const {
return internal_; }
534 void setRecursive(
bool recursive);
564 void setNot(
bool is_not) { is_not_ = is_not; }
586 EdgeIterator begin() {
return edges_.begin(); }
651 void parse(
const String& s)
657 SPAtom* createAtom(
const String& symbol,
bool in_bracket =
false);
673 void addRingConnection(SPNode* spnode,
Size index);
676 std::map<Size, std::vector<SPNode*> > getRingConnections()
const;
679 void setSSSR(
const std::vector<std::vector<Atom*> >& sssr);
711 const std::set<SPNode*>&
getNodes()
const {
return nodes_; }
714 const std::set<SPEdge*>&
getEdges()
const {
return edges_; }
729 void setNextComponentNumberToSubTree(SPNode* spnode);
744 static vector<std::set<const Atom*> >*
sssr_;
747 void dumpTreeRecursive_(
SPNode* node,
Size depth);
750 void dumpTreeRecursive_(
SPEdge* edge,
Size depth);
776 #endif // BALL_STRUCTURE_SMARTS_PARSER_H
bool recursive_
recursive flag
SmartsParser * current_parser
static vector< std::set< const Atom * > > * sssr_
the sssr
SPBondOrder
the bond orders supported by SMARTS-patterns
static State state
static member for the parser itself
BALL_EXTERN_VARIABLE const double E
Euler's number - base of the natural logarithm.
SPNode * second_
second SPNode
ZEIsomerType ze_type_
Z/E isomer type.
bool getNot() const
returns the negation flag
const std::set< SPEdge * > & getEdges() const
returns the edges stored in the tree
void setFirstSPNode(SPNode *first)
set the first SPNode of this edge
PropertyValue getValue() const
returns the value of the property
void setFirstEdge(SPEdge *first)
sets the first edge (for tree use)
void setSPAtom(SPAtom *sp_atom)
set the associated SPAtom
void setSecondEdge(SPEdge *second)
sets the second edge (for tree use)
bool recursive_
recursive flag
bool needs_SSSR_
sssr needed flag
LogicalOperator getLogicalOperator() const
returns the logical operator of the SPNode
bool isNot() const
return true if a general negation is set
Atom * atom_
the atom which this sp_atom belongs to
void setComponentGrouping(bool component_grouping)
sets the component level flag
bool hasRecursiveEdge(SPEdge *edge) const
returns true if the tree has the given recursive edge
bool isRecursive() const
returns true if the tree represents a recursive SMARTS pattern
void setLogicalOperator(LogicalOperator log_op)
sets the logical operator associated with the SPNode
SPBondOrder getBondOrder() const
returns the bond order
SPNode * first_
first SPNode
const Element * element_value
void addSPEdge(SPEdge *sp_edge)
flag whether the pattern is in brackets
std::set< SPNode * > nodes_
the nodes
EdgeConstIterator begin() const
non-mutable access to begin of edges list
SPAtom * sp_atom_
SPAtom associated with this SPNode.
SPNode * root_
the root node of the tree
std::vector< SPEdge * >::iterator EdgeIterator
non-constant edge iterator
std::set< PropertyType > not_properties_
the properties which are negated
ChiralClass
chiral class definitions CW = clock wise, CCW = counter clock wise
LogicalOperator getLogicalOperator() const
returns the asociated logical operator (for the child edges)
SPEdge * getSecondEdge() const
returns the second edge (for tree use)
SPEdge * first_edge_
first SPEdge
std::map< PropertyType, PropertyValue > properties_
the properties of this SPAtom
Smarts Parser Atom class.
SPAtom * getSPAtom() const
returns the associated SPAtom
void setNeedsSSSR(bool needs_sssr)
sets the sssr needed flag
LogicalOperator log_op_
in brackets flag
Representation of a node in the smarts parser graph.
void setInternal(bool internal)
set this edge to a internal edge
SPBond * bond_
associated bond
bool isNot() const
returns true if negation is enabled
SPEdge * getFirstSPEdge() const
returns the first SPEdge (first tree child)
void setComponentNumber(int no)
set the component no of the component level grouping
EdgeConstIterator end() const
non-mutable access to end of edges list
void setNot(bool is_not)
set the general negation to the bool given
std::set< SPEdge * > rec_edges_
the recursive edges
void setZEType(ZEIsomerType type)
sets the Z/E isomer type
Size countEdges() const
counts the number of edges
SPNode * getSecondSPNode() const
returns the second SPNode of this edge
void setSecondSPEdge(SPEdge *second)
set the second SPEdge (second tree child)
void addEdge(SPEdge *edge)
adds an edge to the tree
std::vector< SPEdge * >::const_iterator EdgeConstIterator
constant edge iterator
bool getNeedsSSSR() const
returns true if the SMARTS pattern contains ring related parts
Property struct of smarts parser atom.
ChiralClass chiral_class_value
bool internal_
internal flag
bool hasComponentGrouping() const
returns true if the component level grouping was enabled
Bond representation of the smarts parser.
const std::set< SPNode * > & getNodes() const
returns the eodes stored in the tree
bool component_grouping_
component level grouping flag
SPEdge * second_edge_
second edge
SPEdge * getSecondSPEdge() const
returns the second SPEdge (second tree child)
void setNot(bool is_not)
sets the negation flag
void setSPBond(SPBond *sp_bond)
sets the corresponding SPBond of this edge
SPBondOrder bond_order_
the bond order
void addRecursiveEdge(SPEdge *edge)
adds a recursive edge to the tree
SPNode * getRoot() const
returns the root SPNode of the tree
std::vector< SPEdge * > edges_
edges list
LogicalOperator log_op_
logical operator associated with the SPEdges
SPNode * getFirstSPNode() const
returns the first SPNode of this edge
void setLogicalOperator(LogicalOperator log_op)
sets the associated logical operator (for the child edges)
std::set< SPEdge * > edges_
the edges
SPEdge * first_edge_
first edge
bool internal_
internal flag
Parser state (used by the parser itself)
bool isRecursive() const
returns true if the SPNode is a recursive node (from recursive SMARTS)
std::map< Size, std::vector< SPNode * > > ring_connections_
the ring connection sorted by index of the SMARTS pattern
Edge representation of the smarts parser graph.
PropertyType
enum of all properties possible for a smarts parser atom
Size getComponentNumber() const
returns the component number
static SmartsParser * current_parser_
current instance
possible types of the properties
int component_no_
component level
void setNot(bool is_not)
set the negation flag
void setFirstSPEdge(SPEdge *first)
set the first SPEdge (first tree child)
void setInternal(bool internal)
sets the internal flag
void addNode(SPNode *node)
adds a node to the tree
SPEdge * second_edge_
second SPEdge
void setRecursive(bool recursive)
sets the recursive flag
SPNode * getPartnerSPNode(SPNode *node)
returns the partner; either the first or the second SPNode
bool is_not_
negotiation flag
bool is_not_
negation flag
void setRoot(SPNode *root)
sets the root SPNode of the tree
void setSecondSPNode(SPNode *second)
sets the second SPNode of this edge
EdgeIterator end()
mutable access to end of edges list
SPEdge * getFirstEdge() const
returns the first edge (for tree use)
SPBond * getSPBond() const
returns the corresponding SPBond of this edge
bool not_
general negation flag
int component_no_
the actual component number