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

OSGMFieldVector.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-2002 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
00031  *                                                                           *
00032  *                                                                           *
00033  *                                                                           *
00034  *                                                                           *
00035  *                                                                           *
00036  *                                                                           *
00037 \*---------------------------------------------------------------------------*/
00038 
00039 #ifndef _OSGMFIELDVECTOR_H_
00040 #define _OSGMFIELDVECTOR_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include <OSGBaseTypes.h>
00046 
00047 #include <vector>
00048 
00049 OSG_BEGIN_NAMESPACE
00050 
00051 #ifdef OSG_DOC_FILES_IN_MODULE
00052 
00056 #endif
00057 
00058 #if defined(__sgi) || defined(__linux) || defined(darwin) || \
00059     defined(__sun) || defined(__hpux)
00060 
00061 #if defined(__sgi)
00062 #pragma set woff 1375
00063 #endif
00064 
00065 #if defined(__linux) || defined(__hpux) || defined(darwin) || defined(__sun)
00066 #    if __GNUC__ >= 3
00067 #        define OSG_STL_DEFAULT_ALLOCATOR(TP) = std::allocator<TP>
00068 #    elif defined (__ICL)
00069 #        define OSG_STL_DEFAULT_ALLOCATOR(TP) = std::allocator<TP>
00070 #    elif defined (OSG_HPUX_ACC)
00071 #        define OSG_STL_DEFAULT_ALLOCATOR(TP) _RWSTD_COMPLEX_DEFAULT(std::allocator<TP>)
00072 #    elif defined(OSG_SUN_CC)
00073 #        define OSG_STL_DEFAULT_ALLOCATOR(TP) _RWSTD_COMPLEX_DEFAULT(std::allocator<TP>)
00074 #    else
00075 #        define OSG_STL_DEFAULT_ALLOCATOR(TP) = std::__STL_DEFAULT_ALLOCATOR(TP)
00076 #    endif
00077 #else
00078 #    define OSG_STL_DEFAULT_ALLOCATOR(TP) = std::__STL_DEFAULT_ALLOCATOR(TP)
00079 #endif
00080 
00081 template <class FieldTypeT, Int32 fieldNameSpace>
00082 class MField;
00083 
00089 template <class Tp, class Alloc OSG_STL_DEFAULT_ALLOCATOR(Tp) >
00090 class MFieldVector : public std::vector<Tp, Alloc> 
00091 {
00092   public:
00093 
00094     typedef std::vector<Tp, Alloc> Inherited;
00095 
00096   private:
00097 
00098     typedef MFieldVector<Tp, Alloc> Self;
00099     
00100   public:
00101 
00102     typedef typename Inherited::allocator_type allocator_type;
00103     typedef typename Inherited::size_type      size_type;
00104 
00105     explicit MFieldVector(const allocator_type& __a = allocator_type());
00106 
00107              MFieldVector(      size_type       __n, 
00108                           const Tp             &__value,
00109                           const allocator_type &__a    = allocator_type());
00110 
00111     explicit MFieldVector(size_type __n);
00112     
00113              MFieldVector(const std::vector <Tp, Alloc>& __x);
00114              MFieldVector(const MFieldVector<Tp, Alloc>& __x);
00115 
00116 #ifdef __STL_MEMBER_TEMPLATES
00117   // Check whether it's an integral type.  If so, it's not an iterator.
00118              template <class InputIterator>
00119              MFieldVector(      InputIterator   __first, 
00120                                 InputIterator   __last,
00121                           const allocator_type &__a = allocator_type());
00122 #else
00123              MFieldVector(const Tp             *__first, 
00124                           const Tp             *__last,
00125                           const allocator_type &__a = allocator_type());
00126 #endif /* __STL_MEMBER_TEMPLATES */
00127 
00128     ~MFieldVector();
00129 
00130     void shareValues (Self &other, bool bDeleteOld);
00131     void resolveShare(void                        );
00132 };
00133 
00134 #if defined(__sgi)
00135 #pragma reset woff 1375
00136 #endif
00137 
00138 #elif defined(WIN32)
00139 
00145 template<class Ty, class A = std::allocator<Ty> >
00146 class MFieldVector : public std::vector<Ty, A>
00147 {
00148   public:
00149 
00150     typedef          std::vector<Ty, A>        Inherited;
00151 
00152   private :
00153 
00154     typedef typename Inherited::const_iterator It;
00155 
00156     typedef           MFieldVector<Ty, A>      Self;
00157 
00158   public :  
00159 
00160     explicit MFieldVector(const A& _Al = A());
00161 
00162     explicit MFieldVector(      size_type  _N, 
00163                           const Ty        &_V  = Ty(),
00164                           const A         &_Al = A ());
00165 
00166     MFieldVector(const MFieldVector<Ty, A> &_X);
00167 
00168 
00169     MFieldVector(      It  _F, 
00170                        It  _L, 
00171                  const A  &_Al = A());
00172 
00173     ~MFieldVector(void);
00174 
00175     void shareValues (Self &other, bool bDeleteOld);
00176     void resolveShare(void                        );
00177 };
00178 
00179 #endif
00180 
00181 OSG_END_NAMESPACE
00182 
00183 #define OSGMFIELDVECTOR_HEADER_CVSID "@(#)$Id: $"
00184 
00185 #include "OSGMFieldVector.inl"
00186 
00187 #endif /* _OSGMFIELDVECTOR_H_ */

Generated on Thu Aug 25 04:07:47 2005 for OpenSG by  doxygen 1.4.3