circuit Class Reference

Main circuit class. More...

List of all members.

Public Types

typedef
boost::transform_iterator
< filter_circuit,
gate::vector::iterator > 
iterator
 Mutable iterator for accessing the gates in a circuit.
typedef
boost::transform_iterator
< const_filter_circuit,
gate::vector::const_iterator > 
const_iterator
 Constant iterator for accessing the gates in a circuit.
typedef
boost::transform_iterator
< filter_circuit,
gate::vector::reverse_iterator > 
reverse_iterator
 Mutable reverse iterator for accessing the gates in a circuit.
typedef
boost::transform_iterator
< const_filter_circuit,
gate::vector::const_reverse_iterator > 
const_reverse_iterator
 Constant reverse iterator for accessing the gates in a circuit.

Public Member Functions

 circuit ()
 Default constructor.
 circuit (const standard_circuit &std_circ)
 Cast Constructor for a standard_circuit.
 circuit (standard_circuit &std_circ)
 Cast Constructor for a standard_circuit.
 circuit (const subcircuit &sub_circ)
 Cast Constructor for a subcircuit.
 circuit (subcircuit &sub_circ)
 Cast Constructor for a subcircuit.
unsigned num_gates () const
 Returns the number of gates.
void set_lines (unsigned lines)
 Sets the number of line.
unsigned lines () const
 Returns the number of lines.
const_iterator begin () const
 Constant begin iterator pointing to gates.
const_iterator end () const
 Constant end iterator pointing to gates.
iterator begin ()
 Mutable begin iterator pointing to gates.
iterator end ()
 Mutable end iterator pointing to gates.
const_reverse_iterator rbegin () const
 Constant begin reverse iterator pointing to gates.
const_reverse_iterator rend () const
 Constant end reverse iterator pointing to gates.
reverse_iterator rbegin ()
 Mutable begin reverse iterator pointing to gates.
reverse_iterator rend ()
 Mutable end reverse iterator pointing to gates.
gateappend_gate ()
 Inserts a gate at the end of the circuit.
gateprepend_gate ()
 Inserts a gate at the beginning of the circuit.
gateinsert_gate (unsigned pos)
 Inserts a gate into the circuit.
void remove_gate_at (unsigned pos)
 Removes a gate at a given index.
void set_inputs (const std::vector< std::string > &inputs)
 Sets the input names of the lines in a circuit.
const std::vector< std::string > & inputs () const
 Returns the input names of the lines in a circuit.
void set_outputs (const std::vector< std::string > &outputs)
 Sets the output names of the lines in a circuit.
const std::vector< std::string > & outputs () const
 Returns the output names of the lines in a circuit.
void set_constants (const std::vector< constant > &constants)
 Sets the constant input line specifications.
const std::vector< constant > & constants () const
 Returns the constant input line specification.
void set_garbage (const std::vector< bool > &garbage)
 Sets whether outputs are garbage or not.
const std::vector< bool > & garbage () const
 Returns whether outputs are garbage or not.
void set_circuit_name (const std::string &name)
 Sets a name of the circuit.
const std::string & circuit_name () const
 Returns the name of the circuit.
bool is_subcircuit () const
 Returns whether the circuit is a sub-circuit or not.
std::pair< unsigned,
std::vector< unsigned > > 
filter () const
 Returns the filter of a sub-circuit.
unsigned offset () const
 Returns the offset of the circuit (sub-circuit).

Detailed Description

Main circuit class.

This class represents a circuit and can be used generically for standard circuits and sub circuits.

Author:
RevKit
Since:
1.0

Constructor & Destructor Documentation

circuit (  )  [inline]

Default constructor.

This constructor initializes a standard_circuit with 0 lines, also called an empty circuit. Empty circuits are usually used as parameters for parsing functions, optimization algorithms, etc.

Author:
RevKit
Since:
1.0
circuit ( const standard_circuit std_circ  )  [inline]

Cast Constructor for a standard_circuit.

