![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Circuit specialisation for GraphViz DOT rendering. More...
#include "DotCircuit.h"


Public Member Functions | |
| gate_t | addGate () override |
| Allocate a new gate with a default-initialised type. | |
| gate_t | setGate (const uuid &u, DotGate type) override |
Create or update the gate associated with UUID u. | |
| gate_t | setGate (const uuid &u, DotGate t, std::string d) |
| Create (or update) a gate with a UUID, type, and description. | |
| std::string | render () const |
Render the entire circuit as a GraphViz DOT digraph string. | |
| virtual std::string | toString (gate_t g) const override |
Return a textual description of gate g for debugging. | |
| virtual gate_t | setGate (const uuid &u, gateType type) |
Create or update the gate associated with UUID u. | |
| virtual gate_t | setGate (gateType type) |
Allocate a new gate with type type and no UUID. | |
Public Member Functions inherited from Circuit< DotGate > | |
| virtual | ~Circuit () |
| std::vector< gate_t >::size_type | getNbGates () const |
| Return the total number of gates in the circuit. | |
| gate_t | getGate (const uuid &u) |
Return (or create) the gate associated with UUID u. | |
| uuid | getUUID (gate_t g) const |
Return the UUID string associated with gate g. | |
| DotGate | getGateType (gate_t g) const |
Return the type of gate g. | |
| std::vector< gate_t > & | getWires (gate_t g) |
Return a mutable reference to the child-wire list of gate g. | |
| const std::vector< gate_t > & | getWires (gate_t g) const |
Return a const reference to the child-wire list of gate g. | |
| bool | hasGate (const uuid &u) const |
Test whether a gate with UUID u exists. | |
| void | addWire (gate_t f, gate_t t) |
Add a directed wire from gate f (parent) to gate t (child). | |
Private Attributes | |
| std::set< gate_t > | inputs |
| Input gate IDs (rendered as leaf nodes) | |
| std::vector< std::string > | desc |
| Per-gate label strings (indexed by gate ID) | |
Additional Inherited Members | |
Public Types inherited from Circuit< DotGate > | |
| using | uuid = std::string |
UUID type used in this circuit (always std::string). | |
Protected Member Functions inherited from Circuit< DotGate > | |
| void | setGateType (gate_t g, DotGate t) |
| Update the type of an existing gate. | |
Protected Attributes inherited from Circuit< DotGate > | |
| std::unordered_map< uuid, gate_t > | uuid2id |
| UUID string → gate index. | |
| std::unordered_map< gate_t, uuid > | id2uuid |
| Gate index → UUID string. | |
| std::vector< DotGate > | gates |
| Gate type for each gate. | |
| std::vector< std::vector< gate_t > > | wires |
| Child wire lists for each gate. | |
Circuit specialisation for GraphViz DOT rendering.
Extends Circuit<DotGate> with per-gate description strings and a render() method that produces a complete DOT digraph.
Definition at line 61 of file DotCircuit.h.
|
overridevirtual |
Allocate a new gate with a default-initialised type.
Derived classes override this to perform additional initialisation (e.g. resizing auxiliary vectors).
gate_t identifier of the newly created gate. Reimplemented from Circuit< DotGate >.
Definition at line 46 of file DotCircuit.cpp.

| std::string DotCircuit::render | ( | ) | const |
Render the entire circuit as a GraphViz DOT digraph string.
The returned string can be written to a file and processed with dot, neato, or graph-easy.
Definition at line 144 of file DotCircuit.cpp.


Create (or update) a gate with a UUID, type, and description.
The d string is used as the node label in the DOT output.
| u | UUID of the gate. |
| t | Gate type. |
| d | Description / label string for this gate. |
Definition at line 39 of file DotCircuit.cpp.

Create or update the gate associated with UUID u.
If the UUID is already mapped the existing gate's type is updated. Otherwise a new gate is allocated.
| u | UUID string to associate with the gate. |
| type | Gate type. |
Definition at line 31 of file DotCircuit.cpp.


Create or update the gate associated with UUID u.
If the UUID is already mapped the existing gate's type is updated. Otherwise a new gate is allocated.
| u | UUID string to associate with the gate. |
| type | Gate type. |
Reimplemented from Circuit< DotGate >.
Definition at line 164 of file Circuit.hpp.
Allocate a new gate with type type and no UUID.
| type | Gate type. |
Reimplemented from Circuit< DotGate >.
Definition at line 171 of file Circuit.hpp.
|
overridevirtual |
Return a textual description of gate g for debugging.
Pure virtual; each concrete circuit class provides its own formatting.
| g | Gate to describe. |
Implements Circuit< DotGate >.
Definition at line 54 of file DotCircuit.cpp.


|
private |
Per-gate label strings (indexed by gate ID)
Definition at line 64 of file DotCircuit.h.
|
private |
Input gate IDs (rendered as leaf nodes)
Definition at line 63 of file DotCircuit.h.