/******************************************************************* * * DESCRIPTION: class Atomic * * AUTHOR: Amir Barylko & Jorge Beyoglonian * Version 2: Daniel A. Rodriguez * * EMAIL: mailto://amir@dc.uba.ar * mailto://jbeyoglo@dc.uba.ar * mailto://drodrigu@dc.uba.ar * * DATE: 27/6/1998 * DATE: 25/4/1999 * *******************************************************************/ /** include files **/ #include "atomic.h" // base header #include "message.h" /******************************************************************* * Function Name: holdIn * Description: Changes the atomic state and the time left to the next change ********************************************************************/ Model &Atomic::holdIn( const State &s, const Time &t ) { state( s ); nextChange( t ); return *this; } /******************************************************************* * Function Name: passivate * Description: Sets thes passive state and the next change to infinity ********************************************************************/ Model &Atomic::passivate() { state( passive ); nextChange( Time::Inf ); return *this; } Model & Atomic::externalFunction( const ExternalMessage &) { MException e ; e.addText( "Can not call Atomic::externalFunction( const ExternalMessage&)!" ) ; MTHROW( e ) ; } Model & Atomic::externalFunction(const MessageBag & msgs) { MessageBag::iterator cursor ; // cout << "The size of the message bag is " << msgs.size() << endl; for (cursor = msgs.begin() ; cursor != msgs.end() ; cursor++) { // cout << "one message is fetched from the message bag,in Atomic" << endl; externalFunction( *((ExternalMessage *)( *cursor))); } return *this; } Model &Atomic::confluentFunction( const InternalMessage &intMsg, const MessageBag &extMsgs) { // cout << "confluent function is called for " << this->description() << " at " // << intMsg.time() << endl; internalFunction(intMsg); lastChange(intMsg.time()); externalFunction(extMsgs); return *this; } Processor &Atomic::createProcessor() { return SingleProcessorAdmin::Instance().generateProcessor(this, localProc()); } // Rami: to be removed later... used to aviod compilation errors /*Model &Atomic::outputFunction(const CollectMessage & ) { return *this; } */