fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / State / Base / OSGState.inl
blob7380f06f6707836d4c2b4ab1c71c82027190f5c3
1 /*---------------------------------------------------------------------------*\
2  *                                OpenSG                                     *
3  *                                                                           *
4  *                                                                           *
5  *                     Copyright 2000-2002 by OpenSG Forum                   *
6  *                                                                           *
7  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
8  *                                                                           *
9 \*---------------------------------------------------------------------------*/
10 /*---------------------------------------------------------------------------*\
11  *                                License                                    *
12  *                                                                           *
13  * This library is free software; you can redistribute it and/or modify it   *
14  * under the terms of the GNU Library General Public License as published    *
15  * by the Free Software Foundation, version 2.                               *
16  *                                                                           *
17  * This library is distributed in the hope that it will be useful, but       *
18  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
20  * Library General Public License for more details.                          *
21  *                                                                           *
22  * You should have received a copy of the GNU Library General Public         *
23  * License along with this library; if not, write to the Free Software       *
24  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
25  *                                                                           *
26 \*---------------------------------------------------------------------------*/
27 /*---------------------------------------------------------------------------*\
28  *                                Changes                                    *
29  *                                                                           *
30  *                                                                           *
31  *                                                                           *
32  *                                                                           *
33  *                                                                           *
34  *                                                                           *
35 \*---------------------------------------------------------------------------*/
37 OSG_BEGIN_NAMESPACE
39 /*! Return the chunk with the given id. Returns NullFC if no such chunk is in
40    the State. 
43 inline
44 StateChunk * State::getChunk(UInt32 chunkId) const
46     if(chunkId < _mfChunks.size())
47         return _mfChunks[chunkId];
49     return NULL;
52 /*! Checks if a chunk with the given id is in the current state. 
55 inline
56 bool State::chunkPresent(UInt32 chunkId) const
58     return (chunkId < _mfChunks.size() && _mfChunks[chunkId] != NULL);
61 /*! Checks if a chunk of the same type like the given one is in the current 
62     state. 
65 inline
66 bool State::chunkPresent(StateChunk *chunk) const
68     const StateChunkClass * cls = chunk->getClass();
69     
70     for(UInt16 i = 0; i < cls->getNumSlots(); ++i)
71     {
72         if(chunkPresent(cls->getId() + i))
73             return true;
74     }
75     
76     return false;
79 inline
80 void State::setCoreGLChunkLimit(UInt32 uiCoreGLChunkLimit)
82     _uiCoreGLChunkLimit = uiCoreGLChunkLimit;
85 inline
86 UInt32 State::getCoreGLChunkLimit(void)
88     return _uiCoreGLChunkLimit;
91 inline
92 void State::setDefaultSortKey(UInt32 uiSortKey)
94     _uiDefaultSortKey = (uiSortKey | DefaultKeyMask);
97 inline
98 UInt32 State::getSortKey(UInt32 uiKeyGen)
100     if(_uiKeyGen != uiKeyGen && uiKeyGen < SkipRebuild)
101     {
102         _uiKeyGen = uiKeyGen;
104         rebuildSortKey();
105     }
107     return _uiSortKey;
110 inline
111 const MFUnrecStateChunkPtr *State::getMFChunks(void) const
113     return &_mfChunks;
116 OSG_END_NAMESPACE