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

OSGSField.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 _OSGSFIELD_H_
00040 #define _OSGSFIELD_H_
00041 #ifdef __sgi
00042 #pragma once
00043 #endif
00044 
00045 #include <OSGBase.h>
00046 #include <OSGBaseTypes.h>
00047 #include <OSGBaseFunctions.h>
00048 #include <OSGStringConversionStateBase.h>
00049 
00050 #include <vector>
00051 #include <string>
00052 
00053 #include <OSGField.h>
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 SField : public Field 
00073 {
00074     /*==========================  PUBLIC  =================================*/
00075 
00076   public:
00077 
00078     typedef typename osgIF<fieldNameSpace == 0,
00079                            FieldDataTraits <FieldTypeT>,
00080                            InvalidTrait                >::_IRet SF0Trait;
00081 
00082     typedef typename osgIF<fieldNameSpace == 1,
00083                            FieldDataTraits1<FieldTypeT>,
00084                            SF0Trait                    >::_IRet SF1Trait;
00085 
00086     typedef typename osgIF<fieldNameSpace == 2, 
00087                            FieldDataTraits2<FieldTypeT>, 
00088                            SF1Trait                     >::_IRet SFieldTraits;
00089 
00090     typedef          SField<FieldTypeT, fieldNameSpace>          Self;
00091 
00092 
00093 
00094     typedef          FieldTypeT                  StoredType;
00095     typedef          FieldTypeT                 &reference;
00096     typedef const    FieldTypeT                 &const_reference;
00097     typedef typename SFieldTraits::ArgumentType  ArgumentType;
00098 
00099     /*---------------------------------------------------------------------*/
00103     static const FieldType &getClassType(void);
00104 
00106     /*---------------------------------------------------------------------*/
00110              SField(void                     );
00111              SField(const SField       &obj  );
00112     explicit SField(      ArgumentType  value);
00113 
00115     /*---------------------------------------------------------------------*/
00119     virtual ~SField(void); 
00120 
00122     /*---------------------------------------------------------------------*/
00126     virtual       UInt32      getSize (void) const;
00127 
00128                   reference   getValue(void);
00129             const_reference   getValue(void) const;
00130 
00131     virtual const FieldType  &getType (void) const;
00132 
00133     virtual       bool        isEmpty (void) const;
00134 
00136     /*---------------------------------------------------------------------*/
00140             void setValue     (      ArgumentType  value);
00141             void setValue     (const Self         &obj  );
00142 
00143     virtual void setAbstrValue(const Field        &obj  );
00144 
00146     /*---------------------------------------------------------------------*/
00150     virtual void         pushValueByStr(const Char8             *str  );
00151     virtual std::string &getValueByStr (      std::string       &str  ) const;
00152     virtual std::string &getValueByStr (      std::string       &str,
00153                                       StringConversionStateBase &state) const;
00154     virtual std::string &getValueByStr (      std::string       &str,
00155                                               UInt32             index) const;
00156 
00158     /*---------------------------------------------------------------------*/
00162     void syncWith(Self &source);
00163 
00165     /*---------------------------------------------------------------------*/
00169     UInt32 getBinSize (void                   );
00170     
00171     void   copyToBin  (BinaryDataHandler &pMem);
00172     void   copyFromBin(BinaryDataHandler &pMem);
00173 
00175     /*---------------------------------------------------------------------*/
00179     void operator =(const SField &source);
00180 
00182     /*---------------------------------------------------------------------*/
00186     virtual void dump(void) const;
00187 
00189     /*=========================  PROTECTED  ===============================*/
00190 
00191   protected:
00192 
00193     typedef Field Inherited;
00194 
00195     /*---------------------------------------------------------------------*/
00196     /*                             Member                                  */
00197 
00198     static const FieldType   _fieldType;
00199 
00200                  FieldTypeT  _value;
00201 
00202     static       Field      *create(void);
00203 
00204     /*---------------------------------------------------------------------*/
00205 
00206     /*==========================  PRIVATE  ================================*/
00207 
00208   private:
00209 };
00210 
00211 OSG_END_NAMESPACE
00212 
00213 #include <OSGSField.inl>
00214 
00215 #define OSGSFIELD_HEADER_CVSID "@(#)$Id: $"
00216 
00217 #endif /* _OSGSFIELD_H_ */
00218 

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