![]() |
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 > | |
| Circuit ()=default | |
| Circuit & | operator= (const Circuit &)=default |
| 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. | |
| std::pair< gate_t, bool > | findOrAddGate (const gate_uuid &u) |
Return (or create) the gate associated with UUID u, and whether it was created. | |
| 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. | |
| 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 |
UUID type used in this circuit (always std::string). | |
| Protected Types inherited from Circuit< DotGate > | |
| enum | |
What a gate is named by, in name_kind. More... | |
| Protected Member Functions inherited from Circuit< DotGate > | |
| unsigned char | nameKind (gate_t g) const |
What gate g is named by. | |
| void | bindName (gate_t g, const gate_uuid &u) |
Name gate g by the UUID u. | |
| void | pointName (gate_t g, gate_t target) |
Make the name of gate g, if any, name gate target. | |
| void | dropName (gate_t g) |
Remove the name of gate g, if any. | |
| void | moveName (gate_t from, gate_t to) |
Give the name of gate from, if any, to gate to. | |
| void | setGateType (gate_t g, DotGate t) |
| Update the type of an existing gate. | |
| Protected Attributes inherited from Circuit< DotGate > | |
| std::unordered_map< gate_uuid, gate_t, gate_uuid_hash > | uuid2id |
| UUID → gate index. | |
| std::vector< gate_uuid > | id2uuid |
UUID of each gate (if UUID_NAME). | |
| std::vector< unsigned char > | name_kind |
| What each gate is named by. | |
| std::unordered_map< std::string, gate_t > | name2id |
| Other name → gate index. | |
| std::unordered_map< gate_t, std::string > | id2name |
| Gate index → other name. | |
| 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 49 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 147 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 42 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 34 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 336 of file Circuit.hpp.
Allocate a new gate with type type and no UUID.
| type | Gate type. |
Definition at line 343 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 57 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.