Ignore:
Timestamp:
Jan 3, 2010, 7:13:32 PM (11 years ago)
Author:
rbri
Message:

DJVU plugin: djvulibre updated to version 3.5.22

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libdjvu/GSmartPointer.h

    r206 r280  
    5454//C- +------------------------------------------------------------------
    5555//
    56 // $Id: GSmartPointer.h,v 1.13 2007/03/25 20:48:32 leonb Exp $
    57 // $Name: release_3_5_19 $
     56// $Id: GSmartPointer.h,v 1.16 2008/03/05 01:44:20 leonb Exp $
     57// $Name: release_3_5_22 $
    5858
    5959#ifndef _GSMARTPOINTER_H_
     
    8989
    9090    @version
    91     #$Id: GSmartPointer.h,v 1.13 2007/03/25 20:48:32 leonb Exp $#
     91    #$Id: GSmartPointer.h,v 1.16 2008/03/05 01:44:20 leonb Exp $#
    9292    @args
    9393*/
     
    101101
    102102#include "DjVuGlobal.h"
     103#include "atomic.h"
    103104
    104105#ifdef HAVE_NAMESPACES
     
    116117    smart-pointers (see \Ref{GP}). 
    117118 */
    118 class GPEnabled
    119 {
     119class DJVUAPI GPEnabled
     120{
     121  friend class GPBase;
     122  void destroy();
     123  void unref();
     124  void ref();
    120125public:
    121126  /// Null constructor.
     
    133138  /// The reference counter
    134139  volatile int count;
    135 private:
    136   friend class GPBase;
    137   void unref();
    138   void ref();
    139   void destroy();
    140140};
    141141
     
    149149*/
    150150
    151 class GPBase
     151class DJVUAPI GPBase
    152152{
    153153public:
     
    206206    reference counter is incremented to one. Object destruction will then
    207207    happen automatically when the reference counter is decremented back to
    208     zero (i.e. when the last smart-pointer referencing this object stops doing so).
    209     This will happen regardless of how many regular pointers reference this object.
     208    zero (i.e. when the last smart-pointer referencing
     209    this object stops doing so).
     210    This will happen regardless of how many regular pointers
     211    reference this object.
    210212    In other words, if you start using smart-pointers with a #GPEnabled#
    211213    object, you engage automatic mode for this object.  You should only do
     
    333335}
    334336
     337inline void
     338GPEnabled::ref()
     339{
     340#if PARANOID_DEBUG
     341  assert (count >= 0);
     342#endif
     343  atomicIncrement(&count);
     344}
     345
     346inline void
     347GPEnabled::unref()
     348{
     349#if PARANOID_DEBUG
     350  assert (count > 0);
     351#endif
     352  if (! atomicDecrement(&count))
     353    destroy();
     354}
     355
    335356// INLINE FOR GPBASE
    336357
     
    368389GPBase::get() const
    369390{
     391#if PARANOID_DEBUG
     392  if (ptr && ptr->get_count() <= 0)
     393    *(int*)0=0;
     394#endif
    370395  return ptr;
    371396}
     
    414439GP<TYPE>::operator->() const
    415440{
     441#if PARANOID_DEBUG
     442  if (ptr && ptr->get_count() <= 0)
     443    *(int*)0=0;
     444#endif
    416445  return (TYPE*) ptr;
    417446}
     
    420449GP<TYPE>::operator*() const
    421450{
     451#if PARANOID_DEBUG
     452  if (ptr && ptr->get_count() <= 0)
     453    *(int*)0=0;
     454#endif
    422455  return *(TYPE*) ptr;
    423456}
     
    459492   What about the objects construction and destruction ? */
    460493
    461 class GPBufferBase
     494class DJVUAPI GPBufferBase
    462495{
    463496public:
Note: See TracChangeset for help on using the changeset viewer.