亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? wxlist.cpp

?? 用DirectX制作高級動畫-[Advanced.Animation.with.DirectX]
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
//------------------------------------------------------------------------------
// File: WXList.cpp
//
// Desc: DirectShow base classes - implements a non-MFC based generic list
//       template class.
//
// Copyright (c) 1992-2002 Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------


/* A generic list of pointers to objects.
   Objectives: avoid using MFC libraries in ndm kernel mode and
   provide a really useful list type.

   The class is thread safe in that separate threads may add and
   delete items in the list concurrently although the application
   must ensure that constructor and destructor access is suitably
   synchronised.

   The list name must not conflict with MFC classes as an
   application may use both

   The nodes form a doubly linked, NULL terminated chain with an anchor
   block (the list object per se) holding pointers to the first and last
   nodes and a count of the nodes.
   There is a node cache to reduce the allocation and freeing overhead.
   It optionally (determined at construction time) has an Event which is
   set whenever the list becomes non-empty and reset whenever it becomes
   empty.
   It optionally (determined at construction time) has a Critical Section
   which is entered during the important part of each operation.  (About
   all you can do outside it is some parameter checking).

   The node cache is a repository of nodes that are NOT in the list to speed
   up storage allocation.  Each list has its own cache to reduce locking and
   serialising.  The list accesses are serialised anyway for a given list - a
   common cache would mean that we would have to separately serialise access
   of all lists within the cache.  Because the cache only stores nodes that are
   not in the list, releasing the cache does not release any list nodes.  This
   means that list nodes can be copied or rechained from one list to another
   without danger of creating a dangling reference if the original cache goes
   away.

   Questionable design decisions:
   1. Retaining the warts for compatibility
   2. Keeping an element count -i.e. counting whenever we do anything
      instead of only when we want the count.
   3. Making the chain pointers NULL terminated.  If the list object
      itself looks just like a node and the list is kept as a ring then
      it reduces the number of special cases.  All inserts look the same.
*/


#include <streams.h>

/* set cursor to the position of each element of list in turn  */
#define INTERNALTRAVERSELIST(list, cursor)               \
for ( cursor = (list).GetHeadPositionI()           \
    ; cursor!=NULL                               \
    ; cursor = (list).Next(cursor)                \
    )


/* set cursor to the position of each element of list in turn
   in reverse order
*/
#define INTERNALREVERSETRAVERSELIST(list, cursor)        \
for ( cursor = (list).GetTailPositionI()           \
    ; cursor!=NULL                               \
    ; cursor = (list).Prev(cursor)                \
    )

/* Constructor calls a separate initialisation function that
   creates a node cache, optionally creates a lock object
   and optionally creates a signaling object.

   By default we create a locking object, a DEFAULTCACHE sized
   cache but no event object so the list cannot be used in calls
   to WaitForSingleObject
*/
CBaseList::CBaseList(TCHAR *pName,    // Descriptive list name
                     INT iItems) :    // Node cache size
#ifdef DEBUG
    CBaseObject(pName),
#endif
    m_pFirst(NULL),
    m_pLast(NULL),
    m_Count(0),
    m_Cache(iItems)
{
} // constructor

CBaseList::CBaseList(TCHAR *pName) :  // Descriptive list name
#ifdef DEBUG
    CBaseObject(pName),
#endif
    m_pFirst(NULL),
    m_pLast(NULL),
    m_Count(0),
    m_Cache(DEFAULTCACHE)
{
} // constructor

#ifdef UNICODE
CBaseList::CBaseList(CHAR *pName,    // Descriptive list name
                     INT iItems) :    // Node cache size
#ifdef DEBUG
    CBaseObject(pName),
#endif
    m_pFirst(NULL),
    m_pLast(NULL),
    m_Count(0),
    m_Cache(iItems)
{
} // constructor

CBaseList::CBaseList(CHAR *pName) :  // Descriptive list name
#ifdef DEBUG
    CBaseObject(pName),
#endif
    m_pFirst(NULL),
    m_pLast(NULL),
    m_Count(0),
    m_Cache(DEFAULTCACHE)
{
} // constructor

#endif

/* The destructor enumerates all the node objects in the list and
   in the cache deleting each in turn. We do not do any processing
   on the objects that the list holds (i.e. points to) so if they
   represent interfaces for example the creator of the list should
   ensure that each of them is released before deleting us
*/
CBaseList::~CBaseList()
{
    /* Delete all our list nodes */

    RemoveAll();

} // destructor

