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

OSGFieldContainerPtrFuncsImpl.inl

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *           Copyright (C) 2000-2002,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 _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 /*                               Functions                                 */
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 /* _OSGFIELDCONTAINREFUNCSIMPL_INL_ */

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