From 051c17a1847f524f1982c4c1ab2dad5ce75e5509 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 7 Mar 2017 04:02:06 +0100 Subject: [PATCH] Make reportStats const --- apps/openmw/mwrender/landmanager.cpp | 2 +- apps/openmw/mwrender/landmanager.hpp | 2 +- apps/openmw/mwrender/renderingmanager.cpp | 2 +- apps/openmw/mwrender/renderingmanager.hpp | 2 +- components/resource/bulletshapemanager.cpp | 2 +- components/resource/bulletshapemanager.hpp | 2 +- components/resource/imagemanager.cpp | 2 +- components/resource/imagemanager.hpp | 2 +- components/resource/keyframemanager.cpp | 2 +- components/resource/keyframemanager.hpp | 2 +- components/resource/niffilemanager.cpp | 2 +- components/resource/niffilemanager.hpp | 2 +- components/resource/resourcemanager.hpp | 2 +- components/resource/resourcesystem.cpp | 4 ++-- components/resource/resourcesystem.hpp | 2 +- components/resource/scenemanager.cpp | 2 +- components/resource/scenemanager.hpp | 4 ++-- components/terrain/chunkmanager.cpp | 2 +- components/terrain/chunkmanager.hpp | 2 +- components/terrain/texturemanager.cpp | 2 +- components/terrain/texturemanager.hpp | 2 +- 21 files changed, 23 insertions(+), 23 deletions(-) diff --git a/apps/openmw/mwrender/landmanager.cpp b/apps/openmw/mwrender/landmanager.cpp index 082a136d5..5edce2c3f 100644 --- a/apps/openmw/mwrender/landmanager.cpp +++ b/apps/openmw/mwrender/landmanager.cpp @@ -39,7 +39,7 @@ osg::ref_ptr LandManager::getLand(int x, int y) } } -void LandManager::reportStats(unsigned int frameNumber, osg::Stats *stats) +void LandManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { stats->setAttribute(frameNumber, "Land", mCache->getCacheSize()); } diff --git a/apps/openmw/mwrender/landmanager.hpp b/apps/openmw/mwrender/landmanager.hpp index 4fd05f064..392a8b406 100644 --- a/apps/openmw/mwrender/landmanager.hpp +++ b/apps/openmw/mwrender/landmanager.hpp @@ -22,7 +22,7 @@ namespace MWRender /// @note Will return NULL if not found. osg::ref_ptr getLand(int x, int y); - virtual void reportStats(unsigned int frameNumber, osg::Stats* stats); + virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) const; private: int mLoadFlags; diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 534030b43..a4236df3b 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -907,7 +907,7 @@ namespace MWRender mStateUpdater->setFogColor(color); } - void RenderingManager::reportStats() + void RenderingManager::reportStats() const { osg::Stats* stats = mViewer->getViewerStats(); unsigned int frameNumber = mViewer->getFrameStamp()->getFrameNumber(); diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index a1c962ff0..230fe3f7d 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -200,7 +200,7 @@ namespace MWRender void updateAmbient(); void setFogColor(const osg::Vec4f& color); - void reportStats(); + void reportStats() const; osg::ref_ptr mViewer; osg::ref_ptr mRootNode; diff --git a/components/resource/bulletshapemanager.cpp b/components/resource/bulletshapemanager.cpp index 18c37d97b..ef35b31ef 100644 --- a/components/resource/bulletshapemanager.cpp +++ b/components/resource/bulletshapemanager.cpp @@ -185,7 +185,7 @@ void BulletShapeManager::updateCache(double referenceTime) mInstanceCache->removeUnreferencedObjectsInCache(); } -void BulletShapeManager::reportStats(unsigned int frameNumber, osg::Stats *stats) +void BulletShapeManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { stats->setAttribute(frameNumber, "Shape", mCache->getCacheSize()); stats->setAttribute(frameNumber, "Shape Instance", mInstanceCache->getCacheSize()); diff --git a/components/resource/bulletshapemanager.hpp b/components/resource/bulletshapemanager.hpp index e6dba001c..fec7251ac 100644 --- a/components/resource/bulletshapemanager.hpp +++ b/components/resource/bulletshapemanager.hpp @@ -42,7 +42,7 @@ namespace Resource /// @see ResourceManager::updateCache virtual void updateCache(double referenceTime); - void reportStats(unsigned int frameNumber, osg::Stats *stats); + void reportStats(unsigned int frameNumber, osg::Stats *stats) const; private: osg::ref_ptr createInstance(const std::string& name); diff --git a/components/resource/imagemanager.cpp b/components/resource/imagemanager.cpp index 2e1422cf6..db47324fb 100644 --- a/components/resource/imagemanager.cpp +++ b/components/resource/imagemanager.cpp @@ -141,7 +141,7 @@ namespace Resource return mWarningImage; } - void ImageManager::reportStats(unsigned int frameNumber, osg::Stats *stats) + void ImageManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { stats->setAttribute(frameNumber, "Image", mCache->getCacheSize()); } diff --git a/components/resource/imagemanager.hpp b/components/resource/imagemanager.hpp index 2c7a61828..8eea4a70b 100644 --- a/components/resource/imagemanager.hpp +++ b/components/resource/imagemanager.hpp @@ -32,7 +32,7 @@ namespace Resource osg::Image* getWarningImage(); - void reportStats(unsigned int frameNumber, osg::Stats* stats); + void reportStats(unsigned int frameNumber, osg::Stats* stats) const; private: osg::ref_ptr mWarningImage; diff --git a/components/resource/keyframemanager.cpp b/components/resource/keyframemanager.cpp index 699fdfdd6..8c5c50adc 100644 --- a/components/resource/keyframemanager.cpp +++ b/components/resource/keyframemanager.cpp @@ -34,7 +34,7 @@ namespace Resource } } - void KeyframeManager::reportStats(unsigned int frameNumber, osg::Stats *stats) + void KeyframeManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { stats->setAttribute(frameNumber, "Keyframe", mCache->getCacheSize()); } diff --git a/components/resource/keyframemanager.hpp b/components/resource/keyframemanager.hpp index a5c1a7818..3496342fa 100644 --- a/components/resource/keyframemanager.hpp +++ b/components/resource/keyframemanager.hpp @@ -23,7 +23,7 @@ namespace Resource /// @note Throws an exception if the resource is not found. osg::ref_ptr get(const std::string& name); - void reportStats(unsigned int frameNumber, osg::Stats* stats); + void reportStats(unsigned int frameNumber, osg::Stats* stats) const; }; } diff --git a/components/resource/niffilemanager.cpp b/components/resource/niffilemanager.cpp index dcc222ed1..8d932ca64 100644 --- a/components/resource/niffilemanager.cpp +++ b/components/resource/niffilemanager.cpp @@ -56,7 +56,7 @@ namespace Resource } } - void NifFileManager::reportStats(unsigned int frameNumber, osg::Stats *stats) + void NifFileManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { stats->setAttribute(frameNumber, "Nif", mCache->getCacheSize()); } diff --git a/components/resource/niffilemanager.hpp b/components/resource/niffilemanager.hpp index 378daabf7..c783bb7e0 100644 --- a/components/resource/niffilemanager.hpp +++ b/components/resource/niffilemanager.hpp @@ -23,7 +23,7 @@ namespace Resource /// to be done in advance by other managers accessing the NifFileManager. Nif::NIFFilePtr get(const std::string& name); - void reportStats(unsigned int frameNumber, osg::Stats *stats); + void reportStats(unsigned int frameNumber, osg::Stats *stats) const; }; } diff --git a/components/resource/resourcemanager.hpp b/components/resource/resourcemanager.hpp index f07ac6f77..61599cd5e 100644 --- a/components/resource/resourcemanager.hpp +++ b/components/resource/resourcemanager.hpp @@ -33,7 +33,7 @@ namespace Resource const VFS::Manager* getVFS() const; - virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) {} + virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) const {} protected: const VFS::Manager* mVFS; diff --git a/components/resource/resourcesystem.cpp b/components/resource/resourcesystem.cpp index 091614a10..19b280ff1 100644 --- a/components/resource/resourcesystem.cpp +++ b/components/resource/resourcesystem.cpp @@ -85,9 +85,9 @@ namespace Resource return mVFS; } - void ResourceSystem::reportStats(unsigned int frameNumber, osg::Stats *stats) + void ResourceSystem::reportStats(unsigned int frameNumber, osg::Stats *stats) const { - for (std::vector::iterator it = mResourceManagers.begin(); it != mResourceManagers.end(); ++it) + for (std::vector::const_iterator it = mResourceManagers.begin(); it != mResourceManagers.end(); ++it) (*it)->reportStats(frameNumber, stats); } diff --git a/components/resource/resourcesystem.hpp b/components/resource/resourcesystem.hpp index 71541ade5..6e308fd9b 100644 --- a/components/resource/resourcesystem.hpp +++ b/components/resource/resourcesystem.hpp @@ -54,7 +54,7 @@ namespace Resource /// @note May be called from any thread. const VFS::Manager* getVFS() const; - void reportStats(unsigned int frameNumber, osg::Stats* stats); + void reportStats(unsigned int frameNumber, osg::Stats* stats) const; private: std::auto_ptr mSceneManager; diff --git a/components/resource/scenemanager.cpp b/components/resource/scenemanager.cpp index da8ba180e..167ab6221 100644 --- a/components/resource/scenemanager.cpp +++ b/components/resource/scenemanager.cpp @@ -703,7 +703,7 @@ namespace Resource mSharedStateMutex.unlock(); } - void SceneManager::reportStats(unsigned int frameNumber, osg::Stats *stats) + void SceneManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { { OpenThreads::ScopedLock lock(*mIncrementalCompileOperation->getToCompiledMutex()); diff --git a/components/resource/scenemanager.hpp b/components/resource/scenemanager.hpp index 3ed7d1bd3..2da28eaf4 100644 --- a/components/resource/scenemanager.hpp +++ b/components/resource/scenemanager.hpp @@ -143,7 +143,7 @@ namespace Resource /// @see ResourceManager::updateCache virtual void updateCache(double referenceTime); - virtual void reportStats(unsigned int frameNumber, osg::Stats* stats); + virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) const; private: @@ -160,7 +160,7 @@ namespace Resource osg::ref_ptr mInstanceCache; osg::ref_ptr mSharedStateManager; - OpenThreads::Mutex mSharedStateMutex; + mutable OpenThreads::Mutex mSharedStateMutex; Resource::ImageManager* mImageManager; Resource::NifFileManager* mNifFileManager; diff --git a/components/terrain/chunkmanager.cpp b/components/terrain/chunkmanager.cpp index 96bea517b..ccd4d6a3a 100644 --- a/components/terrain/chunkmanager.cpp +++ b/components/terrain/chunkmanager.cpp @@ -71,7 +71,7 @@ void ChunkManager::setShaderManager(Shader::ShaderManager *shaderManager) mShaderManager = shaderManager; } -void ChunkManager::reportStats(unsigned int frameNumber, osg::Stats *stats) +void ChunkManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { stats->setAttribute(frameNumber, "Terrain Chunk", mCache->getCacheSize()); } diff --git a/components/terrain/chunkmanager.hpp b/components/terrain/chunkmanager.hpp index 4bb4c5432..d7f9901c8 100644 --- a/components/terrain/chunkmanager.hpp +++ b/components/terrain/chunkmanager.hpp @@ -42,7 +42,7 @@ namespace Terrain // Optional void setShaderManager(Shader::ShaderManager* shaderManager); - virtual void reportStats(unsigned int frameNumber, osg::Stats* stats); + virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) const; private: osg::ref_ptr createChunk(float size, const osg::Vec2f& center); diff --git a/components/terrain/texturemanager.cpp b/components/terrain/texturemanager.cpp index dd1e87bf6..b901fa159 100644 --- a/components/terrain/texturemanager.cpp +++ b/components/terrain/texturemanager.cpp @@ -54,7 +54,7 @@ osg::ref_ptr TextureManager::getTexture(const std::string &name) } } -void TextureManager::reportStats(unsigned int frameNumber, osg::Stats *stats) +void TextureManager::reportStats(unsigned int frameNumber, osg::Stats *stats) const { stats->setAttribute(frameNumber, "Terrain Texture", mCache->getCacheSize()); } diff --git a/components/terrain/texturemanager.hpp b/components/terrain/texturemanager.hpp index 9aba2f092..e1205606e 100644 --- a/components/terrain/texturemanager.hpp +++ b/components/terrain/texturemanager.hpp @@ -27,7 +27,7 @@ namespace Terrain osg::ref_ptr getTexture(const std::string& name); - virtual void reportStats(unsigned int frameNumber, osg::Stats* stats); + virtual void reportStats(unsigned int frameNumber, osg::Stats* stats) const; private: Resource::SceneManager* mSceneManager;