00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <stdlib.h>
00038 #include <stdio.h>
00039
00040 #include "OSGConfig.h"
00041
00042 OSG_BEGIN_NAMESPACE
00043
00044 #ifndef WIN32
00045 OSG_ABSTR_FIELD_CONTAINER_INL_TMPL_DEF(AbstractGeoProperty,
00046 GeoPropertyDesc,
00047 PtrType)
00048 #else
00049 OSG_ABSTR_GEO_PROP_INL_TMPL_DEF(AbstractGeoProperty,
00050 GeoPropertyDesc,
00051 PtrType)
00052 #endif
00053
00054 template <class GeoPropertyDesc> inline
00055 AbstractGeoProperty<GeoPropertyDesc>::AbstractGeoProperty(void) :
00056 LocalInherited()
00057 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE
00058 , LocalInterface()
00059 #endif
00060 {
00061 }
00062
00063
00064 template <class GeoPropertyDesc> inline
00065 AbstractGeoProperty<GeoPropertyDesc>::AbstractGeoProperty(
00066 const AbstractGeoProperty &source) :
00067
00068 LocalInherited(source)
00069 #ifndef OSG_SUPPORT_NO_GEO_INTERFACE
00070 , LocalInterface(source)
00071 #endif
00072 {
00073 }
00074
00075
00076 template <class GeoPropertyDesc> inline
00077 AbstractGeoProperty<GeoPropertyDesc>::~AbstractGeoProperty(void)
00078 {
00079 }
00080
00081 template <class GeoPropertyDesc> inline
00082 void AbstractGeoProperty<GeoPropertyDesc>::dump( UInt32 uiIndent,
00083 const BitVector bvFlags) const
00084 {
00085 LocalInherited::dump(uiIndent, bvFlags);
00086 }
00087
00094 #ifndef WIN32
00095 OSG_FIELD_CONTAINER_INL_TMPL_DEF(GeoProperty,
00096 GeoPropertyDesc,
00097 PtrType)
00098 #else
00099 OSG_GEO_PROP_INL_TMPL_DEF(GeoProperty,
00100 GeoPropertyDesc,
00101 PtrType)
00102 #endif
00103
00104 #ifdef OSG_MICROSOFT_COMPILER_HACKS
00105 template <class GeoPropertyDesc> inline
00106 FieldAccessMethod GeoProperty<GeoPropertyDesc>::getFPtrAccessMethod(void)
00107 {
00108 typedef GeoProperty<GeoPropertyDesc> Self;
00109 typedef StoredFieldType *(Self::*GetFieldPtr)(void);
00110
00111 GetFieldPtr tmp = &osg::GeoProperty<GeoPropertyDesc>::getFieldPtr;
00112
00113 FieldAccessMethod tmpMethod = (*((FieldAccessMethod *) &tmp));
00114
00115 return tmpMethod;
00116 }
00117 #endif
00118
00119 #if defined(__hpux)
00120 template <class GeoPropertyDesc>
00121 const BitVector GeoProperty<GeoPropertyDesc>::GeoPropDataFieldMask;
00122 #endif
00123
00124 template <class GeoPropertyDesc> inline
00125 GeoProperty<GeoPropertyDesc>::GeoProperty(void) :
00126 LocalInherited(),
00127 _field ()
00128 {
00129 }
00130
00131 template <class GeoPropertyDesc> inline
00132 GeoProperty<GeoPropertyDesc>::GeoProperty(
00133 const GeoProperty &source ) :
00134
00135 LocalInherited(source),
00136 _field (source._field)
00137 {
00138 }
00139
00140 template <class GeoPropertyDesc> inline
00141 GeoProperty<GeoPropertyDesc>::~GeoProperty(void)
00142 {
00143 }
00144
00145 #if !defined(OSG_FIXED_MFIELDSYNC)
00146 template <class GeoPropertyDesc> inline
00147 void GeoProperty<GeoPropertyDesc>::executeSync(
00148 FieldContainer &other,
00149 const BitVector &whichField)
00150 {
00151 this->executeSyncImpl((GeoProperty *) &other, whichField);
00152 }
00153
00154 template <class GeoPropertyDesc> inline
00155 void GeoProperty<GeoPropertyDesc>::executeSyncImpl(
00156 GeoProperty *pOther,
00157 const BitVector &whichField)
00158 {
00159 LocalInherited::executeSyncImpl(pOther, whichField);
00160
00161 if(FieldBits::NoField != (GeoPropDataFieldMask & whichField))
00162 {
00163 _field.syncWith(pOther->_field);
00164 }
00165 }
00166 #else
00167 template <class GeoPropertyDesc> inline
00168 void GeoProperty<GeoPropertyDesc>::executeSync(
00169 FieldContainer &other,
00170 const BitVector &whichField,
00171 const SyncInfo &sInfo )
00172 {
00173 this->executeSyncImpl((GeoProperty *) &other, whichField, sInfo);
00174 }
00175
00176 template <class GeoPropertyDesc> inline
00177 void GeoProperty<GeoPropertyDesc>::executeSyncImpl(
00178 GeoProperty *pOther,
00179 const BitVector &whichField,
00180 const SyncInfo &sInfo )
00181 {
00182 LocalInherited::executeSyncImpl(pOther, whichField, sInfo);
00183
00184 if(FieldBits::NoField != (GeoPropDataFieldMask & whichField))
00185 {
00186 _field.syncWith(pOther->_field, sInfo);
00187 }
00188 }
00189
00190 template <class GeoPropertyDesc> inline
00191 void GeoProperty<GeoPropertyDesc>::execBeginEditImpl(
00192 const BitVector &whichField,
00193 UInt32 uiAspect,
00194 UInt32 uiContainerSize)
00195 {
00196 LocalInherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00197
00198 if (FieldBits::NoField != (GeoPropDataFieldMask & whichField))
00199 {
00200 _field.beginEdit(uiAspect, uiContainerSize);
00201 }
00202 }
00203
00204 template <class GeoPropertyDesc> inline
00205 void GeoProperty<GeoPropertyDesc>::execBeginEdit(
00206 const BitVector &whichField,
00207 UInt32 uiAspect,
00208 UInt32 uiContainerSize)
00209 {
00210 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00211 }
00212
00213 template <class GeoPropertyDesc> inline
00214 void GeoProperty<GeoPropertyDesc>::onDestroyAspect(UInt32 uiId,
00215 UInt32 uiAspect)
00216 {
00217 _field.terminateShare(uiAspect, this->getContainerSize());
00218 }
00219 #endif
00220
00221 template <class GeoPropertyDesc> inline
00222 void GeoProperty<GeoPropertyDesc>::changed(BitVector whichField,
00223 UInt32 origin )
00224 {
00225 MFFieldContainerPtr::iterator parentsIt = Self::_parents.begin();
00226 MFFieldContainerPtr::iterator parentsEnd = Self::_parents.end();
00227
00228 while(parentsIt != parentsEnd)
00229 {
00230 (*parentsIt)->changed(
00231 TypeTraits<BitVector>::One << parentsIt->getParentFieldPos(),
00232 ChangedOrigin::Child);
00233 ++parentsIt;
00234 }
00235
00236 LocalInherited::changed(whichField, origin);
00237 }
00238
00239 template <class GeoPropertyDesc> inline
00240 UInt32 GeoProperty<GeoPropertyDesc>::getBinSize(const BitVector &whichField)
00241 {
00242 UInt32 returnValue = LocalInherited::getBinSize(whichField);
00243
00244 if(FieldBits::NoField != (GeoPropDataFieldMask & whichField))
00245 {
00246 returnValue += _field.getBinSize();
00247 }
00248
00249 return returnValue;
00250 }
00251
00252 template <class GeoPropertyDesc> inline
00253 void GeoProperty<GeoPropertyDesc>::copyToBin(
00254 BinaryDataHandler &pMem,
00255 const BitVector &whichField)
00256 {
00257 LocalInherited::copyToBin(pMem, whichField);
00258
00259 if(FieldBits::NoField != (GeoPropDataFieldMask & whichField))
00260 {
00261 _field.copyToBin(pMem);
00262 }
00263 }
00264
00265 template <class GeoPropertyDesc> inline
00266 void GeoProperty<GeoPropertyDesc>::copyFromBin(
00267 BinaryDataHandler &pMem,
00268 const BitVector &whichField)
00269 {
00270 LocalInherited::copyFromBin(pMem, whichField);
00271
00272 if(FieldBits::NoField != (GeoPropDataFieldMask & whichField))
00273 {
00274 _field.copyFromBin(pMem);
00275 }
00276 }
00277
00284 template <class GeoPropertyDesc> inline
00285 typename GeoProperty<GeoPropertyDesc>::StoredFieldType *
00286 GeoProperty<GeoPropertyDesc>::getFieldPtr(void)
00287 {
00288 return &_field;
00289 }
00290
00297 template <class GeoPropertyDesc> inline
00298 typename GeoProperty<GeoPropertyDesc>::StoredFieldType &
00299 GeoProperty<GeoPropertyDesc>::getField(void)
00300 {
00301 return _field;
00302 }
00303
00310 template <class GeoPropertyDesc> inline
00311 const typename GeoProperty<GeoPropertyDesc>::StoredFieldType &
00312 GeoProperty<GeoPropertyDesc>::getField(void) const
00313 {
00314 return _field;
00315 }
00316
00317 template <class GeoPropertyDesc> inline
00318 typename GeoProperty<GeoPropertyDesc>::LocalInheritedPtr
00319 GeoProperty<GeoPropertyDesc>::clone(void)
00320 {
00321 PtrType obj = GeoProperty<GeoPropertyDesc>::create();
00322
00323 obj->_field.setValues( _field );
00324 return obj;
00325 }
00326
00327
00333 template <class GeoPropertyDesc> inline
00334 UInt32 GeoProperty<GeoPropertyDesc>::getFormat(void) const
00335 {
00336 return GeoPropertyDesc::getFormat();
00337 }
00338
00339
00340 template <class GeoPropertyDesc> inline
00341 UInt32 GeoProperty<GeoPropertyDesc>::getFormatSize(void) const
00342 {
00343 return GeoPropertyDesc::getFormatSize();
00344 }
00345
00346
00347 template <class GeoPropertyDesc> inline
00348 UInt32 GeoProperty<GeoPropertyDesc>::getStride(void) const
00349 {
00350 return GeoPropertyDesc::getStride();
00351 }
00352
00353
00354 template <class GeoPropertyDesc> inline
00355 UInt32 GeoProperty<GeoPropertyDesc>::getDimension(void) const
00356 {
00357 return GeoPropertyDesc::getDimension();
00358 }
00359
00360
00361 template <class GeoPropertyDesc> inline
00362 UInt32 GeoProperty<GeoPropertyDesc>::getSize(void) const
00363 {
00364 return _field.size();
00365 }
00366
00367
00368 template <class GeoPropertyDesc> inline
00369 UInt32 GeoProperty<GeoPropertyDesc>::size(void) const
00370 {
00371 return _field.size();
00372 }
00373
00374
00375 template <class GeoPropertyDesc> inline
00376 UInt8 *GeoProperty<GeoPropertyDesc>::getData(void) const
00377 {
00378 return (UInt8 *) &(_field[0]);
00379 }
00380
00381
00382 template <class GeoPropertyDesc> inline
00383 typename GeoProperty<GeoPropertyDesc>::StoredGenericType
00384 GeoProperty<GeoPropertyDesc>::getValue(const UInt32 index)
00385 {
00386
00387 return StoredGenericType(_field[index]);
00388 }
00389
00390 template <class GeoPropertyDesc> inline
00391 typename GeoProperty<GeoPropertyDesc>::StoredGenericType
00392 GeoProperty<GeoPropertyDesc>::getValue(const UInt32 index) const
00393 {
00394
00395 return StoredGenericType(_field[index]);
00396 }
00397
00398 template <class GeoPropertyDesc> inline
00399 void GeoProperty<GeoPropertyDesc>::getValue( StoredGenericType &val,
00400 const UInt32 index)
00401 {
00402 new (&val) StoredGenericType(_field[index]);
00403 }
00404
00405
00406 template <class GeoPropertyDesc> inline
00407 void GeoProperty<GeoPropertyDesc>::getValue(
00408 StoredGenericType &val,
00409 const UInt32 index) const
00410 {
00411 new (&val) StoredGenericType(_field[index]);
00412 }
00413
00414 template <class GeoPropertyDesc> inline
00415 void GeoProperty<GeoPropertyDesc>::setValue(const StoredGenericType &value,
00416 const UInt32 index)
00417 {
00418
00419 _field[index] = StoredType(value);
00420 }
00421
00422 template <class GeoPropertyDesc> inline
00423 void GeoProperty<GeoPropertyDesc>::addValue(const StoredGenericType & value)
00424 {
00425
00426 _field.push_back( StoredType(value) );
00427 }
00428
00429 template <class GeoPropertyDesc> inline
00430 bool GeoProperty<GeoPropertyDesc>::insertValue(const StoredGenericType &val,
00431 const UInt32 index)
00432 {
00433 if(_field.size() < index)
00434 {
00435 return false;
00436 }
00437 else if(_field.size() == index)
00438 {
00439 addValue(val);
00440 return true;
00441 }
00442 else
00443 {
00444 _field.insert(_field.begin() + index, StoredType(val));
00445 return true;
00446 }
00447 }
00448
00449 template <class GeoPropertyDesc> inline
00450 void GeoProperty<GeoPropertyDesc>::clear( void )
00451 {
00452 _field.clear();
00453 }
00454
00455 template <class GeoPropertyDesc> inline
00456 void GeoProperty<GeoPropertyDesc>::push_back(
00457 const StoredGenericType &value)
00458 {
00459 addValue(value);
00460 }
00461
00462 template <class GeoPropertyDesc> inline
00463 void GeoProperty<GeoPropertyDesc>::resize( size_t newsize )
00464 {
00465 _field.resize(newsize);
00466 }
00467
00468 template <class GeoPropertyDesc> inline
00469 void GeoProperty<GeoPropertyDesc>::dump( UInt32 uiIndent,
00470 const BitVector bvFlags) const
00471 {
00472 LocalInherited::dump(uiIndent, bvFlags);
00473 }
00474
00475 OSG_END_NAMESPACE