Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

void Component::removeElement ( Element element,
bool  setPinsInterIndependent 
) [inherited]

Safely delete an element - in this case, calls element->componentDeleted, and removes it from the element list.

Parameters:
setPinsInterIndependent whether to call setPinsInterIndependent. The call is time-consuming, and unnecessary if the pins from which the element was originally attached will be/ were removed, or they will become interdependent again.

Definition at line 118 of file component.cpp.

References Element::componentDeleted(), Component::elementDestroyed(), Component::m_elementMapList, and Component::rebuildPinInterDepedence().

Referenced by ResistorDIP::initPins(), Multiplexer::initPins(), Demultiplexer::initPins(), DAC::initPins(), ADC::initPins(), and Switch::stopBouncing().

{
    if (!element)
        return;

    emit elementDestroyed(element);
    element->componentDeleted();

    const ElementMapList::iterator end = m_elementMapList.end();
    for ( ElementMapList::iterator it = m_elementMapList.begin(); it != end; )
    {
        ElementMapList::iterator next = it;
        ++next;

        if ( (*it).e == element )
            m_elementMapList.remove(it);

        it = next;
    }

    if ( setPinsInterIndependent )
        rebuildPinInterDepedence();
}


Generated by  Doxygen 1.6.0   Back to index