diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2014-07-23 15:25:44 +0200 |
commit | 8286ac511144e4f17d34eac9affb97e50646344a (patch) | |
tree | f1af7320d7b6be6be059216d0ad08ac7b4f73fd0 /libcult/cult/mm/bits/shptr.hxx | |
parent | a15cf65c44d5c224169c32ef5495b68c758134b7 (diff) |
Imported Upstream version 4.0.0upstream/4.0.0
Diffstat (limited to 'libcult/cult/mm/bits/shptr.hxx')
-rw-r--r-- | libcult/cult/mm/bits/shptr.hxx | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/libcult/cult/mm/bits/shptr.hxx b/libcult/cult/mm/bits/shptr.hxx deleted file mode 100644 index 7089c53..0000000 --- a/libcult/cult/mm/bits/shptr.hxx +++ /dev/null @@ -1,85 +0,0 @@ -// file : cult/mm/bits/shptr.hxx -// author : Boris Kolpackov <boris@kolpackov.net> -// copyright : Copyright (c) 2005-2010 Boris Kolpackov -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#ifndef CULT_MM_BITS_SHPTR_HXX -#define CULT_MM_BITS_SHPTR_HXX - -#include <cult/types/fundamental.hxx> - -#include <cult/mm/counter.hxx> -#include <cult/mm/exception.hxx> - -namespace Cult -{ - namespace MM - { - namespace Bits - { - template <typename X> - class Shptr - { - protected: - ~Shptr () - { - if (c_ && c_->dec_ref ()) delete p_; - } - - Shptr (X* p, Counter* c, Boolean inc = true) - : p_ (p), c_ (c) - { - if (c_ && inc) c_->inc_ref (); - } - - protected: - X* - release_ () throw () - { - X* tmp (p_); - - c_ = 0; - p_ = 0; - - return tmp; - } - - protected: - template<typename y> - Void - assign (Shptr<y> const& bp, Boolean inc = true) - { - assign (bp.p_, bp.c_, inc); - } - - Void - assign (X* p, Counter* c, Boolean inc) - { - if (c_ && c_ == c) throw SelfAssignment (); - - if (c_) - { - Counter* t (c_); - c_ = 0; - p_ = 0; - t->dec_ref (); - } - - if (c && inc) c->inc_ref (); - - p_ = p; - c_ = c; - } - - protected: - template <typename> - friend class Shptr; - - X* p_; - Counter* c_; - }; - } - } -} - -#endif // CULT_MM_BITS_SHPTR_HXX |