The Class TwoInputGate. More...
#include <TwoInputGate.h>
Public Member Functions | |
TwoInputGate (size_t id, const TwoInputFunc &func, const std::string &outputName, const std::string &input1Name, const std::string &input2Name, const SimTime &delay) | |
Instantiates a new two input gate. | |
TwoInputGate (const TwoInputGate &that) | |
virtual TwoInputGate * | clone () const |
a way to construct different subtypes | |
virtual bool | hasInputName (const std::string &net) const |
Checks for input name. | |
virtual bool | hasOutputName (const std::string &net) const |
Checks for output name. | |
virtual const std::string & | getOutputName () const |
Gets the output name. | |
virtual size_t | getInputIndex (const std::string &net) const |
virtual const std::string | getGateName () const |
The name of the gate depends on the functionality it's implementing. | |
virtual const std::string | toString () const |
for debugging | |
Protected Member Functions | |
virtual LogicVal | evalOutput () const |
compute the new value of the output by calling the functor | |
virtual void | execEvent (Graph &graph, GNode &myNode, const EventTy &event) |
The basic idea is to find which input is updated by the LogicUpdate stored in the event. | |
Private Attributes | |
const TwoInputFunc & | func |
The functor that computes a value for the output of the gate when provided with the values of the input. |
The Class TwoInputGate.
TwoInputGate::TwoInputGate | ( | size_t | id, | |
const TwoInputFunc & | func, | |||
const std::string & | outputName, | |||
const std::string & | input1Name, | |||
const std::string & | input2Name, | |||
const SimTime & | delay | |||
) | [inline] |
Instantiates a new two input gate.
id | ||
func,: | functor implementing the function from inputs to outputs | |
outputName | the output name | |
input1Name | the input 1 name | |
input2Name | the input 2 name | |
delay | the delay |
TwoInputGate::TwoInputGate | ( | const TwoInputGate & | that | ) | [inline] |
virtual TwoInputGate* TwoInputGate::clone | ( | ) | const [inline, virtual] |
virtual LogicVal TwoInputGate::evalOutput | ( | ) | const [inline, protected, virtual] |
compute the new value of the output by calling the functor
Implements BaseLogicGate.
virtual void TwoInputGate::execEvent | ( | Graph & | graph, | |
GNode & | myNode, | |||
const EventTy & | event | |||
) | [inline, protected, virtual] |
The basic idea is to find which input is updated by the LogicUpdate stored in the event.
Then after updating the input, the output is evaluated, and the updated value of the output is sent as a LogicUpdate to all the out-going neighbors to which the output feeds
Implements AbstractSimObject.
virtual const std::string TwoInputGate::getGateName | ( | ) | const [inline, virtual] |
The name of the gate depends on the functionality it's implementing.
virtual size_t TwoInputGate::getInputIndex | ( | const std::string & | net | ) | const [inline, virtual] |
net | name of the wire to query |
Implements LogicGate.
virtual const std::string& TwoInputGate::getOutputName | ( | ) | const [inline, virtual] |
virtual bool TwoInputGate::hasInputName | ( | const std::string & | net | ) | const [inline, virtual] |
Checks for input name.
net | the net |
Reimplemented from BaseTwoInputGate.
virtual bool TwoInputGate::hasOutputName | ( | const std::string & | net | ) | const [inline, virtual] |
Checks for output name.
net | the net |
Reimplemented from BaseTwoInputGate.
virtual const std::string TwoInputGate::toString | ( | ) | const [inline, virtual] |
for debugging
Reimplemented from BaseTwoInputGate.
const TwoInputFunc& TwoInputGate::func [private] |
The functor that computes a value for the output of the gate when provided with the values of the input.