2.2.16. RuleGraphInterface.h

This header contains the defintinos for the graph interface for mod::Rule.

2.2.16.1. Left

2.2.16.1.1. Class Rule::LeftGraph

class Rule::LeftGraph

A proxy object representing the left graph of the rule.

std::shared_ptr<Rule> getRule() const
Returns:the rule where the graph belongs to.
std::size_t numVertices() const
Returns:the number of vertices in the graph.
VertexRange vertices() const
Returns:a range of all vertices in the graph.
std::size_t numEdges() const
Returns:the number of edges in the graph.
EdgeRange edges() const
Returns:a range of all edges in the graph.

2.2.16.1.2. Class Rule::LeftGraph::Vertex

class Rule::LeftGraph::Vertex

A descriptor of either a vertex in a rule, or a null vertex.

2.2.16.1.2.1. Synopsis

class Rule::LeftGraph::Vertex {
    friend class Rule::Vertex;
    friend class LeftGraph;
    friend class Edge;
    friend class VertexIterator;
    friend class VertexRange;
    Vertex(std::shared_ptr<Rule> r, std::size_t vId);
public:
    Vertex();
    friend std::ostream &operator<<(std::ostream &s, const Vertex &v);
    friend bool operator==(const Vertex &v1, const Vertex &v2);
    friend bool operator!=(const Vertex &v1, const Vertex &v2);
    friend bool operator<(const Vertex &v1, const Vertex &v2);
    bool isNull() const;
    std::size_t getId() const;
    std::shared_ptr<Rule> getRule() const;
    Rule::Vertex getCore() const;
    std::size_t getDegree() const;
    IncidentEdgeRange incidentEdges() const;
    const std::string &getStringLabel() const;
    AtomId getAtomId() const;
    Charge getCharge() const;
    bool getRadical() const;
private:
    std::shared_ptr<Rule> r;
    std::size_t vId;
};

2.2.16.1.2.2. Details

Vertex()

Constructs a null descriptor.

