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

OSGMField.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 _OSGMFIELD_H_
00040 #define _OSGMFIELD_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include <OSGBase.h>
00046 #include <OSGBaseTypes.h>
00047 #include <OSGBaseFunctions.h>
00048 #include <OSGField.h>
00049 #include <OSGMFieldVector.h>
00050 #include <OSGStringConversionStateBase.h>
00051 
00052 #include <vector>
00053 #include <string>
00054 
00055 OSG_BEGIN_NAMESPACE
00056 
00057 #ifdef OSG_DOC_FILES_IN_MODULE
00058 
00062 #endif
00063 
00064 class BinaryDataHandler;
00065 
00071 template <class FieldTypeT, Int32 fieldNameSpace = 0>
00072 class MField : public Field
00073 {
00074     /*==========================  PUBLIC  =================================*/
00075 
00076   public:
00077 
00078     typedef          MFieldVector<FieldTypeT>           StorageType;
00079     typedef typename StorageType::Inherited             StorageTypeParent;
00080 
00081     typedef typename StorageType::iterator              iterator;
00082     typedef typename StorageType::const_iterator        const_iterator;
00083 
00084     typedef typename 
00085                     StorageType::reverse_iterator       reverse_iterator;
00086     typedef typename 
00087                     StorageType::const_reverse_iterator const_reverse_iterator;
00088 
00089 
00090     typedef typename StorageType::reference             reference;
00091     typedef typename StorageType::const_reference       const_reference;
00092     
00093 
00094     typedef typename osgIF<fieldNameSpace == 0,
00095                            FieldDataTraits <FieldTypeT>,
00096                            InvalidTrait                >::_IRet MF0Trait;
00097 
00098     typedef typename osgIF<fieldNameSpace == 1,
00099                            FieldDataTraits1<FieldTypeT>,
00100                            MF0Trait                    >::_IRet MF1Trait;
00101 
00102     typedef typename osgIF<fieldNameSpace == 2, 
00103                            FieldDataTraits2<FieldTypeT>, 
00104                            MF1Trait                    >::_IRet MFieldTraits;
00105 
00106     typedef          MField<FieldTypeT, fieldNameSpace>          Self;
00107 
00108     typedef          FieldTypeT                                  StoredType;
00109 
00110     typedef typename MFieldTraits::ArgumentType                  ArgumentType;
00111 
00112     /*---------------------------------------------------------------------*/
00116     static const FieldType &getClassType(void);
00117 
00119     /*---------------------------------------------------------------------*/
00123              MField(void);
00124              MField(const MField  &obj);
00125     explicit MField(const UInt32   size);
00126 
00128     /*---------------------------------------------------------------------*/
00132     virtual ~MField(void); 
00133 
00135     /*---------------------------------------------------------------------*/
00139 #ifndef OSG_DISABLE_DEPRECATED
00140           reference            getValue (const UInt32 index);
00141     const_reference            getValue (const UInt32 index) const;
00142 #endif
00143 
00144     virtual UInt32             getSize  (      void        ) const;
00145 
00146                   StorageType &getValues(      void            );
00147             const StorageType &getValues(      void            ) const;
00148  
00149     virtual const FieldType   &getType  (      void            ) const;
00150 
00151     virtual       bool         isEmpty  (      void            ) const;
00152 
00154     /*---------------------------------------------------------------------*/
00158             void setValues    (const StorageType       &value);
00159             void setValues    (const StorageTypeParent &value);
00160             void setValues    (const Self              &obj  );
00161 
00162     virtual void setAbstrValue(const Field             &obj  );
00163 
00164     
00165 #ifndef OSG_DISABLE_DEPRECATED
00166             void setValue     (      ArgumentType       value,
00167                                const UInt32             index);
00168 
00169             void addValue     (      ArgumentType       value);
00170 #endif
00171 
00173     /*---------------------------------------------------------------------*/
00177     iterator               begin    (void                              );
00178     iterator               end      (void                              );
00179 
00180     reverse_iterator       rbegin   (void                              );
00181     reverse_iterator       rend     (void                              );
00182 
00183     
00184     const_iterator         begin    (void                              ) const;
00185     const_iterator         end      (void                              ) const;
00186     
00187     const_reverse_iterator rbegin   (void                              ) const;
00188     const_reverse_iterator rend     (void                              ) const;
00189 
00190 
00191     reference              front    (void                              );
00192     const_reference        front    (void                              ) const;
00193     
00194     reference              back     (void                              );
00195     const_reference        back     (void                              ) const;
00196     
00197     void                   clear    (void                              );
00198     
00199     iterator               insert   (iterator     pos, 
00200                                      ArgumentType value                );
00201     iterator               erase    (iterator     pos                  );
00202     
00203     iterator               find     (ArgumentType value                );
00204     const_iterator         find     (ArgumentType value                ) const;
00205     
00206     void                   push_back(ArgumentType value                );
00207     
00208     void                   resize   (size_t       newsize, 
00209                                      FieldTypeT   t      = FieldTypeT());
00210     void                   reserve  (size_t       newsize              );
00211     
00212     UInt32                 size     (void                              ) const;
00213     UInt32                 capacity (void                              ) const;
00214     bool                   empty    (void                              ) const;
00215 
00217     /*---------------------------------------------------------------------*/
00221           reference operator [](UInt32 index);
00222     const_reference operator [](UInt32 index) const;
00223 
00225     /*---------------------------------------------------------------------*/
00229     void operator =(const MField &source);
00230 
00232     /*---------------------------------------------------------------------*/
00236     virtual void         pushValueByStr(const Char8              *str  );
00237     virtual std::string &getValueByStr (      std::string        &str  ) const;
00238     virtual std::string &getValueByStr (      std::string        &str,
00239                                        StringConversionStateBase &state) const;
00240     virtual std::string &getValueByStr (      std::string        &str,
00241                                               UInt32              index) const;
00242 
00244     /*---------------------------------------------------------------------*/
00248 #if !defined(OSG_FIXED_MFIELDSYNC)
00249     void syncWith       (Self      &source      );
00250 #else
00251     void syncWith       (      Self      &source, 
00252                          const SyncInfo  &sInfo );
00253 
00254 /*
00255                          BitVector  syncMode,
00256                          UInt32     uiSyncInfo,
00257                          UInt32     uiCopyOffset);
00258  */
00259 
00260     void beginEdit      (UInt32     uiAspect,
00261                          UInt32     uiCopyOffset);
00262 
00263     Self *resolveShare  (UInt32     uiAspect, 
00264                          UInt32     uiCopyOffset);
00265 
00266     void  terminateShare(UInt32     uiAspect, 
00267                          UInt32     uiCopyOffset);
00268 #endif
00269 
00271     /*---------------------------------------------------------------------*/
00275     UInt32 getBinSize (void                   ) const;
00276     
00277     void   copyToBin  (BinaryDataHandler &pMem) const;
00278     void   copyFromBin(BinaryDataHandler &pMem);
00279 
00281     /*---------------------------------------------------------------------*/
00285     virtual void dump (void) const;
00286 
00288     /*=========================  PROTECTED  ===============================*/
00289 
00290   protected:
00291 
00292     typedef Field Inherited;
00293 
00294     /*---------------------------------------------------------------------*/
00295     /*                             Member                                  */
00296 
00297     static const FieldType    _fieldType;
00298 
00299                  StorageType  _values;
00300 
00301                  UInt32       _uiSharedWith;
00302 
00303 
00304     static       Field       *create(void);
00305 
00306     /*==========================  PRIVATE  ================================*/
00307 
00308   private:
00309 
00310     friend class FieldContainer;
00311 };
00312 
00313 OSG_END_NAMESPACE
00314 
00315 #include <OSGMField.inl>
00316 
00317 #define OSGMFIELD_HEADER_CVSID "@(#)$Id: $"
00318 
00319 #endif /* _OSGMFIELD_H_ */
00320 

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