List of all members | Public Member Functions
active_controls Class Reference

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_containercontrols () const
 Returns a list with all active lines. More...
 
void operator() (gate &g) const
 Operator implementation. More...
 

Detailed Description

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.

Example

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.

#include <core/circuit.hpp>
revkit::circuit circ( 3 );
controller.add( 0u );
circ.gate_added.connect( controller );
revkit::append_cnot( circ, 1u, 2u );
revkit::append_not( circ, 1u );

Member Function Documentation

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.

Parameters
controlIndex of the line which should be active
Author
RevKit
Since
1.1
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.

Returns
List with all active lines
Author
RevKit
Since
1.1
void operator() ( gate g) const

Operator implementation.

This operator adds the active controls to the gate after it is added to a circuit.

Parameters
gGate to be changed
Author
RevKit
Since
1.1
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.

Parameters
controlIndex of the line which should be deactivated
Author
RevKit
Since
1.1

The documentation for this class was generated from the following file:

Generated on Tue Apr 16 2013 08:12:02 for RevKit by doxygen 1.8.3.1