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

📄 ncbiobj.inl

📁 ncbi源码
💻 INL
字号:
/* * =========================================================================== * PRODUCTION $Log: ncbiobj.inl,v $ * PRODUCTION Revision 1000.0  2003/10/29 15:05:06  gouriano * PRODUCTION PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.10 * PRODUCTION * =========================================================================== */#if defined(CORELIB___NCBIOBJ__HPP)  &&  !defined(CORELIB___NCBIOBJ__INL)#define CORELIB___NCBIOBJ__INL/*  $Id: ncbiobj.inl,v 1000.0 2003/10/29 15:05:06 gouriano Exp $ * =========================================================================== * *                            PUBLIC DOMAIN NOTICE *               National Center for Biotechnology Information * *  This software/database is a "United States Government Work" under the *  terms of the United States Copyright Act.  It was written as part of *  the author's official duties as a United States Government employee and *  thus cannot be copyrighted.  This software/database is freely available *  to the public for use. The National Library of Medicine and the U.S. *  Government have not placed any restriction on its use or reproduction. * *  Although all reasonable efforts have been taken to ensure the accuracy *  and reliability of the software and data, the NLM and the U.S. *  Government do not and cannot warrant the performance or results that *  may be obtained by using this software or data. The NLM and the U.S. *  Government disclaim all warranties, express or implied, including *  warranties of performance, merchantability or fitness for any particular *  purpose. * *  Please cite the author in any work or product based on this material. * * =========================================================================== * * Author: Eugene Vasilchenko * * File Description: *   Standard CObject and CRef classes for reference counter based GC. *   Inline functions. * */inlinebool CObject::ObjectStateCanBeDeleted(TCount count){    return (count & eStateBitsInHeap) != 0;}inlinebool CObject::ObjectStateValid(TCount count){    return count >= TCount(eCounterValid);}inlinebool CObject::ObjectStateReferenced(TCount count){    return count >= TCount(eCounterValid + eCounterStep);}inlinebool CObject::ObjectStateDoubleReferenced(TCount count){    return count >= TCount(eCounterValid + eCounterStep * 2);}inlinebool CObject::ObjectStateReferencedOnlyOnce(TCount count){    return ObjectStateReferenced(count) &&        !ObjectStateDoubleReferenced(count);}inlinebool CObject::CanBeDeleted(void) const THROWS_NONE{    return ObjectStateCanBeDeleted(m_Counter.Get());}inlinebool CObject::Referenced(void) const THROWS_NONE{    return ObjectStateReferenced(m_Counter.Get());}inlinebool CObject::ReferencedOnlyOnce(void) const THROWS_NONE{    return ObjectStateReferencedOnlyOnce(m_Counter.Get());}inlineCObject& CObject::operator=(const CObject& ) THROWS_NONE{    return *this;}inlinevoid CObject::AddReference(void) const{    TCount newCount = m_Counter.Add(eCounterStep);    if ( !ObjectStateReferenced(newCount) ) {        m_Counter.Add(-eCounterStep); // undo        CheckReferenceOverflow(newCount - eCounterStep);    }}inlinevoid CObject::RemoveReference(void) const{    TCount newCount = m_Counter.Add(-eCounterStep);    if ( !ObjectStateReferenced(newCount) ) {        RemoveLastReference();    }}/* * =========================================================================== * $Log: ncbiobj.inl,v $ * Revision 1000.0  2003/10/29 15:05:06  gouriano * PRODUCTION: IMPORTED [ORIGINAL] Dev-tree R1.10 * * Revision 1.10  2003/10/20 20:35:31  ucko * Make include guards consistent with ncbiobj.hpp's again, so the build * doesn't totally break. * * Revision 1.9  2003/09/17 15:20:45  vasilche * Moved atomic counter swap functions to separate file. * Added CRef<>::AtomicResetFrom(), CRef<>::AtomicReleaseTo() methods. * * Revision 1.8  2003/08/12 12:04:49  siyan * Changed reference to AddReferenceOverflow() to its new name of * CheckReferenceOverflow(). * * Revision 1.7  2002/05/23 22:24:21  ucko * Use low-level atomic operations for reference counts * * Revision 1.6  2002/04/11 20:39:18  ivanov * CVS log moved to end of the file * * Revision 1.5  2001/03/26 21:22:51  vakatov * Minor cosmetics * * Revision 1.4  2001/03/13 22:43:49  vakatov * Made "CObject" MT-safe * + CObject::DoDeleteThisObject() * * Revision 1.3  2000/11/01 21:20:34  vasilche * Fixed missing new[] and delete[] on MSVC. * * Revision 1.2  2000/11/01 20:35:02  vasilche * Fixed detection of heap objects. * Removed ECanDelete enum and related constructors. * * Revision 1.1  2000/10/13 16:39:16  vasilche * Forgot to add file. * * =========================================================================== */#endif /* def CORELIB___NCBIOBJ__HPP  &&  ndef CORELIB___NCBIOBJ__INL */

⌨️ 快捷键说明

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