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

void Simulator::detachCircuit ( Circuit circuit  ) 

Detach a circuit from the simulator.

Definition at line 433 of file simulator.cpp.

References Circuit::nextChanged(), and Circuit::setNextChanged().

{
      if (!circuit)
            return;
      
      detach( & m_ordinaryCircuits, circuit );
      
      // Any changes to the code below will probably also apply to Simulator::removeLogicOutReferences
      
      if ( m_pChangedCircuitLast == circuit )
      {
            Circuit * previous_1 = 0l;
            Circuit * previous_2 = 0l;
            for ( Circuit * circuit = m_pChangedCircuitStart; circuit; )
            {
                  if (previous_1)
                        previous_2 = previous_1;
                  previous_1 = circuit;
                  circuit = circuit->nextChanged( m_currentChain );
            }
            
            m_pChangedCircuitLast = previous_2;
      }
      
      for ( unsigned chain = 0; chain < 2; ++chain )
      {
            for ( Circuit * prevChanged = m_pChangedCircuitStart; prevChanged; prevChanged = prevChanged->nextChanged( chain ) )
            {
                  Circuit * nextChanged = prevChanged->nextChanged( chain );
                  if ( nextChanged == circuit )
                        prevChanged->setNextChanged( nextChanged->nextChanged( chain ), chain );
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index