#include <pin.h>
Collaboration diagram for Pin:

Public Types | |
| enum | GroundType { gt_always = 0, gt_high = 5, gt_medium = 10, gt_low = 15, gt_never = 20 } |
Public Member Functions | |
| Pin (ECNode *parent) | |
| ~Pin () | |
| ECNode * | parentECNode () const |
| PinList | localConnectedPins () const |
| void | setSwitchConnected (Pin *pin, bool isConnected) |
| void | setVoltage (double v) |
| double | voltage () const |
| void | resetCurrent () |
| void | mergeCurrent (double i) |
| double | current () const |
| void | setCurrentKnown (bool isKnown) |
| void | setSwitchCurrentsUnknown () |
| bool | currentIsKnown () const |
| void | setSwitchCurrentKnown (Switch *sw) |
| bool | calculateCurrentFromWires () |
| void | setGroundType (int gt) |
| int | groundType () const |
| void | addCircuitDependentPin (Pin *pin) |
| void | addGroundDependentPin (Pin *pin) |
| void | removeDependentPins () |
| PinList | circuitDependentPins () const |
| PinList | groundDependentPins () const |
| void | setEqId (int id) |
| int | eqId () const |
| ElementList | elements () const |
| void | addElement (Element *e) |
| void | removeElement (Element *e) |
| void | addSwitch (Switch *e) |
| void | removeSwitch (Switch *e) |
| void | addInputWire (Wire *wire) |
| void | addOutputWire (Wire *wire) |
| void | removeWire (Wire *wire) |
| WireList | inputWireList () const |
| WireList | outputWireList () const |
| int | numWires () const |
Protected Attributes | |
| double | m_voltage |
| double | m_current |
| int | m_eqId |
| bool | m_bCurrentIsKnown |
| PinList | m_circuitDependentPins |
| PinList | m_groundDependentPins |
| ElementList | m_elementList |
| SwitchList | m_switchList |
| int | m_groundType |
| PinList | m_switchConnectedPins |
| WireList | m_inputWireList |
| WireList | m_outputWireList |
| ECNode * | m_pECNode |
| SwitchList | m_unknownSwitchCurrents |
Definition at line 34 of file pin.h.
| enum Pin::GroundType |
Priorities for ground pin. gt_always will (as expected) always assign the given pin as ground, gt_never will never do. If no gt_always pins exist, then the pin with the highest priority will be set as ground - if there is at least one pin that is not of ground type gt_never. These are only predefined recommended values, so if you choose not to use one of these, please respect the priorities with respect to the examples, and always specify a priority between 0 and 20.
| PinList Pin::localConnectedPins | ( | ) | const |
This function returns the pins that are directly connected to this pins: either at the ends of connected wires, or via switches.
Definition at line 38 of file pin.cpp.
References m_inputWireList, m_outputWireList, and m_switchConnectedPins.
| void Pin::setSwitchConnected | ( | Pin * | pin, | |
| bool | isConnected | |||
| ) |
Adds/removes the given pin to the list of ones that this pin is/isn't connected to via a switch.
Definition at line 58 of file pin.cpp.
References m_switchConnectedPins.
| void Pin::setVoltage | ( | double | v | ) | [inline] |
| double Pin::voltage | ( | ) | const [inline] |
Returns the voltage as set by setVoltage.
Definition at line 77 of file pin.h.
References m_voltage.
Referenced by ECNode::drawShape(), ECVoltMeter::meterValue(), ECNode::setNodeChanged(), VoltageProbe::stepNonLogic(), ECSignalLamp::stepNonLogic(), EC555::stepNonLogic(), and ADC::stepNonLogic().
| void Pin::resetCurrent | ( | ) | [inline] |
| void Pin::mergeCurrent | ( | double | i | ) | [inline] |
| double Pin::current | ( | ) | const [inline] |
Returns the current as set by mergeCurrent.
Definition at line 92 of file pin.h.
References m_current.
Referenced by ECNode::drawShape(), and ECNode::setNodeChanged().
| void Pin::setCurrentKnown | ( | bool | isKnown | ) | [inline] |
In many cases (such as if this pin is a ground pin), the current flowing into the pin has not been calculated, and so the value returned by current() cannot be trusted.
Definition at line 98 of file pin.h.
References m_bCurrentIsKnown.
| void Pin::setSwitchCurrentsUnknown | ( | ) | [inline] |
Tell thie Pin that none of the currents from the switches have yet been merged.
Definition at line 103 of file pin.h.
References m_switchList, and m_unknownSwitchCurrents.
| bool Pin::currentIsKnown | ( | ) | const [inline] |
This returns the value given by setCurrentKnown AND'd with whether we know the current from each switch attached to this pin.
Definition at line 109 of file pin.h.
References m_bCurrentIsKnown, and m_unknownSwitchCurrents.
| void Pin::setSwitchCurrentKnown | ( | Switch * | sw | ) | [inline] |
Tells the Pin that the current from the given switch has been merged.
Definition at line 113 of file pin.h.
References m_unknownSwitchCurrents.
| bool Pin::calculateCurrentFromWires | ( | ) |
Tries to calculate the Pin current from the input / output wires.
Definition at line 120 of file pin.cpp.
References m_bCurrentIsKnown, m_current, m_inputWireList, and m_outputWireList.
| void Pin::setGroundType | ( | int | gt | ) | [inline] |
Sets the "ground type" - i.e. the priority that this pin has for being ground over other pins in the circuit. Lower gt = higher priority. It's recommended to use Pin::GroundType.
Definition at line 124 of file pin.h.
References m_groundType.
Referenced by ECCCCS::ECCCCS(), ECCCVS::ECCCVS(), ECCell::ECCell(), ECCurrentSignal::ECCurrentSignal(), ECCurrentSource::ECCurrentSource(), ECGround::ECGround(), ECVCCS::ECVCCS(), ECVCVS::ECVCVS(), ECVoltageSignal::ECVoltageSignal(), ParallelPortComponent::ParallelPortComponent(), and SerialPortComponent::SerialPortComponent().
| int Pin::groundType | ( | ) | const [inline] |
| void Pin::addCircuitDependentPin | ( | Pin * | pin | ) |
Adds a dependent pin - one whose voltages will (or might) affect the voltage of this pin. This is set by Component.
Definition at line 68 of file pin.cpp.
References m_circuitDependentPins.
| void Pin::addGroundDependentPin | ( | Pin * | pin | ) |
Adds a dependent pin - one whose voltages will (or might) affect the voltage of this pin. This is set by Component.
Definition at line 74 of file pin.cpp.
References m_groundDependentPins.
| void Pin::removeDependentPins | ( | ) |
Removes all Circuit and Ground dependent pins.
Definition at line 80 of file pin.cpp.
References m_circuitDependentPins, and m_groundDependentPins.
| PinList Pin::circuitDependentPins | ( | ) | const [inline] |
Returns the ids of the pins whose voltages will affect this pin.
Definition at line 147 of file pin.h.
References m_circuitDependentPins.
| PinList Pin::groundDependentPins | ( | ) | const [inline] |
Returns the ids of the pins whose voltages will affect this pin.
Definition at line 152 of file pin.h.
References m_groundDependentPins.
| void Pin::setEqId | ( | int | id | ) | [inline] |
| int Pin::eqId | ( | ) | const [inline] |
| ElementList Pin::elements | ( | ) | const [inline] |
Returns a list of elements that will affect this pin (e.g. if this pin is part of a resistor, then that list will contain a pointer to a Resistance element)
Definition at line 168 of file pin.h.
References m_elementList.
| void Pin::addElement | ( | Element * | e | ) |
Adds an element to the list of those that will affect this pin.
Definition at line 86 of file pin.cpp.
References m_elementList.
| void Pin::removeElement | ( | Element * | e | ) |
Removes an element from the list of those that will affect this pin.
Definition at line 92 of file pin.cpp.
References m_elementList.
| void Pin::addSwitch | ( | Switch * | e | ) |
Adds an switch to the list of those that will affect this pin.
Definition at line 97 of file pin.cpp.
References m_switchList.
Referenced by Component::createSwitch().
| void Pin::removeSwitch | ( | Switch * | e | ) |
Removes an switch from the list of those that will affect this pin.
Definition at line 103 of file pin.cpp.
References m_switchList.
1.5.1