/* Remove all the nodes from the list but don't do anything
   with the objects that each node looks after (this is the
   responsibility of the creator).
   Aa a last act we reset the signalling event
   (if available) to indicate to clients that the list
   does not have any entries in it.
*/
void CBaseList::RemoveAll()
{
    /* Free up all the CNode objects NOTE we don't bother putting the
       deleted nodes into the cache as this method is only really called
       in serious times of change such as when we are being deleted at
       which point the cache will be deleted anway */

    CNode *pn = m_pFirst;
    while (pn) {
        CNode *op = pn;
        pn = pn->Next();
        delete op;
    }

    /* Reset the object count and the list pointers */

    m_Count = 0;
    m_pFirst = m_pLast = NULL;

} // RemoveAll



/* Return a position enumerator for the entire list.
   A position enumerator is a pointer to a node object cast to a
   transparent type so all we do is return the head/tail node
   pointer in the list.
   WARNING because the position is a pointer to a node there is
   an implicit assumption for users a the list class that after
   deleting an object from the list that any other position
   enumerators that you have may be invalid (since the node
   may be gone).
*/
POSITION CBaseList::GetHeadPositionI() const
{
    return (POSITION) m_pFirst;
} // GetHeadPosition



POSITION CBaseList::GetTailPositionI() const
{
    return (POSITION) m_pLast;
} // GetTailPosition



/* Get the number of objects in the list,
   Get the lock before accessing the count.
   Locking may not be entirely necessary but it has the side effect
   of making sure that all operations are complete before we get it.
   So for example if a list is being added to this list then that
   will have completed in full before we continue rather than seeing
   an intermediate albeit valid state
*/
int CBaseList::GetCountI() const
{
    return m_Count;
} // GetCount



/* Return the object at rp, update rp to the next object from
   the list or NULL if you have moved over the last object.
   You may still call this function once we return NULL but
   we will continue to return a NULL position value
*/
void *CBaseList::GetNextI(POSITION& rp) const
{
    /* have we reached the end of the list */

    if (rp == NULL) {
        return NULL;
    }

    /* Lock the object before continuing */

    void *pObject;

    /* Copy the original position then step on */

    CNode *pn = (CNode *) rp;
    ASSERT(pn != NULL);
    rp = (POSITION) pn->Next();

    /* Get the object at the original position from the list */

    pObject = pn->GetData();
    // ASSERT(pObject != NULL);    // NULL pointers in the list are allowed.
    return pObject;
} //GetNext



/* Return the object at p.
   Asking for the object at NULL ASSERTs then returns NULL
   The object is NOT locked.  The list is not being changed
   in any way.  If another thread is busy deleting the object
   then locking would only result in a change from one bad
   behaviour to another.
*/
void *CBaseList::GetI(POSITION p) const
{
    if (p == NULL) {
        return NULL;
    }

    CNode * pn = (CNode *) p;
    void *pObject = pn->GetData();
    // ASSERT(pObject != NULL);    // NULL pointers in the list are allowed.
    return pObject;
} //Get



/* Return the first position in the list which holds the given pointer.
   Return NULL if it's not found.
*/
POSITION CBaseList::FindI( void * pObj) const
{
    POSITION pn;
    INTERNALTRAVERSELIST(*this, pn){
        if (GetI(pn)==pObj) {
            return pn;
        }
    }
    return NULL;
} // Find



/* Remove the first node in the list (deletes the pointer to its object
   from the list, does not free the object itself).
   Return the pointer to its object or NULL if empty
*/
void *CBaseList::RemoveHeadI()
{
    /* All we do is get the head position and ask for that to be deleted.
       We could special case this since some of the code path checking
       in Remove() is redundant as we know there is no previous
       node for example but it seems to gain little over the
       added complexity
    */

    return RemoveI((POSITION)m_pFirst);
} // RemoveHead



/* Remove the last node in the list (deletes the pointer to its object
   from the list, does not free the object itself).
   Return the pointer to its object or NULL if empty
*/
void *CBaseList::RemoveTailI()
{
    /* All we do is get the tail position and ask for that to be deleted.
       We could special case this since some of the code path checking
       in Remove() is redundant as we know there is no previous
       node for example but it seems to gain little over the
       added complexity
    */

    return RemoveI((POSITION)m_pLast);
} // RemoveTail



