Slot for adding control lines automatically. More...
Public Member Functions | |
void | add (gate::line control) |
Add an active control line. More... | |
void | remove (gate::line control) |
Removes an active control line. More... | |
const gate::line_container & | controls () const |
Returns a list with all active lines. More... | |
void | operator() (gate &g) const |
Operator implementation. More... | |
Slot for adding control lines automatically.
This is a slot which can be connected to the circuit::gate_added signal in order to add special control lines automatically. These are called active controls. For example a block of gates should be added which is only active when a particular control line is activated.
This control line can be activatd with this class and then the class has to be connected to the signal of the circuit.
The code below seems to add a CNOT and a NOT gate. However, since the controller is connected and the line 0 is added to the controller each time also this control line is activated and, thus, a Toffoli gate and a CNOT gate are added.
void add | ( | gate::line | control | ) |
Add an active control line.
An active control line is implicitely added by every operation which adds a new gate to the circuit. This is especially useful in hierarchical synthesis approaches.
This method does not add a line, it only sets an existing line to be active.
control | Index of the line which should be active |
const gate::line_container& controls | ( | ) | const |
Returns a list with all active lines.
An active control line is implicitely added by every operation which adds a new gate to the circuit. This is especially useful in hierarchical synthesis approaches.
void operator() | ( | gate & | g | ) | const |
Operator implementation.
This operator adds the active controls to the gate after it is added to a circuit.
g | Gate to be changed |
void remove | ( | gate::line | control | ) |
Removes an active control line.
An active control line is implicitely added by every operation which adds a new gate to the circuit. This is especially useful in hierarchical synthesis approaches.
This method does not remove a line, it only unsets an existing line to be active.
control | Index of the line which should be deactivated |