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 #ifndef _OSGFIELDCONTAINERPTRIMPL_INL_
00040 #define _OSGFIELDCONTAINERPTRIMPL_INL_
00041
00042 #ifdef OSG_DOC_FILES_IN_MODULE
00043
00046 #endif
00047
00048 #include <stdlib.h>
00049 #include <stdio.h>
00050
00051 #include "OSGConfig.h"
00052
00053 #include <iostream>
00054
00055 OSG_BEGIN_NAMESPACE
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 inline
00066 Int32 *FieldContainerPtrBase::getRefCountP(void)
00067 {
00068 return (Int32 *) (_storeP - sizeof(Int32) - sizeof(UInt32));
00069 }
00070
00071 inline
00072 Int32 *FieldContainerPtrBase::getRefCountP(void) const
00073 {
00074 return (Int32 *) (_storeP - sizeof(Int32) - sizeof(UInt32));
00075 }
00076
00077 inline
00078 UInt32 *FieldContainerPtrBase::getIdP(void)
00079 {
00080 return (UInt32 *) (_storeP - sizeof(UInt32));
00081 }
00082
00083 inline
00084 UInt32 *FieldContainerPtrBase::getIdP(void) const
00085 {
00086 return (UInt32 *) (_storeP - sizeof(UInt32));
00087 }
00088
00089 inline
00090 UInt8 *FieldContainerPtrBase::getElemP(UInt32 uiElemNum)
00091 {
00092 return (_storeP + (_containerSize * uiElemNum));
00093 }
00094
00095 inline
00096 UInt8 *FieldContainerPtrBase::getElemP(UInt32 uiElemNum) const
00097 {
00098 return (_storeP + (_containerSize * uiElemNum));
00099 }
00100
00101 inline
00102 UInt8 *FieldContainerPtrBase::getFirstElemP(void)
00103 {
00104 return _storeP;
00105 }
00106
00107 inline
00108 UInt8 *FieldContainerPtrBase::getFirstElemP(void) const
00109 {
00110 return _storeP;
00111 }
00112
00113
00114
00115
00116 inline
00117 Int32 FieldContainerPtrBase::getRefCountOff(void) const
00118 {
00119 return -Int32((sizeof(Int32) + sizeof(UInt32)));
00120 }
00121
00122 inline
00123 Int32 FieldContainerPtrBase::getIdOff(void) const
00124 {
00125 return -Int32(sizeof(UInt32));
00126 }
00127
00128 inline
00129 Int32 FieldContainerPtrBase::getFirstElemOff(void) const
00130 {
00131 return 0;
00132 }
00133
00134 inline
00135 Int32 FieldContainerPtrBase::getElemOff(UInt32 uiElemNum) const
00136 {
00137 return (_containerSize * uiElemNum);
00138 }
00139
00140
00141
00142
00143
00144 inline
00145 FieldContainerPtrBase::FieldContainerPtrBase(void) :
00146 _containerSize(0 ),
00147 _uiParentEPos(InvalidParentEPos),
00148 _storeP (NULL )
00149 {
00150 #ifdef OSG_DEBUG_FCPTR
00151 _typedStoreP = reinterpret_cast<FieldContainer *>(getFirstElemP());
00152 #endif
00153 }
00154
00155 inline
00156 FieldContainerPtrBase::FieldContainerPtrBase(
00157 const NullFieldContainerPtr &) :
00158
00159 _containerSize(0 ),
00160 _uiParentEPos (InvalidParentEPos),
00161 _storeP (NULL )
00162 {
00163 #ifdef OSG_DEBUG_FCPTR
00164 _typedStoreP = reinterpret_cast<FieldContainer *>(getFirstElemP());
00165 #endif
00166 }
00167
00168 inline
00169 FieldContainerPtrBase::FieldContainerPtrBase(
00170 const FieldContainerPtrBase &source) :
00171
00172 _containerSize(source._containerSize),
00173 _uiParentEPos (source._uiParentEPos ),
00174 _storeP (source._storeP )
00175 {
00176 #ifdef OSG_DEBUG_FCPTR
00177 _typedStoreP = reinterpret_cast<FieldContainer *>(getFirstElemP());
00178 #endif
00179 }
00180
00181
00182
00183
00184 inline
00185 FieldContainerPtrBase::~FieldContainerPtrBase(void)
00186 {
00187 #ifdef OSG_DEBUG
00188 _storeP = NULL;
00189 _containerSize = 65535;
00190 _uiParentEPos = 65535;
00191 #ifdef OSG_DEBUG_FCPTR
00192 _typedStoreP = NULL;
00193 #endif
00194 #endif
00195 }
00196
00197
00198
00199
00200 inline
00201 void FieldContainerPtrBase::setParentFieldPos(UInt16 uiParentEPos)
00202 {
00203 _uiParentEPos = uiParentEPos;
00204 }
00205
00206 inline
00207 UInt16 FieldContainerPtrBase::getParentFieldPos(void) const
00208 {
00209 return _uiParentEPos;
00210 }
00211
00212
00213
00214
00215 inline
00216 Int32 FieldContainerPtrBase::getRefCount(void) const
00217 {
00218 if(_storeP == NULL)
00219 return 0;
00220
00221 return (*getRefCountP());
00222 }
00223
00224 inline
00225 UInt32 FieldContainerPtrBase::getFieldContainerId(void) const
00226 {
00227 return (*getIdP());
00228 }
00229
00230 inline
00231 UInt16 FieldContainerPtrBase::getContainerSize(void) const
00232 {
00233 return _containerSize;
00234 }
00235
00236 inline
00237 FieldContainer *FieldContainerPtrBase::getBaseCPtr(void) const
00238 {
00239 return reinterpret_cast<FieldContainer *>(getFirstElemP());
00240 }
00241
00242 inline
00243 FieldContainer *FieldContainerPtrBase::getAspectCPtr(UInt32 uiAspectId) const
00244 {
00245 return reinterpret_cast<FieldContainer *>(getElemP(uiAspectId));
00246 }
00247
00248
00249
00250 inline
00251 void FieldContainerPtrBase::operator =(const NullFieldContainerPtr &)
00252 {
00253 _containerSize = 0;
00254 _uiParentEPos = InvalidParentEPos;
00255 _storeP = NULL;
00256
00257 #ifdef OSG_DEBUG_FCPTR
00258 _typedStoreP = NULL;
00259 #endif
00260 }
00261
00262 inline
00263 void FieldContainerPtrBase::operator =(const FieldContainerPtrBase &source)
00264 {
00265 if (this == &source)
00266 return;
00267
00268 _containerSize = source._containerSize;
00269 _uiParentEPos = source._uiParentEPos;
00270 _storeP = source._storeP;
00271
00272 #ifdef OSG_DEBUG_FCPTR
00273 _typedStoreP = reinterpret_cast<FieldContainer *>(getFirstElemP());
00274 #endif
00275 }
00276
00277
00278
00279
00280 inline
00281 bool FieldContainerPtrBase::operator < (
00282 const NullFieldContainerPtr &) const
00283 {
00284 return false;
00285 }
00286
00287 inline
00288 bool FieldContainerPtrBase::operator ==(
00289 const NullFieldContainerPtr &) const
00290 {
00291 return _storeP == NULL;
00292 }
00293
00294 inline
00295 bool FieldContainerPtrBase::operator !=(
00296 const NullFieldContainerPtr &) const
00297 {
00298 return _storeP != NULL;
00299 }
00300
00301
00302 inline
00303 bool FieldContainerPtrBase::operator < (
00304 const FieldContainerPtrBase &other)const
00305 {
00306 return _storeP < other._storeP;
00307 }
00308
00309 inline
00310 bool FieldContainerPtrBase::operator ==(
00311 const FieldContainerPtrBase &other) const
00312 {
00313 return _storeP == other._storeP;
00314 }
00315
00316 inline
00317 bool FieldContainerPtrBase::operator !=(
00318 const FieldContainerPtrBase &other) const
00319 {
00320 return ! (*this == other);
00321 }
00322
00323 inline
00324 bool FieldContainerPtrBase::operator ! (void) const
00325 {
00326 return _storeP == NULL;
00327 }
00328
00329 inline
00330 FieldContainerPtrBase::operator FieldContainerPtrBase::unspecified_bool_type() const
00331 {
00332 return !*this ? 0 : &FieldContainerPtrBase::_storeP;
00333 }
00334
00335
00336
00337
00338 inline
00339 FieldContainerPtrBase::FieldContainerPtrBase(const FieldContainer *source,
00340 const UInt16 uiSize,
00341 const UInt16 uiParentEPos)
00342 {
00343 _uiParentEPos = uiParentEPos;
00344 _containerSize = uiSize;
00345
00346 if(source != NULL)
00347 {
00348 _storeP = (UInt8 *) (const_cast<FieldContainer *>(source));
00349 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00350 _storeP -= getElemOff(Thread::getAspect());
00351 #endif
00352 }
00353 else
00354 {
00355 _storeP = NULL;
00356 }
00357
00358 #ifdef OSG_DEBUG_FCPTR
00359 _typedStoreP = reinterpret_cast<FieldContainer *>(getFirstElemP());
00360 #endif
00361 }
00362
00363
00364
00365
00366
00367
00368
00369
00370 inline
00371 FieldContainerPtrBase::FieldContainerPtrBase(const FieldContainer &source)
00372 {
00373 _containerSize = source.getContainerSize();
00374 _uiParentEPos = InvalidParentEPos;
00375 _storeP = (UInt8 *) (const_cast<FieldContainer *>(&source));
00376 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00377 _storeP -= getElemOff(Thread::getAspect());
00378 #endif
00379
00380 #ifdef OSG_DEBUG_FCPTR
00381 _typedStoreP = reinterpret_cast<FieldContainer *>(getFirstElemP());
00382 #endif
00383 }
00384
00385 inline
00386 FieldContainerPtrBase::FieldContainerPtrBase(const FieldContainer *source)
00387 {
00388 _uiParentEPos = InvalidParentEPos;
00389
00390 if(source != NULL)
00391 {
00392 _containerSize = source->getContainerSize();
00393 _storeP = (UInt8 *) (const_cast<FieldContainer *>(source));
00394 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00395 _storeP -= getElemOff(Thread::getAspect());
00396 #endif
00397 }
00398 else
00399 {
00400 _containerSize = 0;
00401 _storeP = NULL;
00402 }
00403
00404 #ifdef OSG_DEBUG_FCPTR
00405 _typedStoreP = reinterpret_cast<FieldContainer *>(getFirstElemP());
00406 #endif
00407 }
00408
00409
00410
00411
00412 inline
00413 void FieldContainerPtrBase::addRef(void) const
00414 {
00415 _pRefCountLock->aquire(_storeP);
00416
00417 (*getRefCountP())++;
00418
00419 _pRefCountLock->release(_storeP);
00420
00421 Thread::getCurrentChangeList()->addAddRefd(
00422 *(static_cast<const FieldContainerPtr *>(this)));
00423 }
00424
00425 inline
00426 void FieldContainerPtrBase::setNull(void)
00427 {
00428 _containerSize = 0;
00429 _uiParentEPos = InvalidParentEPos;
00430 _storeP = NULL;
00431
00432 #ifdef OSG_DEBUG_FCPTR
00433 _typedStoreP = reinterpret_cast<FieldContainer *>(getFirstElemP());
00434 #endif
00435 }
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446 inline
00447 FieldContainerPtr::FieldContainerPtr(void) :
00448 Inherited()
00449 {
00450 }
00451
00452 inline
00453 FieldContainerPtr::FieldContainerPtr(const NullFieldContainerPtr &) :
00454 Inherited()
00455 {
00456 }
00457
00458 inline
00459 FieldContainerPtr::FieldContainerPtr(const FieldContainerPtr &source) :
00460 Inherited(source)
00461 {
00462 }
00463
00464
00465
00466
00467 inline
00468 FieldContainerPtr::~FieldContainerPtr(void)
00469 {
00470 }
00471
00472
00473
00474
00475 inline
00476 FieldContainer *FieldContainerPtr::operator->(void)
00477 {
00478 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00479 return (FieldContainer *) (getElemP(Thread::getAspect()));
00480 #else
00481 return (FieldContainer *) (getFirstElemP());
00482 #endif
00483 }
00484
00485 inline
00486 FieldContainer *FieldContainerPtr::operator->(void) const
00487 {
00488 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00489 return (FieldContainer *) (getElemP(Thread::getAspect()));
00490 #else
00491 return (FieldContainer *) (getFirstElemP());
00492 #endif
00493 }
00494
00495 inline
00496 FieldContainer &FieldContainerPtr::operator *(void)
00497 {
00498 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00499 return *((FieldContainer *) (getElemP(Thread::getAspect())));
00500 #else
00501 return *((FieldContainer *) (getFirstElemP()));
00502 #endif
00503 }
00504
00505 inline
00506 FieldContainer &FieldContainerPtr::operator *(void) const
00507 {
00508 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00509 return *((FieldContainer *) (getElemP(Thread::getAspect())));
00510 #else
00511 return *((FieldContainer *) (getFirstElemP()));
00512 #endif
00513 }
00514
00515 inline
00516 FieldContainer *FieldContainerPtr::getCPtr(void)
00517 {
00518 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00519 return (FieldContainer *) (getElemP(Thread::getAspect()));
00520 #else
00521 return (FieldContainer *) (getFirstElemP());
00522 #endif
00523 }
00524
00525 inline
00526 FieldContainer *FieldContainerPtr::getCPtr(void) const
00527 {
00528 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00529 return (FieldContainer *) (getElemP(Thread::getAspect()));
00530 #else
00531 return (FieldContainer *) (getFirstElemP());
00532 #endif
00533 }
00534
00535
00536
00537
00538 inline
00539 void FieldContainerPtr::operator =(const NullFieldContainerPtr &)
00540 {
00541 setNull();
00542 }
00543
00544 inline
00545 void FieldContainerPtr::operator =(const FieldContainerPtr &source)
00546 {
00547 *(static_cast<Inherited *>(this)) = source;
00548 }
00549
00550
00551
00552
00553 #ifdef OSG_FIXED_MFIELDSYNC
00554 inline
00555 void FieldContainerPtr::beginEdit(BitVector whichField,
00556 UInt32 OSG_CHECK_ARG(origin)) const
00557 {
00558 (*this)->execBeginEdit(whichField,
00559 Thread::getAspect(),
00560 getContainerSize());
00561 }
00562 #else
00563 inline
00564 void FieldContainerPtr::beginEdit(BitVector OSG_CHECK_ARG(whichField),
00565 UInt32 OSG_CHECK_ARG(origin)) const
00566 {
00567 }
00568 #endif
00569
00570 inline
00571 void FieldContainerPtr::endEditNotChanged(BitVector whichField,
00572 UInt32 ) const
00573 {
00574 Thread::getCurrentChangeList()->addChanged(*this, whichField);
00575 }
00576
00577 inline
00578 void FieldContainerPtr::changed(BitVector whichField, UInt32 origin) const
00579 {
00580 (*this)->changed(whichField, origin);
00581 }
00582
00583 inline
00584 void FieldContainerPtr::endEdit(BitVector whichField, UInt32 origin) const
00585 {
00586 endEditNotChanged(whichField, origin);
00587 changed(whichField, origin);
00588 }
00589
00590
00591
00592
00593
00594 inline
00595 FieldContainerPtr::FieldContainerPtr(const FieldContainer &source) :
00596 Inherited(source)
00597 {
00598 }
00599
00600 inline
00601 FieldContainerPtr::FieldContainerPtr(const FieldContainer *source) :
00602 Inherited(source)
00603 {
00604 }
00605
00606 inline
00607 FieldContainerPtr::FieldContainerPtr(const FieldContainer *source,
00608 const UInt16 uiSize,
00609 const UInt16 uiParentEPos) :
00610 Inherited(source, uiSize, uiParentEPos)
00611 {
00612 }
00613
00614
00615
00616
00617
00618
00619
00620
00621
00622
00623 inline
00624 ConstFieldContainerPtr::ConstFieldContainerPtr(void) :
00625 Inherited()
00626 {
00627 }
00628
00629 inline
00630 ConstFieldContainerPtr::ConstFieldContainerPtr(
00631 const NullFieldContainerPtr &) :
00632 Inherited()
00633 {
00634 }
00635
00636 inline
00637 ConstFieldContainerPtr::ConstFieldContainerPtr(
00638 const FieldContainerPtr &source) :
00639 Inherited(source)
00640 {
00641 }
00642
00643 inline
00644 ConstFieldContainerPtr::ConstFieldContainerPtr(
00645 const ConstFieldContainerPtr &source):
00646 Inherited(source)
00647 {
00648 }
00649
00650
00651
00652
00653 inline
00654 ConstFieldContainerPtr::~ConstFieldContainerPtr(void)
00655 {
00656 }
00657
00658
00659
00660
00661 inline
00662 const FieldContainer *ConstFieldContainerPtr::operator->(void)
00663 {
00664 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00665 return (const FieldContainer *) (getElemP(Thread::getAspect()));
00666 #else
00667 return (const FieldContainer *) (getFirstElemP());
00668 #endif
00669 }
00670
00671 inline
00672 const FieldContainer *ConstFieldContainerPtr::operator->(void) const
00673 {
00674 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00675 return (const FieldContainer *) (getElemP(Thread::getAspect()));
00676 #else
00677 return (const FieldContainer *) (getFirstElemP());
00678 #endif
00679 }
00680
00681 inline
00682 const FieldContainer &ConstFieldContainerPtr::operator *(void)
00683 {
00684 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00685 return *((const FieldContainer *) (getElemP(Thread::getAspect())));
00686 #else
00687 return *((const FieldContainer *) (getFirstElemP()));
00688 #endif
00689 }
00690
00691 inline
00692 const FieldContainer &ConstFieldContainerPtr::operator *(void) const
00693 {
00694 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00695 return *((const FieldContainer *) (getElemP(Thread::getAspect())));
00696 #else
00697 return *((const FieldContainer *) (getFirstElemP()));
00698 #endif
00699 }
00700
00701 inline
00702 const FieldContainer *ConstFieldContainerPtr::getCPtr(void)
00703 {
00704 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00705 return (const FieldContainer *) (getElemP(Thread::getAspect()));
00706 #else
00707 return (const FieldContainer *) (getFirstElemP());
00708 #endif
00709 }
00710
00711 inline
00712 const FieldContainer *ConstFieldContainerPtr::getCPtr(void) const
00713 {
00714 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00715 return (const FieldContainer *) (getElemP(Thread::getAspect()));
00716 #else
00717 return (const FieldContainer *) (getFirstElemP());
00718 #endif
00719 }
00720
00721
00722
00723
00724 inline
00725 void ConstFieldContainerPtr::operator =(const NullFieldContainerPtr &)
00726 {
00727 setNull();
00728 }
00729
00730 inline
00731 void ConstFieldContainerPtr::operator =(const FieldContainerPtr &source)
00732 {
00733 *(static_cast<Inherited *>(this)) = source;
00734 }
00735
00736 inline
00737 void ConstFieldContainerPtr::operator =(const ConstFieldContainerPtr &source)
00738 {
00739 *(static_cast<Inherited *>(this)) = source;
00740 }
00741
00742
00743
00744
00745 inline
00746 ConstFieldContainerPtr::ConstFieldContainerPtr(const FieldContainer &source) :
00747 Inherited(source)
00748 {
00749 }
00750
00751 inline
00752 ConstFieldContainerPtr::ConstFieldContainerPtr(const FieldContainer *source) :
00753 Inherited(source)
00754 {
00755 }
00756
00757 inline
00758 ConstFieldContainerPtr::ConstFieldContainerPtr(
00759 const FieldContainer *source,
00760 const UInt16 uiSize,
00761 const UInt16 uiParentEPos) :
00762
00763 Inherited(source, uiSize, uiParentEPos)
00764 {
00765 }
00766
00767
00768
00769
00770
00771
00772
00773
00774
00775 inline
00776 NullFieldContainerPtr::NullFieldContainerPtr(void) :
00777 Inherited()
00778 {
00779 }
00780
00781
00782
00783
00784 inline
00785 NullFieldContainerPtr::~NullFieldContainerPtr(void)
00786 {
00787 }
00788
00789
00790
00791
00792
00793
00794
00795
00796
00797
00798 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00799 FCPtr<BasePtrTypeT, FieldContainerTypeT>::FCPtr(void) :
00800 Inherited()
00801 {
00802 }
00803
00804 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00805 FCPtr<BasePtrTypeT, FieldContainerTypeT>::FCPtr(const FCPtr &source):
00806 Inherited(source)
00807 {
00808 }
00809
00810 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00811 FCPtr<BasePtrTypeT,
00812 FieldContainerTypeT>::FCPtr(const NullFieldContainerPtr &) :
00813
00814 Inherited()
00815 {
00816 }
00817
00818
00819
00820
00821 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00822 FCPtr<BasePtrTypeT, FieldContainerTypeT>::~FCPtr(void)
00823 {
00824 }
00825
00826
00827
00828
00829 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00830 FieldContainerTypeT *FCPtr<BasePtrTypeT,
00831 FieldContainerTypeT>::operator ->(void)
00832 {
00833 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00834 return (FieldContainerTypeT *) Self::getElemP(Thread::getAspect());
00835 #else
00836 return (FieldContainerTypeT *) Self::getFirstElemP();
00837 #endif
00838 }
00839
00840 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00841 FieldContainerTypeT *FCPtr<BasePtrTypeT,
00842 FieldContainerTypeT>::operator ->(void) const
00843 {
00844 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00845 return (FieldContainerTypeT *) Self::getElemP(Thread::getAspect());
00846 #else
00847 return (FieldContainerTypeT *) Self::getFirstElemP();
00848 #endif
00849 }
00850
00851 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00852 FieldContainerTypeT &FCPtr<BasePtrTypeT,
00853 FieldContainerTypeT>::operator *(void)
00854 {
00855 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00856 return *((FieldContainerTypeT *) Self::getElemP(Thread::getAspect()));
00857 #else
00858 return *((FieldContainerTypeT *) Self::getFirstElemP());
00859 #endif
00860 }
00861
00862 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00863 FieldContainerTypeT &FCPtr<BasePtrTypeT,
00864 FieldContainerTypeT>::operator *(void) const
00865 {
00866 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00867 return *((FieldContainerTypeT *) Self::getElemP(Thread::getAspect()));
00868 #else
00869 return *((FieldContainerTypeT *) Self::getFirstElemP());
00870 #endif
00871 }
00872
00873
00874 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00875 FieldContainerTypeT *FCPtr<BasePtrTypeT, FieldContainerTypeT>::getCPtr(void)
00876
00877 {
00878 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00879 return (FieldContainerTypeT *) Self::getElemP(Thread::getAspect());
00880 #else
00881 return (FieldContainerTypeT *) Self::getFirstElemP();
00882 #endif
00883 }
00884
00885 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00886 FieldContainerTypeT *
00887 FCPtr<BasePtrTypeT, FieldContainerTypeT>::getCPtr(void) const
00888 {
00889 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
00890 return (FieldContainerTypeT *) Self::getElemP(Thread::getAspect());
00891 #else
00892 return (FieldContainerTypeT *) Self::getFirstElemP();
00893 #endif
00894 }
00895
00896
00897
00898
00899 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00900 void FCPtr<BasePtrTypeT,
00901 FieldContainerTypeT>::operator = (const FCPtr &source)
00902 {
00903
00904 *(static_cast<Inherited *>(this)) = source;
00905 }
00906
00907 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00908 void FCPtr<BasePtrTypeT, FieldContainerTypeT>::operator = (
00909 const NullFieldContainerPtr &)
00910 {
00911 Self::setNull();
00912 }
00913
00914
00915
00916
00917 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00918 FCPtr<BasePtrTypeT,
00919 FieldContainerTypeT>::FCPtr(const FieldContainerTypeT &source) :
00920
00921 Inherited(source)
00922 {
00923 }
00924
00925 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00926 FCPtr<BasePtrTypeT,
00927 FieldContainerTypeT>::FCPtr(const FieldContainerTypeT *source) :
00928
00929 Inherited(source)
00930 {
00931 }
00932
00933 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00934 FCPtr<BasePtrTypeT,
00935 FieldContainerTypeT>::FCPtr(const FieldContainerTypeT *source,
00936 const UInt16 uiSize,
00937 const UInt16 uiParentEPos) :
00938
00939 Inherited(source, uiSize, uiParentEPos)
00940 {
00941 }
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00954 ConstFCPtr<BasePtrTypeT, FieldContainerTypeT>::ConstFCPtr(void) :
00955 Inherited()
00956 {
00957 }
00958
00959 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00960 ConstFCPtr<BasePtrTypeT,
00961 FieldContainerTypeT>::ConstFCPtr(
00962 const NullFieldContainerPtr &) :
00963
00964 Inherited()
00965 {
00966 }
00967
00968 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00969 ConstFCPtr<BasePtrTypeT,
00970 FieldContainerTypeT>::ConstFCPtr(const NCFCPtr &source) :
00971
00972 Inherited(source)
00973 {
00974 }
00975
00976 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00977 ConstFCPtr<BasePtrTypeT,
00978 FieldContainerTypeT>::ConstFCPtr(const ConstFCPtr &source) :
00979
00980 Inherited(source)
00981 {
00982 }
00983
00984
00985
00986
00987 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00988 ConstFCPtr<BasePtrTypeT, FieldContainerTypeT>::~ConstFCPtr(void)
00989 {
00990 }
00991
00992
00993
00994
00995 template <class BasePtrTypeT, class FieldContainerTypeT> inline
00996 const FieldContainerTypeT *ConstFCPtr<BasePtrTypeT,
00997 FieldContainerTypeT>::operator ->(void)
00998 {
00999 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
01000 return (const FieldContainerTypeT *) Self::getElemP(Thread::getAspect());
01001 #else
01002 return (const FieldContainerTypeT *) Self::getFirstElemP();
01003 #endif
01004 }
01005
01006 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01007 const FieldContainerTypeT *ConstFCPtr<BasePtrTypeT,
01008 FieldContainerTypeT>::operator ->(
01009 void) const
01010 {
01011 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
01012 return (const FieldContainerTypeT *) Self::getElemP(Thread::getAspect());
01013 #else
01014 return (const FieldContainerTypeT *) Self::getFirstElemP();
01015 #endif
01016 }
01017
01018 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01019 const FieldContainerTypeT &ConstFCPtr<BasePtrTypeT,
01020 FieldContainerTypeT>::operator *(void)
01021 {
01022 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
01023 return *((const FieldContainerTypeT *) Self::getElemP(Thread::getAspect()));
01024 #else
01025 return *((const FieldContainerTypeT *) Self::getFirstElemP());
01026 #endif
01027 }
01028
01029 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01030 const FieldContainerTypeT &ConstFCPtr<BasePtrTypeT,
01031 FieldContainerTypeT>::operator *(
01032 void) const
01033 {
01034 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
01035 return *((const FieldContainerTypeT *) Self::getElemP(Thread::getAspect()));
01036 #else
01037 return *((const FieldContainerTypeT *) Self::getFirstElemP());
01038 #endif
01039 }
01040
01041
01042 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01043 const FieldContainerTypeT *ConstFCPtr<BasePtrTypeT,
01044 FieldContainerTypeT>::getCPtr(void)
01045
01046 {
01047 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
01048 return (const FieldContainerTypeT *) Self::getElemP(Thread::getAspect());
01049 #else
01050 return (const FieldContainerTypeT *) Self::getFirstElemP();
01051 #endif
01052 }
01053
01054 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01055 const FieldContainerTypeT *
01056 ConstFCPtr<BasePtrTypeT, FieldContainerTypeT>::getCPtr(void) const
01057 {
01058 #if !defined(OSG_DEBUG_NO_FCPTR_ARITHM)
01059 return (const FieldContainerTypeT *) Self::getElemP(Thread::getAspect());
01060 #else
01061 return (const FieldContainerTypeT *) Self::getFirstElemP();
01062 #endif
01063 }
01064
01065
01066
01067
01068 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01069 void ConstFCPtr<BasePtrTypeT,
01070 FieldContainerTypeT>::operator = (const NCFCPtr &source)
01071 {
01072
01073 *(static_cast<Inherited *>(this)) = source;
01074 }
01075
01076 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01077 void ConstFCPtr<BasePtrTypeT,
01078 FieldContainerTypeT>::operator = (const ConstFCPtr &source)
01079 {
01080
01081 *(static_cast<Inherited *>(this)) = source;
01082 }
01083
01084 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01085 void ConstFCPtr<BasePtrTypeT, FieldContainerTypeT>::operator = (
01086 const NullFieldContainerPtr &)
01087 {
01088 Self::setNull();
01089 }
01090
01091
01092
01093
01094 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01095 ConstFCPtr<BasePtrTypeT,
01096 FieldContainerTypeT>::ConstFCPtr(const FieldContainerTypeT &source):
01097
01098 Inherited(source)
01099 {
01100 }
01101
01102 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01103 ConstFCPtr<BasePtrTypeT,
01104 FieldContainerTypeT>::ConstFCPtr(const FieldContainerTypeT *source):
01105
01106 Inherited(source)
01107 {
01108 }
01109
01110 template <class BasePtrTypeT, class FieldContainerTypeT> inline
01111 ConstFCPtr<BasePtrTypeT, FieldContainerTypeT>::ConstFCPtr(
01112 const FieldContainerTypeT *source,
01113 const UInt16 uiSize,
01114 const UInt16 uiParentEPos) :
01115
01116 Inherited(source, uiSize, uiParentEPos)
01117 {
01118 }
01119
01120 #if 0
01121 #ifdef __sgi
01122 #pragma set woff 1424
01123 #endif
01124
01125 template <class RetTypeT, class InTypeT> inline
01126 RetTypeT dcast(const InTypeT oIn)
01127 {
01128 return RetTypeT(
01129 (dynamic_cast<const typename RetTypeT::ObjectType *>(oIn.getCPtr())),
01130 oIn.getContainerSize,
01131 oIn.getParentFieldPos);
01132 }
01133
01134 template <class RetTypeT, class InTypeT> inline
01135 RetTypeT dyncast(const InTypeT oIn)
01136 {
01137 return RetTypeT(
01138 (dynamic_cast<const typename RetTypeT::ObjectType *>(oIn.getCPtr())),
01139 oIn._containerSize,
01140 oIn._uiParentEPos);
01141 }
01142
01143 #ifdef __sgi
01144 #pragma reset woff 1424
01145 #endif
01146 #endif
01147
01148 inline
01149 void FieldContainerPtrBase::executeSync(UInt32 uiFromAspect,
01150 UInt32 uiToAspect,
01151 BitVector whichField)
01152 {
01153 #if defined(OSG_FIXED_MFIELDSYNC)
01154 SyncInfo sInfo;
01155
01156 sInfo.syncMode = 0x0000;
01157 sInfo.uiSyncInfo = (uiFromAspect << 24) | (uiToAspect << 16);
01158 sInfo.uiCopyOffset = getContainerSize();
01159 #endif
01160
01161 FieldContainer *pTo = ((FieldContainer *) getElemP(uiToAspect));
01162
01163 #if !defined(OSG_FIXED_MFIELDSYNC)
01164 pTo->executeSync(*((FieldContainer *) getElemP(uiFromAspect)),
01165 whichField);
01166 #else
01167 pTo->executeSync(*((FieldContainer *) getElemP(uiFromAspect)),
01168 whichField,
01169 sInfo);
01170 #endif
01171
01172 pTo->changed(whichField, ChangedOrigin::Sync);
01173 }
01174
01175
01176 inline
01177 CPEditor::CPEditor(void) :
01178 _fc (NullFC),
01179 _mask( 0)
01180 {
01181 }
01182
01183 inline
01184 CPEditor::CPEditor(const FieldContainerPtr fc, const BitVector mask) :
01185 _fc (fc ),
01186 _mask(mask)
01187 {
01188 beginEditCP(fc, mask);
01189 }
01190
01191 inline
01192 CPEditor::~CPEditor()
01193 {
01194 if(_fc != NullFC)
01195 endEditCP(_fc, _mask);
01196 }
01197
01198 OSG_END_NAMESPACE
01199
01200 #define OSGFIELDCONTAINERPTR_INLINE_CVSID "@(#)$Id: $"
01201
01202 #endif