/* Remove the pointer to the object in this position from the list.
   Deal with all the chain pointers
   Return a pointer to the object removed from the list.
   The node object that is freed as a result
   of this operation is added to the node cache where
   it can be used again.
   Remove(NULL) is a harmless no-op - but probably is a wart.
*/
void *CBaseList::RemoveI(POSITION pos)
{
    /* Lock the critical section before continuing */

    // ASSERT (pos!=NULL);     // Removing NULL is to be harmless!
    if (pos==NULL) return NULL;


    CNode *pCurrent = (CNode *) pos;
    ASSERT(pCurrent != NULL);

    /* Update the previous node */

    CNode *pNode = pCurrent->Prev();
    if (pNode == NULL) {
        m_pFirst = pCurrent->Next();
    } else {
        pNode->SetNext(pCurrent->Next());
    }

    /* Update the following node */

    pNode = pCurrent->Next();
    if (pNode == NULL) {
        m_pLast = pCurrent->Prev();
    } else {
        pNode->SetPrev(pCurrent->Prev());
    }

    /* Get the object this node was looking after */

    void *pObject = pCurrent->GetData();

    // ASSERT(pObject != NULL);    // NULL pointers in the list are allowed.

    /* Try and add the node object to the cache -
       a NULL return code from the cache means we ran out of room.
       The cache size is fixed by a constructor argument when the
       list is created and defaults to DEFAULTCACHE.
       This means that the cache will have room for this many
       node objects. So if you have a list of media samples
       and you know there will never be more than five active at
       any given time of them for example then override the default
       constructor
    */

    m_Cache.AddToCache(pCurrent);

    /* If the list is empty then reset the list event */

    --m_Count;
    ASSERT(m_Count >= 0);
    return pObject;
} // Remove



/* Add this object to the tail end of our list
   Return the new tail position.
*/

POSITION CBaseList::AddTailI(void *pObject)
{
    /* Lock the critical section before continuing */

    CNode *pNode;
    // ASSERT(pObject);   // NULL pointers in the list are allowed.

    /* If there is a node objects in the cache then use
       that otherwise we will have to create a new one */

    pNode = (CNode *) m_Cache.RemoveFromCache();
    if (pNode == NULL) {
        pNode = new CNode;
    }

    /* Check we have a valid object */

    if (pNode == NULL) {
        return NULL;
    }

    /* Initialise all the CNode object
       just in case it came from the cache
    */

    pNode->SetData(pObject);
    pNode->SetNext(NULL);
    pNode->SetPrev(m_pLast);

    if (m_pLast == NULL) {
        m_pFirst = pNode;
    } else {
        m_pLast->SetNext(pNode);
    }

    /* Set the new last node pointer and also increment the number
       of list entries, the critical section is unlocked when we
       exit the function
    */

    m_pLast = pNode;
    ++m_Count;

    return (POSITION) pNode;
} // AddTail(object)



