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

OSGGeoPropertyBase.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 
00038 #ifndef _OSGGEOPROPERTYBASE_H_
00039 #define _OSGGEOPROPERTYBASE_H_
00040 #ifdef __sgi
00041 #pragma once
00042 #endif
00043 
00044 #include <OSGGL.h>
00045 
00046 #include <OSGSystemDef.h>
00047 #include <OSGMFVecTypes.h>
00048 #include <OSGMFSysTypes.h>
00049 #include <OSGMFBaseTypes.h>
00050 #include <OSGAttachment.h>
00051 #include <OSGGeoPropertyInterface.h>
00052 
00053 OSG_BEGIN_NAMESPACE
00054 
00065 template <class GeoPropertyDesc>
00066 class AbstractGeoProperty :
00067     public GeoPropertyDesc::Inherited
00068 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE
00069     , public GeoPropertyDesc::Interface
00070 #endif
00071 {
00072     /*==========================  PUBLIC  =================================*/
00073   public:
00074 
00075     typedef AbstractGeoProperty<GeoPropertyDesc>          PropertyType;
00076 
00077     typedef FCPtr<typename GeoPropertyDesc::InheritedPtr,
00078                            PropertyType                 > PtrType;
00079 
00080     OSG_ABSTR_FIELD_CONTAINER_TMPL_DECL(PtrType)
00081 
00082     /*---------------------------------------------------------------------*/
00086     virtual PtrType clone(void) = 0;
00087 
00089 #ifdef OSG_SUPPORT_NO_GEO_INTERFACE
00090     /*---------------------------------------------------------------------*/
00094     typedef typename GeoPropertyDesc::GenericType          GenericType;
00095 
00096     virtual UInt32  getFormat    (void) const = 0;
00097     virtual UInt32  getFormatSize(void) const = 0;
00098     virtual UInt32  getStride    (void) const = 0;
00099     virtual UInt32  getDimension (void) const = 0;
00100     virtual UInt32  getSize      (void) const = 0;
00101     virtual UInt32  size         (void) const = 0;
00102     virtual UInt8  *getData      (void) const = 0;
00103 
00104     virtual GenericType getValue (const UInt32       index )       = 0;
00105 
00106     virtual GenericType getValue (const UInt32       index ) const = 0;
00107 
00108     virtual void        getValue (      GenericType &val,
00109                                   const UInt32       index )       = 0;
00110 
00111     virtual void        getValue (      GenericType &val,
00112                                   const UInt32       index ) const = 0;
00113 
00114 
00115     virtual void        setValue (const GenericType &val,
00116                                   const UInt32       index )       = 0;
00117 
00118     virtual void        addValue (const GenericType &val   )       = 0;
00119 
00120     virtual bool        insertValue(const GenericType &val,
00121                                     const UInt32 index)            = 0;
00122 
00123     virtual void        clear    (      void               )       = 0;
00124     virtual void        resize   (      size_t      newsize)       = 0;
00125     virtual void        push_back(const GenericType &val   )       = 0;
00126 
00128 #endif
00129     /*---------------------------------------------------------------------*/
00133     virtual void dump(      UInt32    uiIndent = 0,
00134                       const BitVector bvFlags  = 0) const;
00135 
00137     /*=========================  PROTECTED  ===============================*/
00138   protected:
00139 
00140     friend class OSG_SYSTEMLIB_DLLMAPPING FieldContainer;
00141 
00142     /*---------------------------------------------------------------------*/
00146     AbstractGeoProperty(void);
00147     AbstractGeoProperty(const AbstractGeoProperty &source);
00148 
00150     /*---------------------------------------------------------------------*/
00154     virtual ~AbstractGeoProperty(void);
00155 
00157     /*==========================  PRIVATE  ================================*/
00158   private:       
00159 
00160     // Cannot name type Inherited because of MS compiler probs
00161 
00162     typedef typename GeoPropertyDesc::Inherited            LocalInherited;
00163     typedef typename GeoPropertyDesc::InheritedDesc        LocalInheritedDesc;
00164 
00165 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE
00166     typedef          GeoPropertyInterface<GeoPropertyDesc> LocalInterface;
00167 #endif
00168 
00169     static FieldContainerType _type;
00170 };
00171 
00172 
00179 template <class GeoPropertyDesc>
00180 class GeoProperty :
00181     public GeoPropertyDesc::Inherited
00182 {
00183     /*==========================  PRIVATE  ================================*/
00184   private:
00185 
00186     // Cannot name type Inherited because of MS compiler probs
00187 
00188     typedef typename GeoPropertyDesc::Inherited     LocalInherited;
00189     typedef typename GeoPropertyDesc::InheritedDesc LocalInheritedDesc;
00190     typedef typename GeoPropertyDesc::InheritedPtr  LocalInheritedPtr;
00191 
00192     /*==========================  PUBLIC  =================================*/
00193   public:
00194 
00195     enum
00196     {
00197         GeoPropDataFieldId = LocalInherited::NextFieldId,
00198 
00199         NextFieldId        = GeoPropDataFieldId + 1
00200     };
00201 
00202     static const BitVector GeoPropDataFieldMask = 
00203                                    1 << static_cast<Int32>(GeoPropDataFieldId);
00204 
00205     typedef GeoProperty<GeoPropertyDesc>         PropertyType;
00206     typedef GeoProperty<GeoPropertyDesc>         Self;
00207 
00208     typedef FCPtr<LocalInheritedPtr,
00209                   PropertyType                 > PtrType;
00210 
00211 
00212     typedef typename GeoPropertyDesc::StoredFieldType     StoredFieldType;
00213     typedef typename GeoPropertyDesc::GenericType         StoredGenericType;
00214     typedef typename StoredFieldType::StoredType          StoredType;
00215 
00216     OSG_FIELD_CONTAINER_TMPL_DECL(PtrType)
00217 
00218 #ifdef OSG_MICROSOFT_COMPILER_HACKS
00219     static FieldAccessMethod getFPtrAccessMethod(void);
00220 #endif
00221 
00222     /*---------------------------------------------------------------------*/
00226           StoredFieldType *getFieldPtr(void);
00227 
00228           StoredFieldType &getField(void);
00229     const StoredFieldType &getField(void) const;
00230 
00231     virtual LocalInheritedPtr clone(void);
00232 
00233     virtual UInt32  getFormat    (void) const;
00234     virtual UInt32  getFormatSize(void) const;
00235     virtual UInt32  getStride    (void) const;
00236     virtual UInt32  getDimension (void) const;
00237     virtual UInt32  getSize      (void) const;
00238     virtual UInt32  size         (void) const;
00239     virtual UInt8  *getData      (void) const;
00240 
00241             StoredFieldType &operator->() { return _field; }
00242 
00243     virtual StoredGenericType getValue(const UInt32 index);
00244 
00245     virtual StoredGenericType getValue(const UInt32 index) const;
00246 
00247     virtual void              getValue(      StoredGenericType &val,
00248                                        const UInt32             index);
00249 
00250     virtual void              getValue(      StoredGenericType &val,
00251                                        const UInt32             index) const;
00252 
00253     virtual void              setValue(const StoredGenericType &val,
00254                                        const UInt32             index);
00255 
00256     virtual void              addValue(const StoredGenericType &val);
00257 
00258     virtual bool              insertValue(const StoredGenericType &val,
00259                                           const UInt32 index);
00260     virtual void    clear();
00261 
00262     virtual void    resize(size_t newsize);
00263 
00264     virtual void    push_back(const StoredGenericType &val);
00265     
00267     /*---------------------------------------------------------------------*/
00271     GeoProperty &operator =(const GeoProperty &source);
00272 
00274     /*---------------------------------------------------------------------*/
00278     virtual void dump(      UInt32    uiIndent = 0,
00279                       const BitVector bvFlags  = 0) const;
00280 
00282     /*=========================  PROTECTED  ===============================*/    
00283   protected:
00284 
00285     friend class OSG_SYSTEMLIB_DLLMAPPING FieldContainer;
00286 
00287     StoredFieldType _field;
00288 
00289     /*---------------------------------------------------------------------*/
00293     GeoProperty(void);
00294     GeoProperty(const GeoProperty &source);
00295     
00297     /*---------------------------------------------------------------------*/
00301     virtual ~GeoProperty(void);
00302 
00304     /*---------------------------------------------------------------------*/
00308 #if !defined(OSG_FIXED_MFIELDSYNC)
00309     virtual void executeSync    (      FieldContainer &other,
00310                                  const BitVector      &whichField);
00311 
00312             void executeSyncImpl(      GeoProperty *pOther,
00313                                  const BitVector   &whichField);
00314 #else
00315     virtual void executeSync       (      FieldContainer &other,
00316                                     const BitVector      &whichField,
00317                                     const SyncInfo       &sInfo     );
00318 
00319             void executeSyncImpl   (      GeoProperty *pOther,
00320                                     const BitVector   &whichField,
00321                                     const SyncInfo    &sInfo     );
00322 
00323     virtual void execBeginEdit     (const BitVector &whichField, 
00324                                           UInt32     uiAspect,
00325                                           UInt32     uiContainerSize);
00326 
00327             void execBeginEditImpl (const BitVector &whichField, 
00328                                           UInt32     uiAspect,
00329                                           UInt32     uiContainerSize);
00330 
00331     virtual void onDestroyAspect(UInt32 uiId, UInt32 uiAspect);
00332 #endif
00333 
00335     /*---------------------------------------------------------------------*/
00339     virtual void changed        (BitVector whichField, 
00340                                  UInt32    origin    );
00341             
00343     /*---------------------------------------------------------------------*/
00347     virtual UInt32       getBinSize (const BitVector    &whichField);
00348     virtual void copyToBin  (      BinaryDataHandler &pMem,
00349                              const BitVector         &whichField);
00350     virtual void copyFromBin(      BinaryDataHandler &pMem,
00351                              const BitVector         &whichField);
00352 
00354     /*==========================  PRIVATE  ================================*/
00355   private:
00356 
00357     static const PtrType NullPtr;
00358 
00359 #if defined(OSG_MICROSOFT_COMPILER_ALERT)
00360     static FieldDescription   *_desc[];
00361 #endif
00362     static FieldContainerType  _type;
00363 };
00364 
00365 #if !defined(OSG_DO_DOC)   // created as a dummy class, remove to prevent doubles
00366 typedef AbstractGeoProperty<GeoPositionsPropertyDesc> GeoPositions;
00367 #endif
00368 
00369 #ifndef OSG_COMPILEGEOPROPINST
00370 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00371                             GeoPositionsPropertyDesc,
00372                             OSG_SYSTEMLIB_DLLTMPLMAPPING)
00373 #endif
00374 
00375 #if !defined(OSG_DO_DOC)   // created as a dummy class, remove to prevent doubles
00376 typedef AbstractGeoProperty<GeoNormalsPropertyDesc> GeoNormals;
00377 #endif
00378 
00379 #ifndef OSG_COMPILEGEOPROPINST
00380 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00381                             GeoNormalsPropertyDesc,
00382                             OSG_SYSTEMLIB_DLLTMPLMAPPING)
00383 #endif
00384 
00385 #if !defined(OSG_DO_DOC)   // created as a dummy class, remove to prevent doubles
00386 typedef AbstractGeoProperty<GeoColorsPropertyDesc> GeoColors;
00387 #endif
00388 
00389 #ifndef OSG_COMPILEGEOPROPINST
00390 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00391                             GeoColorsPropertyDesc,
00392                             OSG_SYSTEMLIB_DLLTMPLMAPPING)
00393 #endif
00394 
00395 #if !defined(OSG_DO_DOC)   // created as a dummy class, remove to prevent doubles
00396 typedef AbstractGeoProperty<GeoTexCoordsPropertyDesc> GeoTexCoords;
00397 #endif
00398 
00399 #ifndef OSG_COMPILEGEOPROPINST
00400 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00401                             GeoTexCoordsPropertyDesc,
00402                             OSG_SYSTEMLIB_DLLTMPLMAPPING)
00403 #endif
00404 
00405 #if !defined(OSG_DO_DOC)   // created as a dummy class, remove to prevent doubles
00406 typedef AbstractGeoProperty<GeoIndicesPropertyDesc> GeoIndices;
00407 #endif
00408 
00409 #ifndef OSG_COMPILEGEOPROPINST
00410 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00411                             GeoIndicesPropertyDesc,
00412                             OSG_SYSTEMLIB_DLLTMPLMAPPING)
00413 #endif
00414 
00415 #if !defined(OSG_DO_DOC)   // created as a dummy class, remove to prevent doubles
00416 typedef AbstractGeoProperty<GeoPTypesPropertyDesc> GeoPTypes;
00417 #endif
00418 
00419 #ifndef OSG_COMPILEGEOPROPINST
00420 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00421                             GeoPTypesPropertyDesc,
00422                             OSG_SYSTEMLIB_DLLTMPLMAPPING)
00423 #endif
00424 
00425 #if !defined(OSG_DO_DOC)   // created as a dummy class, remove to prevent doubles
00426 typedef AbstractGeoProperty<GeoPLengthsPropertyDesc> GeoPLengths;
00427 #endif
00428 
00429 #ifndef OSG_COMPILEGEOPROPINST
00430 OSG_ABSTR_FC_DLLEXPORT_DECL(AbstractGeoProperty,
00431                             GeoPLengthsPropertyDesc,
00432                             OSG_SYSTEMLIB_DLLTMPLMAPPING)
00433 #endif
00434 
00435 OSG_END_NAMESPACE
00436 
00437 #include <OSGGeoPropertyBase.inl>
00438 
00439 
00440 #endif /* _OSGGEOPROPERTYBASE_H_ */
00441 

Generated on Thu Aug 25 04:05:23 2005 for OpenSG by  doxygen 1.4.3