#ifndef MESSAGEMGR_U #define MESSAGEMGR_H ///////////////////////////////////////////////////////////////////////// // MessageMgr.h - Provides asynchronous message-passing IPC // // ver 1.2 // // Language: Visual C++ 2008 // // Platform: Dell Precision T7400, Vista Ultimate, SP1 // // Application: Help for CSE687 - Object Oriented Design, Project #2 // // Author: Jim Fawcett, CST 4-187, Syracuse University // // (315) 443-3948, jfawcett@twcny.rr.com // ///////////////////////////////////////////////////////////////////////// /* * Module Operations: * ================== * Support asynchronous message-passing using the MMFmgr module. This * module supplies queues and threads to support simple sending and * receiving of strings between two processes. * * NOTE: This module supports two way communication, but only for * one client and one server * * Required Files: * MessageMgr.h, MessageMgr.cpp, MMFmgr.h, MMFmgr.cpp, * Threads.h, Threads.cpp, BlockingQueue.h, locks.h * * Build Command: * cl /EHa /DTEST_MESSAGEMGR MessageMgr.cpp MMFmgr.cpp Threads.cpp * * Maintenance History: * ver 1.2 : 05 May 09 * - added CloseHandle(hStarted_) to MsgMgr::~MsgMgr() to fix a bug in * the wait() method which caused it to never block after the first call. * ver 1.1 : 26 Mar 09 * - removed debugString references and some no longer needed includes. * - fixed a problem with project references to threads and locks modules * ver 1.0 : 22 Mar 09 * - first release */ #include #include "BlockingQueue.h" #include "..\MMFmgr\MMFmgr.h" class MsgMgr { public: MsgMgr(MMFmgr::role); ~MsgMgr(); void putMessage(const std::string& msg); std::string getMessage(); void wait(); private: BQueue* pInQ; BQueue* pOutQ; MMFmgr* pInMMF; MMFmgr* pOutMMF; HANDLE hStarted_; MMFmgr::role role_; }; #endif