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

📄 umc_avs_dec_list.h

📁 audio-video-codecs.rar语音编解码器
💻 H
字号:
/*
//
//              INTEL CORPORATION PROPRIETARY INFORMATION
//  This software is supplied under the terms of a license  agreement or
//  nondisclosure agreement with Intel Corporation and may not be copied
//  or disclosed except in  accordance  with the terms of that agreement.
//    Copyright (c) 2007 Intel Corporation. All Rights Reserved.
//
//
*/

#ifndef __UMC_AVS_DEC_LIST_H
#define __UMC_AVS_DEC_LIST_H

namespace UMC
{

template <class T>
class AVSListElement : public T
{
public:
    // Default constructor
    AVSListElement(void)
    {
        m_pNext = 0;
    }

    inline
    AVSListElement<T> *GetNext(void)
    {
        return m_pNext;
    }

    inline
    void SetNext(AVSListElement<T> *pNext)
    {
        m_pNext = pNext;
    }

protected:
    AVSListElement<T> *m_pNext;                                 // (AVSListElement<T> *) pointer to the next item in a list
};

// this class is a wrapper of simple lists' operations

template <class T>
class AVSList
{
public:
    // Default constructor
    AVSList(void)
    {
        m_pHead = 0;
    }

    void Reset(void)
    {
        m_pHead = 0;
    }

    inline
    AVSListElement<T> *GetHead(void)
    {
        return m_pHead;
    }

    AVSListElement<T> *ExtractHead(void)
    {
        AVSListElement<T> *pTemp = m_pHead;

        if (pTemp)
        {
            // move the list head
            m_pHead = pTemp->GetNext();

            // remove link to the list
            pTemp->SetNext(0);
        }

        return pTemp;
    }

    void AddToHead(AVSListElement<T> &element)
    {
        element.SetNext(m_pHead);
        m_pHead = &element;
    }

    void AddToTail(AVSList<T> &list)
    {
        if (m_pHead)
        {
            AVSListElement<T> *pTemp = m_pHead;

            // find the last element in the list
            while (pTemp->GetNext())
                pTemp = pTemp->GetNext();

            // concatenate the lists
            pTemp->SetNext(list.GetHead());
        }
        else
            m_pHead = list.GetHead();

        list.Reset();
    }

    void AddToTail(AVSListElement<T> &element)
    {
        AVSList<T> tmp;

        tmp.AddToHead(element);

        AddToTail(tmp);
    }

protected:
    AVSListElement<T> *m_pHead;                                 // (AVSListElement<T> * *) pointer to the first item in the list
};

} // namespace UMC

#endif // __UMC_AVS_DEC_LIST_H

⌨️ 快捷键说明

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