pointer.hh
Go to the documentation of this file.
00001 /* -*- C++ -*-
00002  * $Id: pointer.hh 1004 2005-10-10 12:55:33Z sjoyeux $
00003  */
00004 #ifndef UTILMM_SMART_POINTER_HEADER
00005 # define UTILMM_SMART_POINTER_HEADER
00006 #include "utilmm/config/config.h"
00007 
00008 # include <stdexcept>
00009 
00010 #include "utilmm/singleton/use.hh"
00011 
00012 namespace utilmm {
00019   namespace smart {
00020 
00029     class null_access :public std::runtime_error {
00030     public:
00035       null_access(std::string const &message)
00036         : std::runtime_error(message) {}
00037     }; // class utilmm::smart::null_access
00038     
00051     template<class Manager>
00052     class pointer {
00053     private:
00054       singleton::use<Manager> manager;
00055       
00056     public:
00061       typedef typename Manager::base_type base_type;
00067       typedef base_type *pointer_type;
00073       typedef base_type &reference_type;
00074 
00086       explicit pointer(pointer_type ptr=0);
00095       pointer(pointer const &other);
00096 
00103       ~pointer();
00104 
00123       void reset(pointer_type ptr=0);
00124 
00131       void swap(pointer &other);
00132       
00142       pointer &operator= (pointer const &other);
00143 
00151       bool null() const;
00159       bool operator! () const;
00160 
00170       bool operator==(pointer const &other) const; 
00179       bool operator!=(pointer const &other) const;
00180 
00190       pointer_type operator->() const;
00198       reference_type operator* () const;
00199 
00200     private:
00201       typename Manager::mem_cell pointee;
00202     }; // class utilmm::smart::pointer<>
00203 
00204   } // namespace utilmm::smart
00205 } // namespace utilmm
00206 
00207 # define IN_UTILMM_SMART_POINTER_HEADER
00208 #include "utilmm/smart/bits/pointer.tcc"
00209 # undef IN_UTILMM_SMART_POINTER_HEADER
00210 #endif // UTILMM_SMART_POINTER_HEADER
00211 


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Wed Sep 16 2015 07:05:43