/******************************************************************* * * DESCRIPTION: class ParallelRootState * * AUTHOR: Alejandro Troccoli * Revised By: Qi (Jacky) Liu * * EMAIL: mailto://atroccol@dc.uba.ar * mailto://liuqi@sce.carleton.ca * * DATE: 29/01/2001 * Revision Date: Sept 6, 2005 *******************************************************************/ #ifndef _PROOTSTATE_H #define _PROOTSTATE_H #include "JackyDebugStream.h" #include "pProcessorState.h" #include "port.h" // InfluenceList ( list ) #include "model.h" #ifndef JACKY_REVISION #include "eventlist.h" #endif class ParallelRootState :public ParallelProcessorState { public: #ifndef JACKY_REVISION //======= commented out by Jacky ===================== /*Jacky Note: ** The new version of the ParallelRoot will NOT send out (@)/(*) msgs ** Also, it will NOT hold external events, these events will be loaded into ** ParallelNodeCoordinators */ //The root processor has to hold the External events list //and has to "remember" which is the next type of message to send: //a CollectMessage or an InternalMessage enum nextMsgType { CollectMsg, InternalMsg }; nextMsgType next; //To manage the external events, we only need a pointer to the //current element, we do not need the whole list in the state EventList::iterator eventsCursor; #endif //end JACKY_REVISION ================================================= InfluenceList topOutputPorts; //Oct. 19, 2005 ParallelRootState(); virtual ~ParallelRootState(); ParallelRootState& operator=(ParallelRootState& thisState); //Assignment void copyState(BasicState *); int getSize() const; #ifdef JACKY_DEBUG //Jacky: this function will be defined in all state classes for ParallelProcesses & Models // to show (print) the content of the state for debugging purpose virtual void showStateContent( ostream& ) const; void showTopOutputPorts( ostream& ) const; #endif }; #ifdef JACKY_DEBUG // ================================================================= inline void ParallelRootState::showStateContent( ostream& out ) const{ //1> first call the counterpart function in the base class ParallelProcessorState::showStateContent(out); //2> show content defined in this class out << "\tParallelRootState ->" << endl << flush; showTopOutputPorts(out); //out << externalMsgs << endl << flush; } inline void ParallelRootState::showTopOutputPorts( ostream& out ) const { InfluenceList::const_iterator it = topOutputPorts.begin(); out << "\t\ttopOutputPorts: < " << flush; if( topOutputPorts.size() == 0 ){ out << "EMPTY >" << endl << flush; } else { for( ; it != topOutputPorts.end(); it++){ out << (*it)->name() << "@" << ((*it)->model()).asString() << ", " << flush; } out << " >" << endl << flush; } } #endif //end JACKY_DEBUG ============================================================== #endif //_PROOTSTATE_H