/* Add this object to the head end of our list
   Return the new head position.
*/
POSITION CBaseList::AddHeadI(void *pObject)
{
    CNode *pNode;
    // ASSERT(pObject);  // NULL pointers in the list are allowed.

    /* If there is a node objects in the cache then use

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一二三四久久| 国产suv精品一区二区883| 奇米精品一区二区三区在线观看一 | 911精品国产一区二区在线| 亚洲精品一区二区三区在线观看| 亚洲国产岛国毛片在线| 婷婷久久综合九色综合伊人色| 国产成人免费在线观看| 91精品一区二区三区在线观看| 国产精品久久毛片av大全日韩| 日韩中文字幕av电影| 91免费看片在线观看| 久久精品日产第一区二区三区高清版 | 婷婷国产v国产偷v亚洲高清| 国产成人在线影院| 日韩视频一区二区| 亚洲午夜国产一区99re久久| 色婷婷狠狠综合| 中文字幕中文字幕一区二区| 国产酒店精品激情| 精品国产一区二区三区四区四 | 国产精品色哟哟网站| 久久精品国产77777蜜臀| 欧美日韩精品一区二区天天拍小说| 国产精品不卡一区二区三区| 国产精品性做久久久久久| 精品日韩欧美一区二区| 亚洲3atv精品一区二区三区| 欧美性一区二区| 一区二区三区免费观看| 色婷婷香蕉在线一区二区| 18成人在线视频| 91色综合久久久久婷婷| 国产精品免费aⅴ片在线观看| 国产精品 欧美精品| 久久久精品黄色| 国产精品911| 国产精品久久毛片av大全日韩| 粉嫩一区二区三区性色av| 国产精品免费视频一区| proumb性欧美在线观看| 综合激情成人伊人| 色狠狠综合天天综合综合| 亚洲影院久久精品| 欧美高清视频一二三区| 久久不见久久见中文字幕免费| 日韩女优视频免费观看| 欧美性生活久久| 天堂一区二区在线| 精品国产1区二区| 国产成人综合在线观看| 国产精品福利av| 欧美性色欧美a在线播放| 日韩在线观看一区二区| 精品国产91九色蝌蚪| 不卡欧美aaaaa| 亚洲影视在线播放| 欧美r级在线观看| 成人久久18免费网站麻豆 | 精品国产一区a| 成人免费看片app下载| 亚洲精品v日韩精品| 日韩视频免费直播| www.亚洲在线| 日韩av电影天堂| 中文字幕第一区| 欧美精品色一区二区三区| 国内精品第一页| 亚洲小说欧美激情另类| 亚洲精品在线电影| 色999日韩国产欧美一区二区| 日日夜夜免费精品视频| 国产精品美女久久久久久久久久久| 在线观看网站黄不卡| 国产一二三精品| 天堂精品中文字幕在线| 国产精品乱码一区二区三区软件| 欧美日韩一区中文字幕| 岛国av在线一区| 青青草精品视频| 亚洲黄色录像片| 久久精品免费在线观看| 欧美卡1卡2卡| 91久久精品一区二区三| 国产尤物一区二区在线| 日韩高清不卡一区二区| 亚洲欧洲制服丝袜| 亚洲精选视频在线| 欧美不卡在线视频| 欧美性三三影院| 99久久久精品免费观看国产蜜| 久草热8精品视频在线观看| 一二三四区精品视频| 国产精品国产三级国产普通话蜜臀 | 亚洲最新视频在线观看| 亚洲国产精品激情在线观看| 欧美一区二区三区视频在线| 91极品美女在线| 99精品视频免费在线观看| 国内精品写真在线观看| 麻豆精品视频在线观看免费| 五月婷婷久久丁香| 亚洲综合色自拍一区| 中文字幕一区av| 国产精品三级视频| 国产女人水真多18毛片18精品视频| 欧美一区二区精品在线| 欧美日产国产精品| 精品视频全国免费看| 欧美网站大全在线观看| 欧美在线一区二区| 欧美日韩一区小说| 欧美日本一区二区在线观看| 欧美色图激情小说| 欧美三片在线视频观看| 欧美日韩一级片网站| 欧美视频在线不卡| 6080国产精品一区二区| 欧美一区日本一区韩国一区| 日韩一级片网址| 精品国产91乱码一区二区三区 | 国产精品午夜在线| 欧美国产精品中文字幕| 国产精品你懂的在线| 亚洲天堂成人在线观看| 亚洲精品视频观看| 亚洲r级在线视频| 免费观看在线综合色| 国产一区二三区| 大尺度一区二区| 色老头久久综合| 91精品婷婷国产综合久久| 日韩三区在线观看| 久久久久久久久免费| 亚洲欧洲日产国产综合网| 亚洲猫色日本管| 日本aⅴ免费视频一区二区三区| 奇米精品一区二区三区四区| 国产曰批免费观看久久久| 成人app在线观看| 欧美精品丝袜中出| 国产亚洲精品中文字幕| 亚洲精品自拍动漫在线| 日韩国产高清在线| 国产成人免费xxxxxxxx| 91国产丝袜在线播放| 欧美一级欧美三级| 中文字幕一区二区在线播放| 香蕉影视欧美成人| 国产999精品久久久久久| 在线中文字幕一区| 2022国产精品视频| 一区二区三区日韩欧美精品| 九九视频精品免费| 色综合久久久久久久| 欧美电影免费观看高清完整版在线| 亚洲国产成人在线| 青青草91视频| 色综合一区二区三区| 精品精品欲导航| 亚洲午夜在线视频| 成人av综合在线| 日韩欧美一区二区免费| 亚洲精品一二三| 国产91丝袜在线播放| 欧美日韩成人在线一区| 最新国产成人在线观看| 国内精品嫩模私拍在线| 欧美色网站导航| 国产精品成人免费精品自在线观看| 日韩 欧美一区二区三区| 色94色欧美sute亚洲13| 国产女主播在线一区二区| 91在线视频官网| 国产日韩精品久久久| 久久国产精品一区二区| 欧美日韩国产在线播放网站| 亚洲欧洲日本在线| 成人一区在线观看| 久久综合色8888| 麻豆精品国产传媒mv男同| 欧洲精品一区二区| 亚洲欧美日韩久久| av激情综合网| 国产精品天干天干在线综合| 久久爱另类一区二区小说| 欧美久久高跟鞋激| 亚洲成人黄色小说| 欧美三区在线观看| 亚洲网友自拍偷拍| 欧美综合久久久| 一区二区成人在线| 在线看日韩精品电影| 亚洲精品视频一区二区| 91老师片黄在线观看| 成人欧美一区二区三区| 91日韩精品一区| 亚洲精品视频免费看| 色94色欧美sute亚洲线路一ni| 一区二区三区在线视频观看 |