Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

OSGRefPtr.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *                     Copyright 2000-2002 by OpenSG Forum                   *
00006  *                                                                           *
00007  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00008  *                                                                           *
00009 \*---------------------------------------------------------------------------*/
00010 /*---------------------------------------------------------------------------*\
00011  *                                License                                    *
00012  *                                                                           *
00013  * This library is free software; you can redistribute it and/or modify it   *
00014  * under the terms of the GNU Library General Public License as published    *
00015  * by the Free Software Foundation, version 2.                               *
00016  *                                                                           *
00017  * This library is distributed in the hope that it will be useful, but       *
00018  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00020  * Library General Public License for more details.                          *
00021  *                                                                           *
00022  * You should have received a copy of the GNU Library General Public         *
00023  * License along with this library; if not, write to the Free Software       *
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00025  *                                                                           *
00026 \*---------------------------------------------------------------------------*/
00027 /*---------------------------------------------------------------------------*\
00028  *                                Changes                                    *
00029  *                                                                           *
00030  *                                                                           *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef _OSGREFPTR_H_
00038 #define _OSGREFPTR_H_
00039 #ifdef __sgi
00040 #pragma once
00041 #endif
00042 
00043 #ifdef OSG_DOC_FILES_IN_MODULE
00044 
00047 #endif
00048 
00049 #include <OSGSystemDef.h>
00050 #include <OSGBaseTypes.h>
00051 #include <OSGFieldContainerPtr.h>
00052 
00053 OSG_BEGIN_NAMESPACE
00054 
00058 template< class Ref >
00059 class RefPtr
00060 {
00061     /*==========================  PUBLIC  =================================*/
00062   public:
00063  
00064     /*---------------------------------------------------------------------*/
00068     RefPtr(void);
00069     
00070     // make it explicit to prevent unexpected construction/cast paths
00071     
00072     explicit RefPtr(const Ref& fcp);
00073      
00074     RefPtr(const RefPtr<Ref>& ptr);
00075      
00077     /*---------------------------------------------------------------------*/
00081     virtual ~RefPtr();
00082     
00084     /*---------------------------------------------------------------------*/
00088     operator Ref(void) const;
00089     
00090     typename Ref::StoredObjectType* operator->(void) const;
00091     
00092     Ref get(void) const;
00093     
00094     RefPtr<Ref>& operator =(const Ref &fcp);    
00095     RefPtr<Ref>& operator =(const RefPtr<Ref> &rcp);
00096     RefPtr<Ref>& operator =(const NullFieldContainerPtr& );    
00097    
00099     /*---------------------------------------------------------------------*/
00103     bool operator <  (const NullFieldContainerPtr &     ) const;   
00104     bool operator == (const NullFieldContainerPtr &other) const;
00105     bool operator != (const NullFieldContainerPtr &other) const;
00106 
00107     bool operator <  (const FieldContainerPtr     &other) const;
00108     bool operator == (const FieldContainerPtr     &other) const;
00109     bool operator != (const FieldContainerPtr     &other) const;
00110 
00111     bool operator <  (const RefPtr<Ref>           &other) const;
00112     bool operator == (const RefPtr<Ref>           &other) const;
00113     bool operator != (const RefPtr<Ref>           &other) const;
00114 
00115     bool operator !  (void                              ) const;
00116    
00118     /*---------------------------------------------------------------------*/
00119 
00120     /*=========================  PROTECTED  ===============================*/    
00121   protected:
00122 
00123     /*==========================  PRIVATE  ================================*/
00124   private:
00125   
00126     void setRef(const Ref& ref);
00127     
00128     Ref _ref;
00129 };
00130 
00131 // Some base types
00132 
00133 typedef RefPtr<FieldContainerPtr> FieldContainerRefPtr;
00134 
00135 OSG_END_NAMESPACE
00136 
00137 #include "OSGRefPtr.inl"
00138 
00139 #define OSGREFPTR_HEADER_CVSID "@(#)$Id: OSGRefPtr.h,v 1.4 2005/08/16 16:17:40 dirk Exp $"
00140 
00141 #endif /* _OSGCOREDNODEPTR_H_ */

Generated on Thu Aug 25 04:09:03 2005 for OpenSG by  doxygen 1.4.3