EventHelix.com: CASE Tools; Real-time and Embedded System Design; Object Oriented Design EventStudio 2.0: System Engineering CASE ToolEventStudio 2.5
Sequence diagram based system design and modeling
Home   What's New   EventStudio 2.5   Real-time Mantra   Thought Projects   Contact Us
Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

Message_Queue.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 #include <queue>           // STL header file for queue
00010 #include <list>
00011 using namespace std;       // Specify that we are using the std namespace
00012 
00013 class Message;
00014 
00027 
00028 class Message_Queue
00029 {
00032    typedef queue<Message *, list<Message *> > MsgQueType;
00033 
00035    MsgQueType m_msgQueue;
00036       
00037 public:
00044    void Add(Message *pMsg)
00045    {
00046       // Insert the element at the end of the queue
00047       m_msgQueue.push(pMsg);
00048    }
00049    
00059 
00060    Message *Remove()
00061    {
00062       Message *pMsg = NULL;
00063       
00064       // Check if the message queue is not empty
00065       if (!m_msgQueue.empty())
00066       {
00067          // Queue is not empty so get a pointer to the
00068          // first message in the queue
00069          pMsg = m_msgQueue.front();
00070          
00071          // Now remove the pointer from the message queue
00072          m_msgQueue.pop();
00073       }
00074       return pMsg;
00075    }
00076    
00080    int GetLength() const
00081    {
00082       return m_msgQueue.size();
00083    }   
00084 };

Generated on Sun Feb 13 21:30:16 2005 for Object Oriented Design Examples by doxygen 1.3.4
 Home   What's New   EventStudio 2.5   Real-time Mantra   Thought Projects   Contact Us
Copyright © 2000-2005 EventHelix.com Inc. All Rights Reserved.