With this constructor the standard_circuit constructor is automatically converted to a circuit, e.g. by calling

 circuit circ( 3 );

a circuit with 3 lines is created.

Parameters:
std_circ standard_circuit implementation
Author:
RevKit
Since:
1.0
circuit ( standard_circuit std_circ  )  [inline]

Cast Constructor for a standard_circuit.

With this constructor the standard_circuit constructor is automatically converted to a circuit, e.g. by calling

 circuit circ( 3 );

a circuit with 3 lines is created.

Parameters:
std_circ standard_circuit implementation
Author:
RevKit
Since:
1.0
circuit ( const subcircuit sub_circ  )  [inline]

Cast Constructor for a subcircuit.

This constructor is used, so that subcircuits are detected as circuits in algorithms and can passed as circuit parameter to other functions and algorithms.

Parameters:
sub_circ subcircuit implementation
Author:
RevKit
Since:
1.0
circuit ( subcircuit sub_circ  )  [inline]

Cast Constructor for a subcircuit.

This constructor is used, so that subcircuits are detected as circuits in algorithms and can passed as circuit parameter to other functions and algorithms.

Parameters:
sub_circ subcircuit implementation
Author:
RevKit
Since:
1.0

Member Function Documentation

gate& append_gate (  ) 

Inserts a gate at the end of the circuit.

This method inserts a gate at the end of the circuit.

Returns:
Reference to the newly created empty gate
Author:
RevKit
Since:
1.0
iterator begin (  ) 

Mutable begin iterator pointing to gates.

Returns:
Mutable begin iterator
Author:
RevKit
Since:
1.0
const_iterator begin (  )  const

Constant begin iterator pointing to gates.

Returns:
Constant begin iterator
Author:
RevKit
Since:
1.0
const std::string& circuit_name (  )  const

Returns the name of the circuit.

Returns the name of the circuit which is empty initially.

Returns:
Name of the circuit
Author:
RevKit
Since:
1.0
const std::vector<constant>& constants (  )  const

Returns the constant input line specification.

This method returns the constant input line specification.

Returns:
Constant input line specification
Author:
RevKit
Since:
1.0
iterator end (  ) 

Mutable end iterator pointing to gates.

Returns:
Mutable end iterator
Author:
RevKit
Since:
1.0
const_iterator end (  )  const

Constant end iterator pointing to gates.

Returns:
Constant end iterator
Author:
RevKit
Since:
1.0
std::pair<unsigned, std::vector<unsigned> > filter (  )  const

Returns the filter of a sub-circuit.

This method returns a pair (l, f). In case the circuit is sub-circuit restricted on the lines, l is the original number of lines of the base circuit and f is the filter, i.e. a vector of lines which are used for the sub-circuit. In other cases s is always 0 and f is empty.

Returns:
Pair of information about the sub-circuit's base or empty pair
Author:
RevKit
Since:
1.0
const std::vector<bool>& garbage (  )  const

Returns whether outputs are garbage or not.

This method returns the garbage line specification.

Returns:
Garbage output line specification
Author:
RevKit
Since:
1.0
const std::vector<std::string>& inputs (  )  const

Returns the input names of the lines in a circuit.

This method returns the input names of the lines in a circuit. This is useful for functions when writing them to a file, printing them, or creating images.

Returns:
Input names
Author:
RevKit
Since:
1.0
gate& insert_gate ( unsigned  pos  ) 

Inserts a gate into the circuit.

This method inserts a gate at an arbitrary position in the circuit

Parameters:
pos Position where to insert the gate
Returns:
Reference to the newly created empty gate
Author:
RevKit
Since:
1.0
bool is_subcircuit (  )  const

Returns whether the circuit is a sub-circuit or not.

Both standard_circuit and subcircuit are used in the context as a circuit in other algorithms. To determine what kind of circuit it is, this method returns true if the circuit is a sub-circuit, false otherwise.

Returns:
true, if circuit is a sub-circuit, false otherwise
Author:
RevKit
Since:
1.0
unsigned lines (  )  const

Returns the number of lines.

