.. _cpp-causality/FlowQuery: ********************************************************** causality/FlowQuery.hpp ********************************************************** .. default-domain:: cpp .. default-role:: cpp:expr .. py:currentmodule:: mod .. cpp:namespace:: mod Class ``causality::FlowQuery`` -------------------------------------------------------------------------------------------------------------------------------- .. class:: causality::FlowQuery Representation of a query for a DAG that can be folded back into a given flow. The query is based on a derivation graph and can thus be used for any flow solution from a model based on that derivation graph. Synopsis ^^^^^^^^ .. alias:: causality::FlowQuery :maxdepth: 2 :noroot: Details ^^^^^^^ .. cpp:namespace-push:: causality::FlowQuery .. function:: explicit FlowQuery(std::shared_ptr dg_) Construct a query with multiplicity 1 and no borrowing. :throws: :class:`LogicError` if `dg_` is null. .. function:: std::shared_ptr getDG() const :returns: the underlying derivation graph. .. function:: void setMultiplicity(int multiplicity) int getMultiplicity() const Set/get the multiplicity of the query. It must be at least 1. :throws: (set) :class:`LogicError` if `multiplicity < 1`. .. function:: void setBorrow(dg::DG::Vertex v, int count) int getBorrow(dg::DG::Vertex v) const Set/get the amount of flow allowed to be borrowed at the vertex represented by the graph. :throws: :class:`LogicError` if `!v`. :throws: :class:`LogicError` if `v.getDG() != getDG()`. :throws: (set) :class:`LogicError` if `count < 0`. .. function:: void setBorrow(std::shared_ptr g, int count) int getBorrow(std::shared_ptr g) const Calls the corresponding functions with the result of `getDG()->findVertex(g)`. .. function:: void setConstrainRouting(bool v) bool getConstrainRouting() const Set/get whether transit edges must conform to the routing expressed by the flow. Setting this to `false` may give sequences violating flow constraints. .. function:: std::optional findDAG(const flow::Solution &s) const :returns: a causality DAG that can be folded back into the given flow solution, using the query settings in this object, if one can be found. :throws: :class:`LogicError` if any graph ``g`` given to :func:`setBorrow` with non-zero count is not a vertex in the underlying derivation graph of the given flow solution, i.e., if ``s.getFlow()->getDG()->findVertex(g)`` returns a null vertex. .. cpp:namespace-pop::