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 _OSGFIELDCONTAINERFUNCSIMPL_INL_
00040 #define _OSGFIELDCONTAINERFUNCSIMPL_INL_
00041
00042 #ifdef OSG_DOC_FILES_IN_MODULE
00043
00047 #endif
00048
00049 OSG_BEGIN_NAMESPACE
00050
00051
00052
00053
00054 #ifndef OSG_INVALID_PTR_CHECK
00055
00056 inline
00057 void addRefCP(const FieldContainerPtrBase &objectP)
00058 {
00059 if(objectP != NullFC)
00060 objectP.addRef();
00061 }
00062
00063 #else
00064
00065 inline
00066 bool safeAddRefCP(const FieldContainerPtrBase &objectP)
00067 {
00068 if(objectP != NullFC)
00069 {
00070 UInt32 id = objectP.getFieldContainerId();
00071 if(FieldContainerFactory::the()->getContainer(id) != NullFC)
00072 objectP.addRef();
00073 else
00074 return false;
00075 }
00076 return true;
00077 }
00078
00079 #endif
00080
00081 #ifndef OSG_INVALID_PTR_CHECK
00082
00083 inline
00084 void subRefCP(const FieldContainerPtrBase &objectP)
00085 {
00086 if(objectP != NullFC)
00087 objectP.subRef();
00088 }
00089
00090 #else
00091
00092 inline
00093 bool safeSubRefCP(const FieldContainerPtrBase &objectP)
00094 {
00095 if(objectP != NullFC)
00096 {
00097 UInt32 id = objectP.getFieldContainerId();
00098 if(FieldContainerFactory::the()->getContainer(id) != NullFC)
00099 objectP.subRef();
00100 else
00101 return false;
00102 }
00103 return true;
00104 }
00105
00106 #endif
00107
00108 #ifndef OSG_INVALID_PTR_CHECK
00109
00110 inline
00111 void clearRefCP(FieldContainerPtrBase &objectP)
00112 {
00113 if(objectP != NullFC)
00114 objectP.subRef();
00115
00116 objectP = NullFC;
00117 }
00118
00119 #else
00120
00121 inline
00122 bool safeClearRefCP(FieldContainerPtrBase &objectP)
00123 {
00124 if(objectP != NullFC)
00125 {
00126 UInt32 id = objectP.getFieldContainerId();
00127 if(FieldContainerFactory::the()->getContainer(id) != NullFC)
00128 objectP.subRef();
00129 else
00130 return false;
00131 }
00132 objectP = NullFC;
00133 return true;
00134 }
00135
00136 #endif
00137
00138 #ifndef OSG_INVALID_PTR_CHECK
00139
00140 inline
00141 void setRefdCP( FieldContainerPtrBase &objectP,
00142 const FieldContainerPtrBase &newObjectP)
00143 {
00144 if(objectP != newObjectP)
00145 {
00146 if(objectP != NullFC)
00147 objectP.subRef();
00148
00149 objectP = newObjectP;
00150
00151 if(objectP != NullFC)
00152 objectP.addRef();
00153 }
00154 }
00155
00156 #else
00157
00158 inline
00159 bool safeSetRefdCP( FieldContainerPtrBase &objectP,
00160 const FieldContainerPtrBase &newObjectP)
00161 {
00162 if(objectP != newObjectP)
00163 {
00164 if(objectP != NullFC)
00165 {
00166 UInt32 id = objectP.getFieldContainerId();
00167 if(FieldContainerFactory::the()->getContainer(id) != NullFC)
00168 objectP.subRef();
00169 else
00170 return false;
00171 }
00172
00173 objectP = newObjectP;
00174
00175 if(objectP != NullFC)
00176 {
00177 UInt32 id = objectP.getFieldContainerId();
00178 if(FieldContainerFactory::the()->getContainer(id) != NullFC)
00179 objectP.addRef();
00180 else
00181 return false;
00182 }
00183 }
00184 return true;
00185 }
00186
00187 #endif
00188
00189 inline
00190 void beginEditCP(const FieldContainerPtr &objectP,
00191 BitVector whichField,
00192 UInt32 origin )
00193 {
00194 if(objectP != NullFC)
00195 objectP.beginEdit(whichField, origin);
00196 }
00197
00198 inline
00199 void endEditCP(const FieldContainerPtr &objectP,
00200 BitVector whichField,
00201 UInt32 origin )
00202 {
00203 if(objectP != NullFC)
00204 objectP.endEdit(whichField, origin);
00205 }
00206
00207 inline
00208 void changedCP(const FieldContainerPtr &objectP,
00209 BitVector whichField,
00210 UInt32 origin )
00211 {
00212 if(objectP != NullFC)
00213 objectP.changed(whichField, origin);
00214 }
00215
00216 inline
00217 void endEditNotChangedCP(const FieldContainerPtr &objectP,
00218 BitVector whichField,
00219 UInt32 origin )
00220 {
00221 if(objectP != NullFC)
00222 objectP.endEditNotChanged(whichField, origin);
00223 }
00224
00225 OSG_END_NAMESPACE
00226
00227 #define OSGFIELDCONTAINERFUNCS_INLINE_CVSID "@(#)$Id: $"
00228
00229 #endif