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

OSGFieldContainerPtr.cpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000-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 //---------------------------------------------------------------------------
00040 //  Includes
00041 //---------------------------------------------------------------------------
00042 
00043 #include <stdlib.h>
00044 #include <stdio.h>
00045 
00046 #include "OSGConfig.h"
00047 
00048 #include <iostream>
00049 
00050 #include "OSGFieldContainerBase.h"
00051 #include "OSGFieldContainerPtr.h"
00052 
00053 #if defined(OSG_GV_BETA) && defined(OSG_DBG_MEM)
00054 #include "OSGTime.h"
00055 #endif
00056 
00057 OSG_USING_NAMESPACE
00058 
00059 #ifdef OSG_DOC_FILES_IN_MODULE
00060 
00063 #endif
00064 
00065 OSG_BEGIN_NAMESPACE
00066 const NullFieldContainerPtr NullFC;
00067 OSG_END_NAMESPACE
00068 
00069 //---------------------------------------------------------------------------
00070 //  Class
00071 //---------------------------------------------------------------------------
00072 
00073 const UInt16    FieldContainerPtrBase::InvalidParentEPos = 0xFFFF;
00074 
00075       LockPool *FieldContainerPtrBase::_pRefCountLock    = NULL;
00076 
00077 
00078 
00079 /*-------------------------------------------------------------------------*/
00080 /*                                Dump                                     */
00081 
00082 void FieldContainerPtrBase::dump(      UInt32    uiIndent,
00083                                  const BitVector bvFlags) const
00084 {
00085     if(this != NULL && _storeP != NULL)
00086     {
00087         indentLog(uiIndent, PLOG);
00088         PLOG << "FCPtr Dump :" << std::endl;
00089 
00090         uiIndent += 4;
00091 
00092         indentLog(uiIndent, PLOG);
00093         PLOG << "Id       : " << std::dec << (*(getIdP())) << std::endl;
00094 
00095         indentLog(uiIndent, PLOG);
00096         PLOG << "Storage  : " 
00097              << std::hex << (UInt32 *)getFirstElemP() 
00098              << std::endl;
00099 
00100         if(bvFlags & FCDumpFlags::RefCount)
00101         {
00102              indentLog(uiIndent, PLOG);
00103              PLOG << "RefCount : " << *(getRefCountP()) << std::endl;
00104         }
00105 
00106 //        dumpContent();
00107     }
00108     else
00109     {
00110         PLOG << "FCPtr Dump : (NULL)" << std::endl;
00111     }
00112 }
00113 
00114 /*-------------------------------------------------------------------------*/
00115 /*                                Init                                     */
00116 
00117 bool FieldContainerPtrBase::initialize(void)
00118 {
00119     bool           returnValue = false;
00120     ThreadManager *pManager    = ThreadManager::the();
00121 
00122     SINFO << "OSGFieldContainerPtrBase init" << std::endl;
00123 
00124     if(pManager != NULL)
00125     {
00126         _pRefCountLock = pManager->getLockPool("DSPTRRefCountLockPool");
00127 
00128         addRefP(_pRefCountLock);
00129 
00130         if(_pRefCountLock != NULL)
00131             returnValue = true;
00132     }
00133 
00134     return returnValue;
00135 }
00136 
00137 bool FieldContainerPtrBase::terminate(void)
00138 {
00139     ThreadManager *pManager = ThreadManager::the();
00140 
00141     SINFO << "OSGFieldContainerPtrBase terminate" << std::endl;
00142 
00143     if(pManager == NULL)
00144         return false;
00145 
00146     subRefP(_pRefCountLock);
00147 
00148     return true;
00149 }
00150 
00151 
00152 /*-------------------------------------------------------------------------*/
00153 /*                               Functions                                 */
00154 
00155 OSG_SYSTEMLIB_DLLMAPPING
00156 std::ostream &OSG::operator <<(      std::ostream       &os,
00157                                const FieldContainerPtr  &fc)
00158 {
00159     if(fc == NullFC)
00160     {
00161         os << std::hex 
00162            << "FieldContainerPtr 0x" 
00163            << &fc 
00164            << std::dec 
00165            << ":NullFC";
00166     }
00167     else
00168     {
00169         os << std::hex << "FieldContainerPtr 0x"
00170            << &fc << std::dec << ":" << fc->getType().getName() << "Ptr(0x"
00171            << std::hex << (&(*fc)) << std::dec << ")";
00172     }
00173 
00174     return os;
00175 }
00176 
00177 /*-------------------------------------------------------------------------*/
00178 /*                              cvs id's                                   */
00179 
00180 #ifdef __sgi
00181 #pragma set woff 1174
00182 #endif
00183 
00184 #ifdef OSG_LINUX_ICC
00185 #pragma warning( disable : 177 )
00186 #endif
00187 
00188 namespace
00189 {
00190     static Char8 cvsid_cpp[] = "@(#)$Id: $";
00191     static Char8 cvsid_hpp[] = OSGFIELDCONTAINERPTR_HEADER_CVSID;
00192     static Char8 cvsid_inl[] = OSGFIELDCONTAINERPTR_INLINE_CVSID;
00193 }

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