⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hnqueue.h

📁 Network Stats using PSSDK
💻 H
字号:
/****************************************************************************
**                                                                         **
**                           PSSDK HNQueue module                          **
**            Copyright (c) 1997 - 2007 microOLAP Technologies LTD,        **
**                       Khalturin A.P., Naumov D.A.                       **
**                               Header File                               **
**                                                                         **
****************************************************************************/

//---------------------------------------------------------------------------
#ifndef __HN_PSSDK_QUEUE_H__
#define __HN_PSSDK_QUEUE_H__ 
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// Class CHNQueue
//---------------------------------------------------------------------------
class CHNQueue
{
private:
    HANDLE hQue;

public:
    //###########################################################################
    //    Create & Destroy
    //###########################################################################

    //---------------------------------------------------------------------------
    // v2.2 - QueCreate - Creates the HNQueue object.
    CHNQueue() { hQue = QueCreate(); }

    //---------------------------------------------------------------------------
    // v2.2 - QueDestroy - Destroys the HNQueue object.
    ~CHNQueue() { QueDestroy(hQue); }

public:
    //###########################################################################
    //    Additionals methods
    //###########################################################################
    BOOL     IsValid() { return (BOOL)(hQue != NULL); }
    HANDLE   Get_Handle() { return hQue; }
    operator HANDLE() { return hQue; }


public:
    //###########################################################################
    //    Methods of redirect
    //###########################################################################

