26template<
class gateType>
29 return uuid2id.find(u)!=uuid2id.end();
32template<
class gateType>
35 auto it=uuid2id.find(u);
36 if(it==uuid2id.end()) {
45template<
class gateType>
48 auto it = id2uuid.find(g);
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>
83 getWires(f).push_back(t);
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).
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).
uuid getUUID(gate_t g) const
Return the UUID string associated with gate g.
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.