(file) Return to Sharable.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/Sharable.h between version 1.11 and 1.17

version 1.11, 2002/11/06 18:50:17 version 1.17, 2005/10/24 19:35:25
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2005////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // The Open Group, Tivoli Systems  // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 24 
Line 30 
 // Author: Mike Brasher (mbrasher@bmc.com) // Author: Mike Brasher (mbrasher@bmc.com)
 // //
 // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) // Modified By: Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
   //              David Eger (dteger@us.ibm.com)
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 53 
Line 60 
     Sharable() : _ref(1) { }     Sharable() : _ref(1) { }
  
     virtual ~Sharable();     virtual ~Sharable();
     Uint32 getRef() const { return _ref.value(); }      Uint32 getRef() const { return _ref.get(); }
  
     friend void Inc(const Sharable* sharable);      friend void Inc(Sharable* sharable);
  
     friend void Dec(const Sharable* sharable);      friend void Dec(Sharable* sharable);
  
 private: private:
       Sharable(const Sharable &s) : _ref(1) {assert(0);}
       // we should never copy a counter, so we make this private - dte
         AtomicInt _ref;         AtomicInt _ref;
 }; };
  
 inline void Inc(const Sharable* x)  inline void Inc(Sharable* x)
   
 { {
   if (x)   if (x)
     {     {
Line 72 
Line 80 
       // If so, there is a double delete being cause by impropoer use       // If so, there is a double delete being cause by impropoer use
       // of sharable assignment or copy constructors somewhere       // of sharable assignment or copy constructors somewhere
       // << Wed Nov  6 12:46:52 2002 mdd >>       // << Wed Nov  6 12:46:52 2002 mdd >>
       assert(((Sharable*)x)->_ref.value());        assert(((Sharable*)x)->_ref.get());
       ((Sharable*)x)->_ref++;        x->_ref++;
     }     }
  
 } }
  
  
 inline void Dec(const Sharable* x)  inline void Dec(Sharable* x)
 { {
   if (x && ((Sharable*)x)->_ref.DecAndTestIfZero())    if (x && x->_ref.decAndTestIfZero())
     delete (Sharable*)x;      delete x;
 } }
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.11  
changed lines
  Added in v.1.17

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2