Implementation of revlib_processor to construct a reversible_truth_table. More...
Public Member Functions | |
specification_processor (binary_truth_table &spec) | |
Default constructor. More... | |
virtual | ~specification_processor () |
Default deconstructor. More... | |
![]() | |
revlib_processor () | |
Default constructor. More... | |
virtual | ~revlib_processor () |
Default deconstructor. More... | |
Protected Member Functions | |
virtual void | on_inputs (std::vector< std::string >::const_iterator first, std::vector< std::string >::const_iterator last) const |
Called when parsing .inputs command. More... | |
virtual void | on_outputs (std::vector< std::string >::const_iterator first, std::vector< std::string >::const_iterator last) const |
Called when parsing .outputs command. More... | |
virtual void | on_constants (std::vector< constant >::const_iterator first, std::vector< constant >::const_iterator last) const |
Called when parsing the .constants command. More... | |
virtual void | on_garbage (std::vector< bool >::const_iterator first, std::vector< bool >::const_iterator last) const |
Called when parsing .garbage command. More... | |
virtual void | on_truth_table_line (unsigned line_index, const std::vector< boost::optional< bool > >::const_iterator first, const std::vector< boost::optional< bool > >::const_iterator last) const |
Called when a truth table line is parsed. More... | |
![]() | |
virtual void | on_comment (const std::string &comment) const |
Called when parsing comments. More... | |
virtual void | on_version (const std::string &version) const |
Called when parsing .version command. More... | |
virtual void | on_numvars (unsigned numvars) const |
Called when parsing .numvars command. More... | |
virtual void | on_variables (std::vector< std::string >::const_iterator first, std::vector< std::string >::const_iterator last) const |
Called when parsing .variables command. More... | |
virtual void | on_inputbus (const std::string &name, const std::vector< unsigned > &line_indices) const |
Called when parsing .inputbus command. More... | |
virtual void | on_outputbus (const std::string &name, const std::vector< unsigned > &line_indices) const |
Called when parsing .outputbus command. More... | |
virtual void | on_state (const std::string &name, const std::vector< unsigned > &line_indices, unsigned initial_value) const |
Called when parsing .state command. More... | |
virtual void | on_module (const std::string &name, const boost::optional< std::string > &filename) const |
Called when parsing .module command. More... | |
virtual void | on_begin () const |
Called when parsing .begin command. More... | |
virtual void | on_end () const |
Called when parsing .end command. More... | |
virtual void | on_gate (const boost::any &target_type, const std::vector< unsigned > &line_indices) const |
Called when a gate is parsed. More... | |
void | add_annotation (const std::string &key, const std::string &value) |
Adds an annotation to the processor. More... | |
void | clear_annotations () |
Clears the current annotations. More... | |
properties::ptr | current_annotations () const |
Returns the current annotations. More... | |
Implementation of revlib_processor to construct a reversible_truth_table.
This class inherits from revlib_processor and constructs a reversible_truth_table when parsing a specification file.
For convinience the function read_specification(reversible_truth_table&, const std::string&, std::string*) wraps the use of this class to read truth tables from a file.
|
explicit |
Default constructor.
Initializes private data
spec | An empty reversible_truth_table which will be constructed and filled with entries while parsing the file |
|
virtual |
Default deconstructor.
Clears private data
|
protectedvirtual |
Called when parsing the .constants command.
This method is called when a .constants command is parsed. The constant in a std::vector can be accessed via their first
and last
iterator. A optional boolean value indicates whether the line is constant or not and in case it is constant, which constant line is represented.
first | Begin iterator of constants vector |
last | End iterator of constants vector |
Reimplemented from revlib_processor.
|
protectedvirtual |
Called when parsing .garbage command.
This method is called when a .garbage command is parsed. The garbage in a std::vector can be accessed via their first
and last
iterator. A boolean value indicates whether the line has a garbage output or not.
first | Begin iterator of garbage vector |
last | End iterator of garbage vector |
Reimplemented from revlib_processor.
|
protectedvirtual |
Called when parsing .inputs command.
This method is called when a .inputs command is parsed. The inputs in a std::vector can be accessed via their first
and last
iterator.
first | Begin iterator of inputs vector |
last | End iterator of inputs vector |
Reimplemented from revlib_processor.
|
protectedvirtual |
Called when parsing .outputs command.
This method is called when a .outputs command is parsed. The outputs in a std::vector can be accessed via their first
and last
iterator.
first | Begin iterator of outputs vector |
last | End iterator of outputs vector |
Reimplemented from revlib_processor.
|
protectedvirtual |
Called when a truth table line is parsed.
This method is called when a truth table line is parsed. A truth table line is parsed in a specification file.
The truth table line is given as first and last iterator over boost::optional<bool> values and as additional parameter the corresponding truth table line is given.
line_index | The corresponding truth table line |
first | Begin iterator over truth table output value |
last | End iterator over truth table output value |
Reimplemented from revlib_processor.