//////////////////////////////////////////////////////////////////////
//
// Queue.h: interface for the Queue class.
//
// This header file is a part of the PMCA COM package
//
// Amptek Inc. 2000
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_QUEUE_H__2B94FCC2_F096_11D1_B630_9CFF0CC10000__INCLUDED_)
#define AFX_QUEUE_H__2B94FCC2_F096_11D1_B630_9CFF0CC10000__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

class QueueEntryType
{
public:
    QueueEntryType *prev;
    QueueEntryType *next;
    long id;
};

class QueueType  
{
    QueueEntryType *m_first;
    QueueEntryType *m_last;
    ULONG m_id;
    HANDLE m_getSemaphore;
    HANDLE m_access;
public:
    QueueType();
// Public methods
    void LockAccess(void)
    {
        WaitForSingleObject(m_access, INFINITE);
        return;
    }
    void UnlockAccess(void)
    {
        ReleaseMutex(m_access);
        return;
    }
    QueueEntryType *Get(void);
    long Put(QueueEntryType *entry);
    void RemoveAll();
    QueueEntryType *LockedFind(long id);
    QueueEntryType *Remove(long id = -1);

};

#endif // !defined(AFX_QUEUE_H__2B94FCC2_F096_11D1_B630_9CFF0CC10000__INCLUDED_)
