#ifndef ABSTRCELL_H #define ABSTRCELL_H ///////////////////////////////////////////////////////////////////// // AbstrCell.h - Provides common resources used by all Cells // // ver 1.0 // // Language: Visual C++, 2008 // // Platform: Dell Dimension T7400, Win 7 Pro // // Application: Utility for CSE687 projects // // Author: Jim Fawcett, Syracuse University, CST 4-187 // // (315) 443-3948, jfawcett@twcny.rr.com // ///////////////////////////////////////////////////////////////////// #include "..\BlockingQueue\BlockingQueue.h" #include "..\Threads\Threads.h" #include "..\Message\Message.h" #include "IMsgPass.h" #include ///////////////////////////////////////////////////////////////////// // AbstractCell class provides shared resources to derived // classes, e.g.: // - blocking queue // - child thread // - collection of targets for my messages class AbstractCell : public IMsgPass { public: AbstractCell(); virtual ~AbstractCell(); // what I do with messages sent to me virtual Message dispatch(Message& msg)=0; // send me a message void PostMsg(Message& msg); // my thread proc calls this to send to my targets void Reply(Message& msg); // executive uses this to connect me to target(s) void Connect(IMsgPass* pTargetCell); // you can block on me until I finish void wait(); protected: // I use this to get messages to dispatch Message GetMsg(); private: BQueue Q; tthread* pThread; std::vector targets; }; #endif