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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cseg.h

?? 研讀AxCrypt對加解密的處理方法
?? H
字號:
#pragma once
#ifndef AXPIPE_CSEG_H
#define AXPIPE_CSEG_H
/*! \file CSeg.h
    \brief Reference counted memory buffers AxPipe::CSeg

    @(#) $Id: CSeg.h,v 1.3 2004/02/02 12:10:47 svante Exp $

    AxPipe - Binary Stream Framework

    Copyright (C) 2003 Svante Seleborg/Axon Data, All rights reserved.

    This program is free software; you can redistribute it and/or modify it under the terms
    of the GNU General Public License as published by the Free Software Foundation;
    either version 2 of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along with this program;
    if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
    Boston, MA 02111-1307 USA

    The author may be reached at mailto:axpipe@axondata.se and http://axpipe.sourceforge.net

    Why is this framework released as GPL and not LGPL?
    See http://www.gnu.org/philosophy/why-not-lgpl.html

----
\verbatim
    CSeg.h                          Reference counted memory buffers

    E-mail                          YYYY-MM-DD              Reason
    axpipe@axondata.se              2003-12-05              Initial
\endverbatim
*/
#include "AxPipe.h"

#include "AxAssert.h"
#define AXLIB_ASSERT_FILE "CSeg.h"

namespace AxPipe {
/// \brief Reference counted memory buffer objects.
///
/// Objects of this kind *must* not be instantiated by any other
/// means than 'new'. No arrays, no static, and no automatic. When
/// the reference count falls to zero, they are deleted automagically.
///
/// You must *never* reference a pointer after a call to Release().
/// You must *never* 'delete' a pointer manually. Let Release() do it.
///
/// The default is that these objects are read-write. You can determine
/// this by attempting to get a PtrWr(). If you get NULL, you must
/// copy. You set them read-only by specifying this in the constructor.
///
/// A CSeg consists of a buffer, referenced by a pointer. The buffer may be
/// owned by the CSeg object, or not. If it is, it'll be deleted when the last
/// reference to the object is Released() 'd.
///
/// Not all of the buffer may consist valid data, the start in the buffer may
/// be adjusted by an internally maintained offset, and the length of valid data
/// by an internally maintained length of valid data starting from the offset.
///
/// General rule of usage:
/// Always allocate with new - never create static or automatic CSeg objects, only through CAutoSeg
/// When you pass a copy elsewhere, especially if it is potentially a different thread, call AddRef().
/// When you're done with your instance, call Release().
/// Never perform a 'delete' on a CSeg *.
/// Never reference a CSeg after passing it anywhere without a prior AddRef() call!
///
/// CSeg's are thread safe in two ways. The reference count, m_iRefCnt, is only read and written
/// using the InterlockedIncrement()/InterlockedDecrement() API which are inherently thread safe.
/// In other functions, references to values that may be written at other times than object
/// construction and initialization, a critical section is used as necessary to ensure thread safeness.
class CSeg {
private:
    volatile LONG m_iRefCnt;                ///< Reference count. volatile due to InterlockedXXX req's
    CRITICAL_SECTION m_CritSect;            ///< This object may be shared among threads, thus needs this.

    unsigned char *m_pvBuf;                 ///< The raw data buffer pointer. Never changed once set.
    size_t m_cbBuf;                         ///< The raw data buffer size - not the same as how much valid data.
    CSeg *m_pMom;                           ///< Owning object, if this is a child.
    bool m_fOwnPtr;                         ///< True if this CSeg owns and manages the data buffer.
    bool m_fReadOnly;                       ///< True if this is a read-only object.
    int m_iType;                            ///< Opaque type indicator, free to use. Do note usage in AxPipe::eSegType

    size_t m_cbOff;                         ///< Current offset from start of raw buffer to valid data.
    size_t m_cbLen;                         ///< Current number of valid bytes of raw data, starting at CSeg::m_cbOff

    /// Constructor helper, init's a CSeg appropriately
    void Init(size_t cbBuf, void *pvBuf, bool fReadOnly, int iType);

    /// \brief Make a dependent copy of the original.
    CSeg& operator=(CSeg& rhs);

public:
    /// \brief Default, and full-function, ctor for non-owned (not deleted on destruction).
    CSeg(size_t cbBuf = 0, void *pvBuf = NULL, bool fReadOnly = false);

    /// \brief For constant data, and thus set ReadOnly true; Non-owned data (not deleted).
    CSeg(size_t cbBuf, const void *pvBuf);

    /// \brief Construct an owned buffer with a copy of provided data, possibly also in a larger buffer.
    CSeg(const void *pvBuf, size_t cbLen, size_t cbGrowBuf = 0);

    /// \brief Delete buffer if owned, Release() parent, if child and delete critical section.
    virtual ~CSeg();
    