    //---------------------------------------------------------------------------
    // v2.2 - QueGetMaxPacketSize - Returns the queue packet maximum size.
    DWORD Get_MaxPacketSize() 
    { return QueGetMaxPacketSize(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueSetMaxPacketSize - Sets the queue packet maximum size.
    DWORD Set_MaxPacketSize(DWORD MaxPacketSize) 
    { return QueSetMaxPacketSize(hQue,MaxPacketSize); }

    //---------------------------------------------------------------------------
    // v2.2 - QueGetItemsCount - Returns an overall quantity of queue elements.
    DWORD Get_ItemsCount() 
    { return QueGetItemsCount(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueSetItemsCount - Sets an overall quantity of queue elements.
    DWORD Set_ItemsCount(DWORD ItemsCount) 
    { return QueSetItemsCount(hQue,ItemsCount); }

    //---------------------------------------------------------------------------
    // v2.2 - QueGetAllocatedSize - Returns total size of the memory pool used by queue.
    SIZE_T Get_AllocatedSize() 
    { return QueGetAllocatedSize(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueGetFreeCount - Returns total amount of the queue items with Free status.
    DWORD Get_FreeCount() 
    { return QueGetFreeCount(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueGetFullCount - Returns total amount of the queue items with Full status.
    DWORD Get_FullCount() 
    { return QueGetFullCount(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueAllocItems - Allocates memory for queue items and creates queue synchronization objects.
    DWORD AllocItems() 
    { return QueAllocItems(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueFreeItems - Releases queue resources.
    DWORD FreeItems() 
    { return QueFreeItems(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueGetFreeItem - Returns an element with Free status from the queue.
    HANDLE Get_FreeItem(DWORD Milliseconds) 
    { return QueGetFreeItem(hQue,Milliseconds); }

    //---------------------------------------------------------------------------
    // v2.2 - QueReturnFreeItem - Returns an element with Free status back to the queue.
    VOID Return_FreeItem(HANDLE hPkt) 
    { QueReturnFreeItem(hQue,hPkt); }

    //---------------------------------------------------------------------------
    // v2.2 - QueGetFullItem - Returns an element with Full status from the queue.
    HANDLE Get_FullItem(DWORD Milliseconds) 
    { return QueGetFullItem(hQue,Milliseconds); }

    //---------------------------------------------------------------------------
    // v2.2 - QueReturnFullItem - Returns an element with Full status back to the queue.
    VOID Return_FullItem(HANDLE hPkt) 
    { QueReturnFullItem(hQue,hPkt); }

    //---------------------------------------------------------------------------
    // v2.2 - QueUnblockWaitFree - Turns out all application threads awaiting for Free elements from awaiting status.
    BOOL UnblockWaitFree() 
    { return QueUnblockWaitFree(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueUnblockWaitFull - Turns out all application threads awaiting for Full elements from awaiting status.
    BOOL UnblockWaitFull() 
    { return QueUnblockWaitFull(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueStart - Creates and starts internal queue thread.
    DWORD Start() 
    { return QueStart(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueStop - Stops internal queue thread.
    DWORD Stop() 
    { return QueStop(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueIsStarted - Shows the status of the internal thread.
    BOOL IsStarted() 
    { return QueIsStarted(hQue); }

    //---------------------------------------------------------------------------
    // v2.2 - QueSetOnThreadBegin - Sets the OnThreadBegin event.
    FARPROC Set_OnThreadBegin(FARPROC pfOnThreadBegin, DWORD_PTR Param) 
    { return QueSetOnThreadBegin(hQue,pfOnThreadBegin,Param); }

    //---------------------------------------------------------------------------
    // v2.2 - QueSetOnThreadEnd - Sets the OnThreadEnd event.
    FARPROC Set_OnThreadEnd(FARPROC pfOnThreadEnd, DWORD_PTR Param) 
    { return QueSetOnThreadEnd(hQue,pfOnThreadEnd,Param); }

    //---------------------------------------------------------------------------
    // v2.2 - QueSetOnDeleteItems - Sets the OnDelete event.
    FARPROC Set_OnDeleteItems(FARPROC pfOnDeleteItems, DWORD_PTR Param) 
    { return QueSetOnDeleteItems(hQue,pfOnDeleteItems,Param); }

    //---------------------------------------------------------------------------
    // v2.2 - QueSetOnPacketRecv - Sets the OnPacketReceive event.
    FARPROC Set_OnPacketRecv(FARPROC pfOnPacketRecv, DWORD_PTR Param) 
    { return QueSetOnPacketRecv(hQue,pfOnPacketRecv,Param); }

    //---------------------------------------------------------------------------
    // v3.1 - QueGetOrderingById - Return sorting packets by ID flag value
    BOOL Get_OrderingById()
    { return QueGetOrderingById(hQue); }

    //---------------------------------------------------------------------------
    // v3.1 - QueSetOrderingById - Set sorting packets by ID flag
    BOOL Set_OrderingById(BOOL bOrderingById)
    { return QueSetOrderingById(hQue,bOrderingById); }

    //---------------------------------------------------------------------------
    // v3.1 - QueGetFreeItems - Returns an elements with Free status from the queue.
    DWORD Get_FreeItems(DWORD Milliseconds, PHANDLE pPkts, DWORD Count)
    { return QueGetFreeItems(hQue, Milliseconds, pPkts, Count); }

    //---------------------------------------------------------------------------
    // v3.1 - QueReturnFreeItems - Returns an elements with Free status back to the queue.
    VOID Return_FreeItems(PHANDLE pPkts, DWORD Count)
    { QueReturnFreeItems(hQue, pPkts, Count); }

    //---------------------------------------------------------------------------
    // v3.1 - QueGetFullItems - Returns an elements with Full status from the queue.
    DWORD Get_FullItems(DWORD Milliseconds, PHANDLE pPkts, DWORD Count)
    { return QueGetFullItems(hQue, Milliseconds, pPkts, Count); }

    //---------------------------------------------------------------------------
    // v3.1 - QueReturnFullItems - Returns an element with Full status back to the queue.
    VOID Return_FullItems(PHANDLE pPkts, DWORD Count)
    { QueReturnFullItems(hQue, pPkts, Count); }

    //---------------------------------------------------------------------------
    // v3.1 - QueGetReceiveManyAtOnce - Return ReceiveManyAtOnce flag (see OnPacket(s)Receive event).
    BOOL Get_ReceiveManyAtOnce()
    { return QueGetReceiveManyAtOnce(hQue); }

    //---------------------------------------------------------------------------
    // v3.1 - QueSetReceiveManyAtOnce - Set ReceiveManyAtOnce flag (see OnPacket(s)Receive event).
    BOOL Set_ReceiveManyAtOnce(BOOL bReceiveManyAtOnce)
    { return QueSetReceiveManyAtOnce(hQue, bReceiveManyAtOnce); }

    //---------------------------------------------------------------------------
    // v3.1 - QueSetOnPacketsRecv - Sets the OnPacketsReceive event.
    FARPROC Set_OnPacketsRecv(FARPROC pfOnPacketsRecv, DWORD_PTR Param) 
    { return QueSetOnPacketsRecv(hQue,pfOnPacketsRecv,Param); }
};

//---------------------------------------------------------------------------
#endif // __HN_PSSDK_QUEUE_H__
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -