26template<
class gateType>
32template<
class gateType>
45template<
class gateType>
55template<
class gateType>
59 gates.push_back(gateType());
64template<
class gateType>
68 gates[
static_cast<std::underlying_type<gate_t>::type
>(id)] = type;
72template<
class gateType>
76 gates[
static_cast<std::underlying_type<gate_t>::type
>(id)] = type;
80template<
class gateType>
Generic directed-acyclic-graph circuit template and gate identifier.
gate_t
Strongly-typed gate identifier.
std::string uuid
UUID type used in this circuit (always std::string).
std::vector< gate_t > & getWires(gate_t g)
Return a mutable reference to the child-wire list of gate g.
std::unordered_map< gate_t, uuid > id2uuid
Gate index → UUID string.
virtual gate_t setGate(const uuid &u, gateType type)
Create or update the gate associated with UUID u.
void addWire(gate_t f, gate_t t)
Add a directed wire from gate f (parent) to gate t (child).
std::unordered_map< uuid, gate_t > uuid2id
UUID string → gate index.
std::vector< gateType > gates
Gate type for each gate.
uuid getUUID(gate_t g) const
Return the UUID string associated with gate g.
std::vector< std::vector< gate_t > > wires
Child wire lists for each gate.
gate_t getGate(const uuid &u)
Return (or create) the gate associated with UUID u.
bool hasGate(const uuid &u) const
Test whether a gate with UUID u exists.
virtual gate_t addGate()
Allocate a new gate with a default-initialised type.