This method returns the number of lines.

Returns:
Number of lines
Author:
RevKit
Since:
1.0
unsigned num_gates (  )  const

Returns the number of gates.

This method returns the number of gates in the circuit.

Returns:
Number of gates
Author:
RevKit
Since:
1.0
unsigned offset (  )  const

Returns the offset of the circuit (sub-circuit).

For a standard_circuit, the offset is always 0, but for a sub-circuit, the offset is the index of the starting gate in respect to its base circuit.

Returns:
Offset of the circuit
Author:
RevKit
Since:
1.0
const std::vector<std::string>& outputs (  )  const

Returns the output names of the lines in a circuit.

This method returns the output names of the lines in a circuit. This is useful for functions when writing them to a file, printing them, or creating images.

Returns:
Output names
Author:
RevKit
Since:
1.0
gate& prepend_gate (  ) 

Inserts a gate at the beginning of the circuit.

This method inserts a gate at the beginning of the circuit.

Returns:
Reference to the newly created empty gate
Author:
RevKit
Since:
1.0
reverse_iterator rbegin (  ) 

Mutable begin reverse iterator pointing to gates.

Returns:
Mutable begin reverse iterator
Author:
RevKit
Since:
1.0
const_reverse_iterator rbegin (  )  const

Constant begin reverse iterator pointing to gates.

Returns:
Constant begin reverse iterator
Author:
RevKit
Since:
1.0
void remove_gate_at ( unsigned  pos  ) 

Removes a gate at a given index.

If the index is not valid, no gate is removed.

Parameters:
pos Index
Author:
RevKit
Since:
1.0
reverse_iterator rend (  ) 

Mutable end reverse iterator pointing to gates.

Returns:
Mutable end reverse iterator
Author:
RevKit
Since:
1.0
const_reverse_iterator rend (  )  const

Constant end reverse iterator pointing to gates.

Returns:
Constant end reverse iterator
Author:
RevKit
Since:
1.0
void set_circuit_name ( const std::string &  name  ) 

Sets a name of the circuit.

Sets a name for the circuit which is empty initially.

Parameters:
name Name
Author:
RevKit
Since:
1.0
void set_constants ( const std::vector< constant > &  constants  ) 

Sets the constant input line specifications.

This method sets the constant input line specification.

Lines are by default not constant. If less values are given than lines exist, the last ones will be not constant. If more values are given than lines exist, they will be truncated.

See also:
constant
Parameters:
constants Constant Lines
Author:
RevKit
Since:
1.0
void set_garbage ( const std::vector< bool > &  garbage  ) 

Sets whether outputs are garbage or not.

If an output is garbage it means, that the resulting output value is not necessary for the function.

Lines are by default not garbage. If less values are given than lines exist, the last ones will be not garbage. If more values are given than lines exist, they will be truncated.

Parameters:
garbage Garbage line specification
Author:
RevKit
Since:
1.0
void set_inputs ( const std::vector< std::string > &  inputs  ) 

Sets the input names of the lines in a circuit.

This method sets the input names of the lines in a circuit. This is useful for functions when writing them to a file, printing them, or creating images.

Parameters:
inputs Input names
Author:
RevKit
Since:
1.0
void set_lines ( unsigned  lines  ) 

Sets the number of line.

This method sets the number of lines of the circuit.

Changing this number will not affect the data in the gates. For example: If there is a gate with a control on line 3, and the number of lines is reduced to 2 in the circuit, then the control is still on line 3 but not visible in this circuit.

So, changing the lines after already adding gates can lead to invalid gates.

Parameters:
lines Number of lines
Author:
RevKit
Since:
1.0
void set_outputs ( const std::vector< std::string > &  outputs  ) 

Sets the output names of the lines in a circuit.

This method sets the output names of the lines in a circuit. This is useful for functions when writing them to a file, printing them, or creating images.

Parameters:
outputs Output names
Author:
RevKit
Since:
1.0

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

Generated on Fri Jul 2 07:50:42 2010 for by doxygen 1.6.3