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
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #define OSG_COMPILEWINDOWINST
00055
00056 #include <stdlib.h>
00057 #include <stdio.h>
00058
00059 #include <OSGConfig.h>
00060
00061 #include "OSGWindowBase.h"
00062 #include "OSGWindow.h"
00063
00064
00065 OSG_USING_NAMESPACE
00066
00067 const OSG::BitVector WindowBase::WidthFieldMask =
00068 (TypeTraits<BitVector>::One << WindowBase::WidthFieldId);
00069
00070 const OSG::BitVector WindowBase::HeightFieldMask =
00071 (TypeTraits<BitVector>::One << WindowBase::HeightFieldId);
00072
00073 const OSG::BitVector WindowBase::PortFieldMask =
00074 (TypeTraits<BitVector>::One << WindowBase::PortFieldId);
00075
00076 const OSG::BitVector WindowBase::ResizePendingFieldMask =
00077 (TypeTraits<BitVector>::One << WindowBase::ResizePendingFieldId);
00078
00079 const OSG::BitVector WindowBase::GlObjectEventCounterFieldMask =
00080 (TypeTraits<BitVector>::One << WindowBase::GlObjectEventCounterFieldId);
00081
00082 const OSG::BitVector WindowBase::GlObjectLastRefreshFieldMask =
00083 (TypeTraits<BitVector>::One << WindowBase::GlObjectLastRefreshFieldId);
00084
00085 const OSG::BitVector WindowBase::GlObjectLastReinitializeFieldMask =
00086 (TypeTraits<BitVector>::One << WindowBase::GlObjectLastReinitializeFieldId);
00087
00088 const OSG::BitVector WindowBase::MTInfluenceMask =
00089 (Inherited::MTInfluenceMask) |
00090 (static_cast<BitVector>(0x0) << Inherited::NextFieldId);
00091
00092
00093
00094
00117
00118
00119 FieldDescription *WindowBase::_desc[] =
00120 {
00121 new FieldDescription(SFUInt16::getClassType(),
00122 "width",
00123 WidthFieldId, WidthFieldMask,
00124 false,
00125 (FieldAccessMethod) &WindowBase::getSFWidth),
00126 new FieldDescription(SFUInt16::getClassType(),
00127 "height",
00128 HeightFieldId, HeightFieldMask,
00129 false,
00130 (FieldAccessMethod) &WindowBase::getSFHeight),
00131 new FieldDescription(MFViewportPtr::getClassType(),
00132 "port",
00133 PortFieldId, PortFieldMask,
00134 false,
00135 (FieldAccessMethod) &WindowBase::getMFPort),
00136 new FieldDescription(SFBool::getClassType(),
00137 "resizePending",
00138 ResizePendingFieldId, ResizePendingFieldMask,
00139 true,
00140 (FieldAccessMethod) &WindowBase::getSFResizePending),
00141 new FieldDescription(SFUInt32::getClassType(),
00142 "glObjectEventCounter",
00143 GlObjectEventCounterFieldId, GlObjectEventCounterFieldMask,
00144 true,
00145 (FieldAccessMethod) &WindowBase::getSFGlObjectEventCounter),
00146 new FieldDescription(MFUInt32::getClassType(),
00147 "glObjectLastRefresh",
00148 GlObjectLastRefreshFieldId, GlObjectLastRefreshFieldMask,
00149 true,
00150 (FieldAccessMethod) &WindowBase::getMFGlObjectLastRefresh),
00151 new FieldDescription(MFUInt32::getClassType(),
00152 "glObjectLastReinitialize",
00153 GlObjectLastReinitializeFieldId, GlObjectLastReinitializeFieldMask,
00154 true,
00155 (FieldAccessMethod) &WindowBase::getMFGlObjectLastReinitialize)
00156 };
00157
00158
00159 FieldContainerType WindowBase::_type(
00160 "Window",
00161 "AttachmentContainer",
00162 NULL,
00163 NULL,
00164 Window::initMethod,
00165 _desc,
00166 sizeof(_desc));
00167
00168
00169
00170
00171
00172 FieldContainerType &WindowBase::getType(void)
00173 {
00174 return _type;
00175 }
00176
00177 const FieldContainerType &WindowBase::getType(void) const
00178 {
00179 return _type;
00180 }
00181
00182
00183 UInt32 WindowBase::getContainerSize(void) const
00184 {
00185 return sizeof(Window);
00186 }
00187
00188
00189 #if !defined(OSG_FIXED_MFIELDSYNC)
00190 void WindowBase::executeSync( FieldContainer &other,
00191 const BitVector &whichField)
00192 {
00193 this->executeSyncImpl((WindowBase *) &other, whichField);
00194 }
00195 #else
00196 void WindowBase::executeSync( FieldContainer &other,
00197 const BitVector &whichField, const SyncInfo &sInfo )
00198 {
00199 this->executeSyncImpl((WindowBase *) &other, whichField, sInfo);
00200 }
00201 void WindowBase::execBeginEdit(const BitVector &whichField,
00202 UInt32 uiAspect,
00203 UInt32 uiContainerSize)
00204 {
00205 this->execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00206 }
00207
00208 void WindowBase::onDestroyAspect(UInt32 uiId, UInt32 uiAspect)
00209 {
00210 Inherited::onDestroyAspect(uiId, uiAspect);
00211
00212 _mfPort.terminateShare(uiAspect, this->getContainerSize());
00213 _mfGlObjectLastRefresh.terminateShare(uiAspect, this->getContainerSize());
00214 _mfGlObjectLastReinitialize.terminateShare(uiAspect, this->getContainerSize());
00215 }
00216 #endif
00217
00218
00219
00220 #ifdef OSG_WIN32_ICL
00221 #pragma warning (disable : 383)
00222 #endif
00223
00224 WindowBase::WindowBase(void) :
00225 _sfWidth (),
00226 _sfHeight (),
00227 _mfPort (),
00228 _sfResizePending (),
00229 _sfGlObjectEventCounter (UInt32(1)),
00230 _mfGlObjectLastRefresh (),
00231 _mfGlObjectLastReinitialize(),
00232 Inherited()
00233 {
00234 }
00235
00236 #ifdef OSG_WIN32_ICL
00237 #pragma warning (default : 383)
00238 #endif
00239
00240 WindowBase::WindowBase(const WindowBase &source) :
00241 _sfWidth (source._sfWidth ),
00242 _sfHeight (source._sfHeight ),
00243 _mfPort (source._mfPort ),
00244 _sfResizePending (source._sfResizePending ),
00245 _sfGlObjectEventCounter (source._sfGlObjectEventCounter ),
00246 _mfGlObjectLastRefresh (source._mfGlObjectLastRefresh ),
00247 _mfGlObjectLastReinitialize(source._mfGlObjectLastReinitialize),
00248 Inherited (source)
00249 {
00250 }
00251
00252
00253
00254 WindowBase::~WindowBase(void)
00255 {
00256 }
00257
00258
00259
00260 UInt32 WindowBase::getBinSize(const BitVector &whichField)
00261 {
00262 UInt32 returnValue = Inherited::getBinSize(whichField);
00263
00264 if(FieldBits::NoField != (WidthFieldMask & whichField))
00265 {
00266 returnValue += _sfWidth.getBinSize();
00267 }
00268
00269 if(FieldBits::NoField != (HeightFieldMask & whichField))
00270 {
00271 returnValue += _sfHeight.getBinSize();
00272 }
00273
00274 if(FieldBits::NoField != (PortFieldMask & whichField))
00275 {
00276 returnValue += _mfPort.getBinSize();
00277 }
00278
00279 if(FieldBits::NoField != (ResizePendingFieldMask & whichField))
00280 {
00281 returnValue += _sfResizePending.getBinSize();
00282 }
00283
00284 if(FieldBits::NoField != (GlObjectEventCounterFieldMask & whichField))
00285 {
00286 returnValue += _sfGlObjectEventCounter.getBinSize();
00287 }
00288
00289 if(FieldBits::NoField != (GlObjectLastRefreshFieldMask & whichField))
00290 {
00291 returnValue += _mfGlObjectLastRefresh.getBinSize();
00292 }
00293
00294 if(FieldBits::NoField != (GlObjectLastReinitializeFieldMask & whichField))
00295 {
00296 returnValue += _mfGlObjectLastReinitialize.getBinSize();
00297 }
00298
00299
00300 return returnValue;
00301 }
00302
00303 void WindowBase::copyToBin( BinaryDataHandler &pMem,
00304 const BitVector &whichField)
00305 {
00306 Inherited::copyToBin(pMem, whichField);
00307
00308 if(FieldBits::NoField != (WidthFieldMask & whichField))
00309 {
00310 _sfWidth.copyToBin(pMem);
00311 }
00312
00313 if(FieldBits::NoField != (HeightFieldMask & whichField))
00314 {
00315 _sfHeight.copyToBin(pMem);
00316 }
00317
00318 if(FieldBits::NoField != (PortFieldMask & whichField))
00319 {
00320 _mfPort.copyToBin(pMem);
00321 }
00322
00323 if(FieldBits::NoField != (ResizePendingFieldMask & whichField))
00324 {
00325 _sfResizePending.copyToBin(pMem);
00326 }
00327
00328 if(FieldBits::NoField != (GlObjectEventCounterFieldMask & whichField))
00329 {
00330 _sfGlObjectEventCounter.copyToBin(pMem);
00331 }
00332
00333 if(FieldBits::NoField != (GlObjectLastRefreshFieldMask & whichField))
00334 {
00335 _mfGlObjectLastRefresh.copyToBin(pMem);
00336 }
00337
00338 if(FieldBits::NoField != (GlObjectLastReinitializeFieldMask & whichField))
00339 {
00340 _mfGlObjectLastReinitialize.copyToBin(pMem);
00341 }
00342
00343
00344 }
00345
00346 void WindowBase::copyFromBin( BinaryDataHandler &pMem,
00347 const BitVector &whichField)
00348 {
00349 Inherited::copyFromBin(pMem, whichField);
00350
00351 if(FieldBits::NoField != (WidthFieldMask & whichField))
00352 {
00353 _sfWidth.copyFromBin(pMem);
00354 }
00355
00356 if(FieldBits::NoField != (HeightFieldMask & whichField))
00357 {
00358 _sfHeight.copyFromBin(pMem);
00359 }
00360
00361 if(FieldBits::NoField != (PortFieldMask & whichField))
00362 {
00363 _mfPort.copyFromBin(pMem);
00364 }
00365
00366 if(FieldBits::NoField != (ResizePendingFieldMask & whichField))
00367 {
00368 _sfResizePending.copyFromBin(pMem);
00369 }
00370
00371 if(FieldBits::NoField != (GlObjectEventCounterFieldMask & whichField))
00372 {
00373 _sfGlObjectEventCounter.copyFromBin(pMem);
00374 }
00375
00376 if(FieldBits::NoField != (GlObjectLastRefreshFieldMask & whichField))
00377 {
00378 _mfGlObjectLastRefresh.copyFromBin(pMem);
00379 }
00380
00381 if(FieldBits::NoField != (GlObjectLastReinitializeFieldMask & whichField))
00382 {
00383 _mfGlObjectLastReinitialize.copyFromBin(pMem);
00384 }
00385
00386
00387 }
00388
00389 #if !defined(OSG_FIXED_MFIELDSYNC)
00390 void WindowBase::executeSyncImpl( WindowBase *pOther,
00391 const BitVector &whichField)
00392 {
00393
00394 Inherited::executeSyncImpl(pOther, whichField);
00395
00396 if(FieldBits::NoField != (WidthFieldMask & whichField))
00397 _sfWidth.syncWith(pOther->_sfWidth);
00398
00399 if(FieldBits::NoField != (HeightFieldMask & whichField))
00400 _sfHeight.syncWith(pOther->_sfHeight);
00401
00402 if(FieldBits::NoField != (PortFieldMask & whichField))
00403 _mfPort.syncWith(pOther->_mfPort);
00404
00405 if(FieldBits::NoField != (ResizePendingFieldMask & whichField))
00406 _sfResizePending.syncWith(pOther->_sfResizePending);
00407
00408 if(FieldBits::NoField != (GlObjectEventCounterFieldMask & whichField))
00409 _sfGlObjectEventCounter.syncWith(pOther->_sfGlObjectEventCounter);
00410
00411 if(FieldBits::NoField != (GlObjectLastRefreshFieldMask & whichField))
00412 _mfGlObjectLastRefresh.syncWith(pOther->_mfGlObjectLastRefresh);
00413
00414 if(FieldBits::NoField != (GlObjectLastReinitializeFieldMask & whichField))
00415 _mfGlObjectLastReinitialize.syncWith(pOther->_mfGlObjectLastReinitialize);
00416
00417
00418 }
00419 #else
00420 void WindowBase::executeSyncImpl( WindowBase *pOther,
00421 const BitVector &whichField,
00422 const SyncInfo &sInfo )
00423 {
00424
00425 Inherited::executeSyncImpl(pOther, whichField, sInfo);
00426
00427 if(FieldBits::NoField != (WidthFieldMask & whichField))
00428 _sfWidth.syncWith(pOther->_sfWidth);
00429
00430 if(FieldBits::NoField != (HeightFieldMask & whichField))
00431 _sfHeight.syncWith(pOther->_sfHeight);
00432
00433 if(FieldBits::NoField != (ResizePendingFieldMask & whichField))
00434 _sfResizePending.syncWith(pOther->_sfResizePending);
00435
00436 if(FieldBits::NoField != (GlObjectEventCounterFieldMask & whichField))
00437 _sfGlObjectEventCounter.syncWith(pOther->_sfGlObjectEventCounter);
00438
00439
00440 if(FieldBits::NoField != (PortFieldMask & whichField))
00441 _mfPort.syncWith(pOther->_mfPort, sInfo);
00442
00443 if(FieldBits::NoField != (GlObjectLastRefreshFieldMask & whichField))
00444 _mfGlObjectLastRefresh.syncWith(pOther->_mfGlObjectLastRefresh, sInfo);
00445
00446 if(FieldBits::NoField != (GlObjectLastReinitializeFieldMask & whichField))
00447 _mfGlObjectLastReinitialize.syncWith(pOther->_mfGlObjectLastReinitialize, sInfo);
00448
00449
00450 }
00451
00452 void WindowBase::execBeginEditImpl (const BitVector &whichField,
00453 UInt32 uiAspect,
00454 UInt32 uiContainerSize)
00455 {
00456 Inherited::execBeginEditImpl(whichField, uiAspect, uiContainerSize);
00457
00458 if(FieldBits::NoField != (PortFieldMask & whichField))
00459 _mfPort.beginEdit(uiAspect, uiContainerSize);
00460
00461 if(FieldBits::NoField != (GlObjectLastRefreshFieldMask & whichField))
00462 _mfGlObjectLastRefresh.beginEdit(uiAspect, uiContainerSize);
00463
00464 if(FieldBits::NoField != (GlObjectLastReinitializeFieldMask & whichField))
00465 _mfGlObjectLastReinitialize.beginEdit(uiAspect, uiContainerSize);
00466
00467 }
00468 #endif
00469
00470
00471
00472 #include <OSGSFieldTypeDef.inl>
00473 #include <OSGMFieldTypeDef.inl>
00474
00475 OSG_BEGIN_NAMESPACE
00476
00477 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
00478 DataType FieldDataTraits<WindowPtr>::_type("WindowPtr", "AttachmentContainerPtr");
00479 #endif
00480
00481 OSG_DLLEXPORT_SFIELD_DEF1(WindowPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00482 OSG_DLLEXPORT_MFIELD_DEF1(WindowPtr, OSG_SYSTEMLIB_DLLTMPLMAPPING);
00483
00484 OSG_END_NAMESPACE
00485
00486
00487
00488
00489
00490 #ifdef OSG_SGI_CC
00491 #pragma set woff 1174
00492 #endif
00493
00494 #ifdef OSG_LINUX_ICC
00495 #pragma warning( disable : 177 )
00496 #endif
00497
00498 namespace
00499 {
00500 static Char8 cvsid_cpp [] = "@(#)$Id: FCBaseTemplate_cpp.h,v 1.45 2005/07/20 00:10:14 vossg Exp $";
00501 static Char8 cvsid_hpp [] = OSGWINDOWBASE_HEADER_CVSID;
00502 static Char8 cvsid_inl [] = OSGWINDOWBASE_INLINE_CVSID;
00503
00504 static Char8 cvsid_fields_hpp[] = OSGWINDOWFIELDS_HEADER_CVSID;
00505 }
00506