bool isNull() const
Returns:whether this is a null descriptor or not.
std::size_t getId() const
Returns:the index of the vertex. It will be in the range \([0, numVertices[\).
Throws:LogicError if it is a null descriptor.
std::shared_ptr<Rule> getRule() const
Returns:the rule the vertex belongs to.
Throws:LogicError if it is a null descriptor.
Rule::Vertex getCore() const
Returns:the descriptor for this vertex in the core graph.
std::size_t getDegree() const
Returns:the degree of the vertex.
Throws:LogicError if it is a null descriptor.
IncidentEdgeRange incidentEdges() const
Returns:a range of incident edges to this vertex.
Throws:LogicError if it is a null descriptor.
const std::string &getStringLabel() const
Returns:the string label of the vertex.
Throws:LogicError if it is a null descriptor.
AtomId getAtomId() const
Returns:the atom id of the vertex.
Throws:LogicError if it is a null descriptor.
Charge getCharge() const
Returns:the charge of the vertex.
Throws:LogicError if it is a null descriptor.
bool getRadical() const
Returns:the radical status of the vertex.
Throws:LogicError if it is a null descriptor.

2.2.16.1.3. Class Rule::LeftGraph::Edge

class Rule::LeftGraph::Edge

A descriptor of either an edge in a rule, or a null edge.

2.2.16.1.3.1. Synopsis

class Rule::LeftGraph::Edge {
    friend class Rule::Edge;
    friend class EdgeIterator;
    friend class IncidentEdgeIterator;
    Edge(std::shared_ptr<Rule> r, std::size_t vId, std::size_t eId);
public:
    Edge();
    friend std::ostream &operator<<(std::ostream &s, const Edge &e);
    friend bool operator==(const Edge &e1, const Edge &e2);
    friend bool operator!=(const Edge &e1, const Edge &e2);
    friend bool operator<(const Edge &e1, const Edge &e2);
    bool isNull() const;
    std::shared_ptr<Rule> getRule() const;
    Rule::Edge getCore() const;
    Vertex source() const;
    Vertex target() const;
    const std::string &getStringLabel() const;
    BondType getBondType() const;
private:
    std::shared_ptr<Rule> r;
    std::size_t vId, eId;
};

2.2.16.1.3.2. Details

Edge()

Constructs a null descriptor.

bool isNull() const
Returns:whether this is a null descriptor or not.
std::shared_ptr<Rule> getRule() const
Returns:the rule the edge belongs to.
Throws:LogicError if it is a null descriptor.
Rule::edge getCore() const
Returns:the descriptor for this edge in the core graph.
Vertex source() const
Returns:the source vertex of the edge.
Throws:LogicError if it is a null descriptor.
Vertex target() const
Returns:the target vertex of the edge.
Throws:LogicError if it is a null descriptor.
const std::string &getStringLabel() const
Returns:the string label of the edge.
Throws:LogicError if it is a null descriptor.
BondType getBondType() const
Returns:the bond type of the edge.
Throws:LogicError if it is a null descriptor.

2.2.16.1.4. Class Rule::LeftGraph::VertexIterator

class Rule::LeftGraph::VertexIterator

An iterator for traversing all vertices in a rule. It models a forward iterator.

2.2.16.1.4.1. Synopsis

class Rule::LeftGraph::VertexIterator : public boost::iterator_facade<VertexIterator, Vertex, std::forward_iterator_tag, Vertex> {
    friend class Rule;
    VertexIterator(std::shared_ptr<Rule> r);
public:
    VertexIterator();
private:
    friend class boost::iterator_core_access;
    Vertex dereference() const;
    bool equal(const VertexIterator &iter) const;
    void increment();
private:
    std::shared_ptr<Rule> r;
    std::size_t vId;
};

2.2.16.1.4.2. Details

VertexIterator()

Construct a past-the-end iterator.

2.2.16.1.5. Class Rule::LeftGraph::VertexRange

class Rule::LeftGraph::VertexRange

A range of all vertices in a rule.

2.2.16.1.6. Class Rule::LeftGraph::EdgeIterator

class Rule::LeftGraph::EdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

2.2.16.1.6.1. Synopsis

class Rule::LeftGraph::EdgeIterator : public boost::iterator_facade<EdgeIterator, Edge, std::forward_iterator_tag, Edge> {
    friend class Rule;
    EdgeIterator(std::shared_ptr<Rule> r);
public:
    EdgeIterator();
private:
    friend class boost::iterator_core_access;
    Edge dereference() const;
    bool equal(const EdgeIterator &iter) const;
    void increment();
    void advanceToValid();
private:
    std::shared_ptr<Rule> r;
    std::size_t vId, eId;
};

2.2.16.1.6.2. Details

EdgeIterator()

Construct a past-the-end iterator.

2.2.16.1.7. Class Rule::LeftGraph::EdgeRange

class Rule::LeftGraph::EdgeRange

A range of all edges in a rule.

2.2.16.1.8. Class Rule::LeftGraph::IncidnetEdgeIterator

class Rule::LeftGraph::IncidnetEdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

2.2.16.1.8.1. Synopsis

class Rule::LeftGraph::IncidentEdgeIterator : public boost::iterator_facade<IncidentEdgeIterator, Edge, std::forward_iterator_tag, Edge> {
    friend class Rule;
    IncidentEdgeIterator(std::shared_ptr<Rule> r, std::size_t vId);
public:
    IncidentEdgeIterator();
private:
    friend class boost::iterator_core_access;
    Edge dereference() const;
    bool equal(const IncidentEdgeIterator &iter) const;
    void increment();
private:
    std::shared_ptr<Rule> r;
    std::size_t vId, eId;
};

2.2.16.1.8.2. Details

IncidentEdgeIterator()

Construct a past-the-end iterator.

2.2.16.1.9. Class Rule::LeftGraph::IncidentEdgeRange

class Rule::LeftGraph::IncidentEdgeRange

A range of all incident edges to a vertex in a rule.

2.2.16.2. Context

2.2.16.2.1. Class Rule::ContextGraph

class Rule::ContextGraph

A proxy object representing the context graph of the rule.

std::shared_ptr<Rule> getRule() const
Returns:the rule where the graph belongs to.
std::size_t numVertices() const
Returns:the number of vertices in the graph.
VertexRange vertices() const
Returns:a range of all vertices in the graph.
std::size_t numEdges() const
Returns:the number of edges in the graph.
EdgeRange edges() const
Returns:a range of all edges in the graph.

2.2.16.2.2. Class Rule::ContextGraph::Vertex

class Rule::ContextGraph::Vertex

A descriptor of either a vertex in a rule, or a null vertex.

2.2.16.2.2.1. Synopsis

class Rule::ContextGraph::Vertex {
    friend class Rule;
    friend class Edge;
    friend class VertexIterator;
    friend class VertexRange;
    Vertex(std::shared_ptr<Rule> r, std::size_t vId);
public:
    Vertex();
    friend std::ostream &operator<<(std::ostream &s, const Vertex &v);
    friend bool operator==(const Vertex &v1, const Vertex &v2);
    friend bool operator!=(const Vertex &v1, const Vertex &v2);
    friend bool operator<(const Vertex &v1, const Vertex &v2);
    bool isNull() const;
    std::size_t getId() const;
    std::shared_ptr<Rule> getRule() const;
    Rule::Vertex getCore() const;
    std::size_t getDegree() const;
    IncidentEdgeRange incidentEdges() const;
private:
    std::shared_ptr<Rule> r;
    std::size_t vId;
};

2.2.16.2.2.2. Details

Vertex()

Constructs a null descriptor.

bool isNull() const
Returns:whether this is a null descriptor or not.
std::size_t getId() const
Returns:the index of the vertex. It will be in the range \([0, numVertices[\).
Throws:LogicError if it is a null descriptor.
std::shared_ptr<Rule> getRule() const
Returns:the rule the vertex belongs to.
Throws:LogicError if it is a null descriptor.
Rule::Vertex getCore() const
Returns:the descriptor for this vertex in the core graph.
std::size_t getDegree() const
Returns:the degree of the vertex.
Throws:LogicError if it is a null descriptor.
IncidentEdgeRange incidentEdges() const
Returns:a range of incident edges to this vertex.
Throws:LogicError if it is a null descriptor.

2.2.16.2.3. Class Rule::ContextGraph::Edge

class Rule::ContextGraph::Edge

A descriptor of either an edge in a rule, or a null edge.

2.2.16.2.3.1. Synopsis

class Rule::ContextGraph::Edge {
    friend class Rule::Edge;
    friend class EdgeIterator;
    friend class IncidentEdgeIterator;
    Edge(std::shared_ptr<Rule> r, std::size_t vId, std::size_t eId);
public:
    Edge();
    friend std::ostream &operator<<(std::ostream &s, const Edge &e);
    friend bool operator==(const Edge &e1, const Edge &e2);
    friend bool operator!=(const Edge &e1, const Edge &e2);
    friend bool operator<(const Edge &e1, const Edge &e2);
    bool isNull() const;
    std::shared_ptr<Rule> getRule() const;
    Rule::Edge getCore() const;
    Vertex source() const;
    Vertex target() const;
private:
    std::shared_ptr<Rule> r;
    std::size_t vId, eId;
};

2.2.16.2.3.2. Details

Edge()

Constructs a null descriptor.

bool isNull() const
Returns:whether this is a null descriptor or not.
std::shared_ptr<Rule> getRule() const
Returns:the rule the edge belongs to.
Throws:LogicError if it is a null descriptor.
Rule::Edge getCore() const
Returns:the descriptor for this edge in the core graph.
Vertex source() const
Returns:the source vertex of the edge.
Throws:LogicError if it is a null descriptor.
Vertex target() const
Returns:the target vertex of the edge.
Throws:LogicError if it is a null descriptor.

2.2.16.2.4. Class Rule::ContextGraph::VertexIterator

class Rule::ContextGraph::VertexIterator

An iterator for traversing all vertices in a rule. It models a forward iterator.

2.2.16.2.4.1. Synopsis

class Rule::ContextGraph::VertexIterator : public boost::iterator_facade<VertexIterator, Vertex, std::forward_iterator_tag, Vertex> {
    friend class Rule;
    VertexIterator(std::shared_ptr<Rule> r);
public:
    VertexIterator();
private:
    friend class boost::iterator_core_access;
    Vertex dereference() const;
    bool equal(const VertexIterator &iter) const;
    void increment();
private:
    std::shared_ptr<Rule> r;
    std::size_t vId;
};

2.2.16.2.4.2. Details

VertexIterator()

Construct a past-the-end iterator.

2.2.16.2.5. Class Rule::ContextGraph::VertexRange

class Rule::ContextGraph::VertexRange

A range of all vertices in a rule.

2.2.16.2.6. Class Rule::ContextGraph::EdgeIterator

class Rule::ContextGraph::EdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

2.2.16.2.6.1. Synopsis

class Rule::ContextGraph::EdgeIterator : public boost::iterator_facade<EdgeIterator, Edge, std::forward_iterator_tag, Edge> {
    friend class Rule;
    EdgeIterator(std::shared_ptr<Rule> r);
public:
    EdgeIterator();
private:
    friend class boost::iterator_core_access;
    Edge dereference() const;
    bool equal(const EdgeIterator &iter) const;
    void increment();
    void advanceToValid();
private:
    std::shared_ptr<Rule> r;
    std::size_t vId, eId;
};

2.2.16.2.6.2. Details

EdgeIterator()

Construct a past-the-end iterator.

2.2.16.2.7. Class Rule::ContextGraph::EdgeRange

class Rule::ContextGraph::EdgeRange

A range of all edges in a rule.

2.2.16.2.8. Class Rule::ContextGraph::IncidnetEdgeIterator

class Rule::ContextGraph::IncidnetEdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

2.2.16.2.8.1. Synopsis

class Rule::ContextGraph::IncidentEdgeIterator : public boost::iterator_facade<IncidentEdgeIterator, Edge, std::forward_iterator_tag, Edge> {
    friend class Rule;
    IncidentEdgeIterator(std::shared_ptr<Rule> r, std::size_t vId);
public:
    IncidentEdgeIterator();
private:
    friend class boost::iterator_core_access;
    Edge dereference() const;
    bool equal(const IncidentEdgeIterator &iter) const;
    void increment();
private:
    std::shared_ptr<Rule> r;
    std::size_t vId, eId;
};

2.2.16.2.8.2. Details

IncidentEdgeIterator()

Construct a past-the-end iterator.

2.2.16.2.9. Class Rule::ContextGraph::IncidentEdgeRange

class Rule::ContextGraph::IncidentEdgeRange

A range of all incident edges to a vertex in a rule.

2.2.16.4. Core

2.2.16.4.1. Class Rule::Vertex

class Rule::Vertex

A descriptor of either a vertex in a rule, or a null vertex.

2.2.16.4.1.1. Synopsis

class Rule::Vertex {
    friend class Rule;
    friend class Edge;
    friend class VertexIterator;
    friend class VertexRange;
    Vertex(std::shared_ptr<Rule> r, std::size_t vId);
public:
    Vertex();
    friend std::ostream &operator<<(std::ostream &s, const Vertex &v);
    friend bool operator==(const Vertex &v1, const Vertex &v2);
    friend bool operator!=(const Vertex &v1, const Vertex &v2);
    friend bool operator<(const Vertex &v1, const Vertex &v2);
    bool isNull() const;
    std::size_t getId() const;
    std::shared_ptr<Rule> getRule() const;
    LeftGraph::Vertex getLeft() const;
    ContextGraph::Vertex getContext() const;
    RightGraph::Vertex getRight() const;
    std::size_t getDegree() const;
    IncidentEdgeRange incidentEdges() const;
private:
    std::shared_ptr<Rule> r;
    std::size_t vId;
};

2.2.16.4.1.2. Details

Vertex()

Constructs a null descriptor.

bool isNull() const
Returns:whether this is a null descriptor or not.
std::size_t getId() const
Returns:the index of the vertex. It will be in the range \([0, numVertices[\).
Throws:LogicError if it is a null descriptor.
std::shared_ptr<Rule> getRule() const
Returns:the rule the vertex belongs to.
Throws:LogicError if it is a null descriptor.
LeftGraph::Vertex getLeft() const
Returns:a null descriptor if this vertex is not in the left graph, otherwise the descriptor of this vertex in the left graph.
ContextGraph::Vertex getContext() const
Returns:a null descriptor if this vertex is not in the context graph, otherwise the descriptor of this vertex in the context graph.
RightGraph::Vertex getRight() const
Returns:a null descriptor if this vertex is not in the right graph, otherwise the descriptor of this vertex in the right graph.
std::size_t getDegree() const
Returns:the degree of the vertex.
Throws:LogicError if it is a null descriptor.
IncidentEdgeRange incidentEdges() const
Returns:a range of incident edges to this vertex.
Throws:LogicError if it is a null descriptor.

2.2.16.4.2. Class Rule::Edge

class Rule::Edge

A descriptor of either an edge in a rule, or a null edge.

2.2.16.4.2.1. Synopsis

class Rule::Edge {
    friend class Rule::LeftGraph::Edge;
    friend class Rule::ContextGraph::Edge;
    friend class Rule::RightGraph::Edge;
    friend class EdgeIterator;
    friend class IncidentEdgeIterator;
    Edge(std::shared_ptr<Rule> r, std::size_t vId, std::size_t eId);
public:
    Edge();
    friend std::ostream &operator<<(std::ostream &s, const Edge &e);
    friend bool operator==(const Edge &e1, const Edge &e2);
    friend bool operator!=(const Edge &e1, const Edge &e2);
    friend bool operator<(const Edge &e1, const Edge &e2);
    bool isNull() const;
    std::shared_ptr<Rule> getRule() const;
    LeftGraph::Edge getLeft() const;
    ContextGraph::Edge getContext() const;
    RightGraph::Edge getRight() const;
    Vertex source() const;
    Vertex target() const;
private:
    std::shared_ptr<Rule> r;
    std::size_t vId, eId;
};

2.2.16.4.2.2. Details

Edge()

Constructs a null descriptor.

bool isNull() const
Returns:whether this is a null descriptor or not.
std::shared_ptr<Rule> getRule() const
Returns:the rule the edge belongs to.
Throws:LogicError if it is a null descriptor.
LeftGraph::Edge getLeft() const
Returns:a null descriptor if this edge is not in the left graph, otherwise the descriptor of this edge in the left graph.
ContextGraph::Edge getContext() const
Returns:a null descriptor if this edge is not in the context graph, otherwise the descriptor of this edge in the context graph.
RightGraph::Edge getRight() const
Returns:a null descriptor if this edge is not in the right graph, otherwise the descriptor of this edge in the right graph.
Vertex source() const
Returns:the source vertex of the edge.
Throws:LogicError if it is a null descriptor.
Vertex target() const
Returns:the target vertex of the edge.
Throws:LogicError if it is a null descriptor.

2.2.16.4.3. Class Rule::VertexIterator

class Rule::VertexIterator

An iterator for traversing all vertices in a rule. It models a forward iterator.

2.2.16.4.3.1. Synopsis

class Rule::VertexIterator : public boost::iterator_facade<VertexIterator, Vertex, std::forward_iterator_tag, Vertex> {
    friend class Rule;
    VertexIterator(std::shared_ptr<Rule> r);
public:
    VertexIterator();
private:
    friend class boost::iterator_core_access;
    Vertex dereference() const;
    bool equal(const VertexIterator &iter) const;
    void increment();
private:
    std::shared_ptr<Rule> r;
    std::size_t vId;
};

2.2.16.4.3.2. Details

VertexIterator()

Construct a past-the-end iterator.

2.2.16.4.4. Class Rule::VertexRange

class Rule::VertexRange

A range of all vertices in a rule.

2.2.16.4.5. Class Rule::EdgeIterator

class Rule::EdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

2.2.16.4.5.1. Synopsis

class Rule::EdgeIterator : public boost::iterator_facade<EdgeIterator, Edge, std::forward_iterator_tag, Edge> {
    friend class Rule;
    EdgeIterator(std::shared_ptr<Rule> r);
public:
    EdgeIterator();
private:
    friend class boost::iterator_core_access;
    Edge dereference() const;
    bool equal(const EdgeIterator &iter) const;
    void increment();
    void advanceToValid();
private:
    std::shared_ptr<Rule> r;
    std::size_t vId, eId;
};

2.2.16.4.5.2. Details

EdgeIterator()

Construct a past-the-end iterator.

2.2.16.4.6. Class Rule::EdgeRange

class Rule::EdgeRange

A range of all edges in a rule.

2.2.16.4.7. Class Rule::IncidnetEdgeIterator

class Rule::IncidnetEdgeIterator

An iterator for traversing all edges in a rule. It models a forward iterator.

2.2.16.4.7.1. Synopsis

class Rule::IncidentEdgeIterator : public boost::iterator_facade<IncidentEdgeIterator, Edge, std::forward_iterator_tag, Edge> {
    friend class Rule;
    IncidentEdgeIterator(std::shared_ptr<Rule> r, std::size_t vId);
public:
    IncidentEdgeIterator();
private:
    friend class boost::iterator_core_access;
    Edge dereference() const;
    bool equal(const IncidentEdgeIterator &iter) const;
    void increment();
private:
    std::shared_ptr<Rule> r;
    std::size_t vId, eId;
};

2.2.16.4.7.2. Details

IncidentEdgeIterator()

Construct a past-the-end iterator.

2.2.16.4.8. Class Rule::IncidentEdgeRange

class Rule::IncidentEdgeRange

A range of all incident edges to a vertex in a rule.