    unsigned char *Ptr();                   ///< Get the raw buffer pointer.
    const unsigned char *PtrRd();           ///< Get a read-only pointer to the valid data in the buffer, using m_cbOff.
    unsigned char *PtrWr();                 ///< Get a writeable pointer to the valid data.
    unsigned char *PtrRelease();            ///< Get an independent free buffer with valid data and also Release().
    size_t Size(void);                      ///< Get the number of useable bytes in the buffer.
    size_t Len(void);                       ///< Get the length of valid data in bytes in the segment.
    CSeg *Len(size_t cbLen);                ///< Set the length of valid data in bytes in the segment.
    CSeg *Writeable();                      ///< Get a definitely writeable CSeg *, possibly a copy.
    CSeg *Drop(size_t cbOff);               ///< Drop cbOff bytes at the start of the buffer.
    CSeg *AddRef();                         ///< Increment the reference count of this object.
    int Release();                          ///< Decrement the reference count of this object.
    int Type();                             ///< Get the type, an opaque user-defined non-zero integer.
    CSeg *SetType(int iType);               ///< Set the type, an opaque user-defined non-zero integer.
    static bool IsSeg(CSeg *pSeg);          ///< Check if a segment pointer is valid reference to standard data.
    CSeg *Clone();                          ///< Make a clone of ourself
    static void *ClassId();                 ///< Run-time type identifcation.
    virtual void *RTClassId();              ///< Run-Time version of our type identification.
};

/// \brief std::auto_ptr like functionality with CSeg pointers.
///
/// If you really want auto_ptr-functionality with our reference counted CSeg's, use
/// this class like you would auto_ptr, with some limitations. You can't use auto_ptr,
/// as the proper way to dispose of a CSeg * is not to delete it, but to CSeg::Release() it.
/// \param T A CSeg-based class.
template<class T> class Auto_Seg {
private:
    T *m_p;                                 ///< The pointer to the CSeg-derived object.

    /// \brief Call CSeg::Release() if the pointer is valid.
    inline void Release() {
        if (m_p) {
            m_p->Release();
        }
    }
public:
    /// \brief Construct with a given CSeg-derived pointer, or NULL if none given.
    inline Auto_Seg(T *p = NULL) {
        m_p = p;
    }

    /// \brief Basically just CSeg::Release()
    inline ~Auto_Seg() {
        Release();
    }
    
    /// \brief Assign a new CSeg-derived pointer, CSeg::Release() the current, if any.
    inline Auto_Seg<T>& operator=(T *p) {
        Release();
        m_p = p;
        return *this;
    }
    
    /// \brief Assign a pointer to a CSeg object, CSeg::AddRef() the source first.
    inline Auto_Seg<T>& operator=(T& rhs) {
        rhs.AddRef();
        return *this = &rhs;
    }
    
    /// \brief Assign a Auto_Seg-derived reference.
    inline Auto_Seg<T>& operator=(Auto_Seg<T>& rhs) {
        if ((T *)rhs) {
            rhs->AddRef();
        }
        return *this = rhs.m_p;
    }
        
    /// \brief Reference the CSeg-derived pointer as a pointer.
    inline T* operator ->() {
        return m_p;
    }
    
    /// \brief Get the referenced CSeg-derived pointer.
    inline T* get() {
        return m_p;
    }
    
    /// \brief Get the reference CSeg-derived pointer, and then clear the reference here.
    inline T* release() {
        T *p = m_p;
        m_p = NULL;
        return p;
    }
};
/// \brief Use pretty much as you would auto_ptr<CSeg> if you could have done that, which you can't.
typedef Auto_Seg<CSeg> CAutoSeg;

}; // namespace AxPipe
#endif AXPIPE_CERROR_H

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日本国产视频| 成人精品免费网站| 欧美高清视频不卡网| 亚洲成人精品影院| 日韩欧美国产成人一区二区| 美女视频网站久久| 久久天天做天天爱综合色| 国产成人免费av在线| 一区在线观看视频| 欧美三片在线视频观看| 美女性感视频久久| 国产精品三级电影| 欧美性生活影院| 国内欧美视频一区二区| 18成人在线观看| 欧美日韩国产成人在线免费| 麻豆久久久久久| 国产精品每日更新在线播放网址| 在线免费视频一区二区| 麻豆精品一区二区av白丝在线| 久久久精品2019中文字幕之3| eeuss鲁片一区二区三区| 亚洲成人777| 国产亚洲1区2区3区| 一本色道久久综合亚洲精品按摩| 日韩专区欧美专区| 国产精品久久免费看| 欧美日韩的一区二区| 国产成人综合自拍| 图片区小说区区亚洲影院| 26uuu另类欧美亚洲曰本| 日韩欧美国产一区二区三区| 成人一区二区三区视频在线观看| 亚洲午夜久久久| 久久久久国色av免费看影院| 91久久国产综合久久| 黑人巨大精品欧美黑白配亚洲| 日韩毛片精品高清免费| 日韩欧美激情一区| 欧美三日本三级三级在线播放| 激情偷乱视频一区二区三区| 一区二区不卡在线视频 午夜欧美不卡在 | 99久久国产综合精品女不卡| 蜜桃一区二区三区四区| 亚洲免费观看高清完整版在线 | 91丨porny丨蝌蚪视频| 免费人成黄页网站在线一区二区 | 亚洲色图欧美激情| 久久亚洲春色中文字幕久久久| 欧美在线999| 成人动漫在线一区| 国产美女精品人人做人人爽| 亚洲6080在线| 一区二区三区免费观看| 国产精品免费aⅴ片在线观看| 欧美一区2区视频在线观看| 欧美写真视频网站| 色综合咪咪久久| 99国产精品久久久久久久久久久| 久久精品国产精品亚洲红杏| 亚洲成精国产精品女| 亚洲欧美偷拍三级| 中国av一区二区三区| 久久久久久久久97黄色工厂| 久久只精品国产| 精品欧美久久久| 欧美不卡一区二区三区| 91精品国产综合久久小美女| 欧美性生活一区| 欧美中文字幕一区二区三区| 欧美在线视频全部完| 色屁屁一区二区| 一本色道久久加勒比精品| 99在线精品一区二区三区| 福利一区二区在线| 国产精品一区二区三区网站| 激情五月播播久久久精品| 久久精品国产**网站演员| 久久精品国产色蜜蜜麻豆| 韩国成人福利片在线播放| 国产剧情一区二区| 成人综合激情网| 菠萝蜜视频在线观看一区| 99久久免费视频.com| 一本久道久久综合中文字幕| 色综合久久久网| 欧美日本韩国一区二区三区视频| 欧美日韩一区二区三区高清 | 激情文学综合丁香| 国产成人精品亚洲日本在线桃色| 高清免费成人av| 成人免费看黄yyy456| 91免费版在线| 欧美日韩在线精品一区二区三区激情| 欧美日韩在线观看一区二区 | 亚洲乱码国产乱码精品精小说| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 成人欧美一区二区三区小说| 亚洲视频免费在线观看| 日日噜噜夜夜狠狠视频欧美人 | 久久99国产精品免费| 国产伦精品一区二区三区免费迷| 东方aⅴ免费观看久久av| av网站一区二区三区| 欧美丝袜丝nylons| 久久综合色天天久久综合图片| 久久精品视频一区二区三区| 国产精品情趣视频| 香蕉成人啪国产精品视频综合网| 激情成人午夜视频| 99久久精品国产导航| 日韩小视频在线观看专区| 久久久高清一区二区三区| 亚洲精品美国一| 经典三级一区二区| 色欧美88888久久久久久影院| 欧美一区在线视频| 国产精品成人免费精品自在线观看| 亚洲第一会所有码转帖| 91精品国产综合久久香蕉麻豆| 久久日韩精品一区二区五区| 亚洲黄色在线视频| 极品尤物av久久免费看| 日本国产一区二区| 亚洲精品一线二线三线| 亚洲精品视频在线| 国产美女av一区二区三区| 欧美色偷偷大香| 国产精品久久久久久久久图文区 | 国产日韩av一区二区| 性感美女久久精品| 99久久精品国产毛片| 久久综合九色综合97婷婷女人 | 国产成人在线视频网址| 欧美丰满一区二区免费视频 | 欧美特级限制片免费在线观看| 2020国产成人综合网| 午夜免费欧美电影| av电影在线观看完整版一区二区| 日韩欧美一二三| 一区二区不卡在线视频 午夜欧美不卡在 | 一片黄亚洲嫩模| 国产成人免费视| xnxx国产精品| 麻豆久久一区二区| 欧美日韩高清一区二区| 一区二区三区欧美久久| 国产成人午夜视频| www国产成人免费观看视频 深夜成人网| 亚洲一区二区精品视频| 91小宝寻花一区二区三区| 国产亚洲精品aa| 国产毛片一区二区| 久久综合中文字幕| 韩国女主播一区| 欧美sm极限捆绑bd| 久久电影国产免费久久电影| 欧美日韩高清在线播放| 婷婷综合另类小说色区| 欧美视频中文一区二区三区在线观看| 亚洲欧洲精品天堂一级| www.av精品| 中文字幕精品综合| 成人免费看黄yyy456| 中文一区一区三区高中清不卡| 国产精品一区久久久久| 久久久精品免费网站| 盗摄精品av一区二区三区| 国产精品麻豆视频| 成人sese在线| ...av二区三区久久精品| av欧美精品.com| 一区二区三区精品在线| 欧美日免费三级在线| 亚洲超碰精品一区二区| 日韩一区二区精品葵司在线| 美女一区二区久久| 久久网站最新地址| av在线不卡电影| 一区二区三区欧美激情| 正在播放一区二区| 国产一区二区三区在线观看精品 | 99久久久无码国产精品| 亚洲欧美区自拍先锋| 欧美午夜宅男影院| 久久91精品国产91久久小草| 精品国产乱码91久久久久久网站| 韩国女主播一区| 国产精品久久久一本精品| 欧美在线999| 久久激情五月激情| 中文无字幕一区二区三区 | 亚洲成人综合在线| 欧美一级视频精品观看| 国产精品综合一区二区| 日韩伦理免费电影| 日韩一区二区免费电影| 成人h动漫精品| 日韩精品欧美成人高清一区二区| 精品国产1区二区|