Changeset 13041 for OpenSceneGraph/trunk/src/osg/Stats.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osg/Stats.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osg/Stats.cpp
r12056 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2007 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 49 49 if (frameNumber>_latestFrameNumber) 50 50 { 51 // need to advance 52 51 // need to advance 52 53 53 // first clear the entries up to and including the new frameNumber 54 54 for(unsigned int i = _latestFrameNumber+1; i<= frameNumber; ++i) … … 57 57 _attributeMapList[index].clear(); 58 58 } 59 59 60 60 if ( (frameNumber-_baseFrameNumber) >= static_cast<unsigned int>(_attributeMapList.size())) 61 61 { 62 62 _baseFrameNumber = (frameNumber/_attributeMapList.size())*_attributeMapList.size(); 63 63 } 64 64 65 65 _latestFrameNumber = frameNumber; 66 66 67 67 } 68 68 69 69 int index = getIndex(frameNumber); 70 if (index<0) 70 if (index<0) 71 71 { 72 72 OSG_NOTICE<<"Failed to assing valid index for Stats::setAttribute("<<frameNumber<<","<<attributeName<<","<<value<<")"<<std::endl; 73 73 return false; 74 74 } 75 75 76 76 AttributeMap& attributeMap = _attributeMapList[index]; 77 77 attributeMap[attributeName] = value; … … 84 84 int index = getIndex(frameNumber); 85 85 if (index<0) return false; 86 86 87 87 const AttributeMap& attributeMap = _attributeMapList[index]; 88 88 AttributeMap::const_iterator itr = attributeMap.find(attributeName); 89 89 if (itr == attributeMap.end()) return false; 90 90 91 value = itr->second; 91 value = itr->second; 92 92 return true; 93 93 } … … 104 104 std::swap(endFrameNumber, startFrameNumber); 105 105 } 106 106 107 107 OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex); 108 108 … … 132 132 int index = getIndex(frameNumber); 133 133 if (index<0) return _invalidAttributeMap; 134 134 135 135 return _attributeMapList[index]; 136 136 } … … 140 140 int index = getIndex(frameNumber); 141 141 if (index<0) return _invalidAttributeMap; 142 142 143 143 return _attributeMapList[index]; 144 144 }
