////////////////////////////////////////////////////// // // // Incremental Clock Syncronization. // // 236503(20) Summer 2001 // // Advanced Programming Project. // // Technion. Computer Science Department. // // // // Written by: Reitman Anna // // Fidelman Greg // // Supervisor: Hagit Attya // // Saar Pilosof // // // ////////////////////////////////////////////////////// // Process.h #ifndef _PROCESS_H #define _PROCESS_H #include #include #include #include #include #include "IncClockSynch.h" // Message is a pair typedef std::pair MessagePair; typedef std::list MessageBufferList; //map< Round, set > typedef std::map > MapOfSets; struct Hagit { //constructor Hagit(long nValue):m_Clock(nValue), m_CurrMsgBuff(NULL),m_NextMsgBuff(NULL) { if( nValue < 0 ){ std::cout << "Process::Hagit: Clock value is negative\n"; exit(1); } m_CurrMsgBuff = new MessageBufferList; m_NextMsgBuff = new MessageBufferList; }; //destructor ~Hagit() { delete m_CurrMsgBuff; delete m_NextMsgBuff; }; long m_Clock; //clock value storage of Hagit algorithm //holdes messages received at the previous time slot //and serves for updating clock in a current time slot MessageBufferList* m_CurrMsgBuff; //holdes messages received at the current time slot //will take place of m_CurrMsgBuff at the next time slot MessageBufferList* m_NextMsgBuff; }; //of Hagit struct ST : public Hagit { ST(long nValue):Hagit(nValue),m_Round(nValue){} long m_Round;//resynchronization round (>=1) MapOfSets m_mapSignedMsges;//used for storing signs of distinct processes //we need to receive msg(Round) from (n+1)/2 distinct processes to accept it. };//of ST struct Process { Process(long id,long nValue = 0):m_ProcID(id),m_Hagit(nValue),m_ST(nValue){}; long m_ProcID; //process ID number Hagit m_Hagit; ST m_ST; }; #endif //_PROCESS_H