void Karussell::drehen() {
    NOTIFY_OPERATION(drehen, drehen(), 0, System_Karussell_drehen_SERIALIZE);
    //#[ operation drehen()
    Waage* myWaage = itsWaage[MaxStation-1]; 
    
    if( !GlaeserDrauf() ) return;
    
    for(int i=0; i < MaxStation; i++) 
    {
    	if( !itsStation[i]->isOk() ) return; 
    }
    
    for( int i = MaxStation-1; i > 0; i-- )
    {
    	itsWaage[i] = itsWaage[i-1];
    	
    }
    itsWaage[0] = myWaage;  
     
    updateLED();
     
    for(int i=0; i < MaxStation; i++) 
    {
    	itsStation[i]->GEN(evRun); 
    }
    
    jemalsgedreht = true;         
    //#]
}
void Karussell::updateLED() {
    NOTIFY_OPERATION(updateLED, updateLED(), 0, System_Karussell_updateLED_SERIALIZE);
    //#[ operation updateLED()
    for(int i=0; i < MaxStation; i++) 
    {
    	itsLed[i]->setOn(itsWaage[i]->getBrutto() >= GlasGewicht); 
    }
    //#]
}
void Dosierer::dosiere() {
    NOTIFY_OPERATION(dosiere, dosiere(), 0, System_Dosierer_dosiere_SERIALIZE);
    //#[ operation dosiere()
    int aMenge = DosierMenge;
    
    aMenge = itsVorrat->entnehme(aMenge);
    itsStation->dosiere(aMenge);
    //#]
}
int Karussell::GlaeserDrauf() {
    NOTIFY_OPERATION(GlaeserDrauf, GlaeserDrauf(), 0, System_Karussell_GlaeserDrauf_SERIALIZE);
    //#[ operation GlaeserDrauf()
    int anz = 0;
    for(int i = 0; i < MaxStation; i++) {
    	anz += itsWaage[i]->getBrutto() >= GlasGewicht; 
    } 
    // std::cout << "Anzahl Glaeser: " << anz << std::endl;      
    return anz;
    //#]
}
bool Lichtschranke::check() {
    NOTIFY_OPERATION(check, check(), 0, System_Lichtschranke_check_SERIALIZE);
    //#[ operation check()
    if(itsLimetten->getitsVorrat()->getVorrat()>0)
    {
    	itsLimetten->getitsVorrat()->entnehme(1);
    	return true;
    } else {
    	return false;
    }
    //#]
}
void Controller::Reset() {
    NOTIFY_OPERATION(Reset, Reset(), 0, Default_Controller_Reset_SERIALIZE);
    //#[ operation Reset()
    NS_RED=0;
    EW_RED=0; 
    NS_GREEN=0;
    EW_GREEN=0;
    NS_ORANGE=0;
    EW_ORANGE=0;
    
    //#]
}
void Controller::Reduce_time() {
    NOTIFY_OPERATION(Reduce_time, Reduce_time(), 0, Default_Controller_Reduce_time_SERIALIZE);
    //#[ operation Reduce_time()
    if(NS_REDTIME>0)
    NS_REDTIME--;
    if(NS_ORANGETIME>0)
    NS_ORANGETIME--;
    if(NS_GREENTIME>0)
    NS_GREENTIME--;
    if(EW_REDTIME>0)
    EW_REDTIME--;
    if(EW_ORANGETIME>0)
    EW_ORANGETIME--;
    if(EW_GREENTIME>0)
    EW_GREENTIME--;
    //#]
}
Esempio n. 8
0
void Switch_C::flip() {
    NOTIFY_OPERATION(flip, flip(), 0, Default_Switch_flip_SERIALIZE);
    //#[ operation flip()
    itsLight->GEN(toggle());
    //#]
}