Skip to content
Snippets Groups Projects
Commit 2506fd78 authored by Nat Goodspeed's avatar Nat Goodspeed
Browse files

DRTVWR-494: Move LL_ERRS out of llinstancetracker.h header file.

Add a namespaced free function in .cpp file to report LL_ERRS as needed.

Per code review, use a more indicative namespace name.
parent ba8fe9b4
No related branches found
No related tags found
No related merge requests found
...@@ -27,12 +27,15 @@ ...@@ -27,12 +27,15 @@
#include "linden_common.h" #include "linden_common.h"
// associated header // associated header
#include "llinstancetracker.h" #include "llinstancetracker.h"
#include "llapr.h" #include "llerror.h"
// STL headers // STL headers
// std headers // std headers
// external library headers // external library headers
// other Linden headers // other Linden headers
// This .cpp file is required by our CMake test macro. It contributes no code void LLInstanceTrackerPrivate::logerrs(const char* cls, const std::string& arg1,
// to the viewer. const std::string& arg2, const std::string& arg3)
{
LL_ERRS("LLInstanceTracker") << LLError::Log::demangle(cls)
<< arg1 << arg2 << arg3 << LL_ENDL;
}
...@@ -42,18 +42,21 @@ ...@@ -42,18 +42,21 @@
#include <boost/iterator/filter_iterator.hpp> #include <boost/iterator/filter_iterator.hpp>
#include "lockstatic.h" #include "lockstatic.h"
#include "stringize.h"
/***************************************************************************** /*****************************************************************************
* StaticBase * StaticBase
*****************************************************************************/ *****************************************************************************/
namespace LLInstanceTrackerStuff namespace LLInstanceTrackerPrivate
{ {
struct StaticBase struct StaticBase
{ {
// We need to be able to lock static data while manipulating it. // We need to be able to lock static data while manipulating it.
std::mutex mMutex; std::mutex mMutex;
}; };
} // namespace LLInstanceTrackerStuff
void logerrs(const char* cls, const std::string&, const std::string&, const std::string&);
} // namespace LLInstanceTrackerPrivate
/***************************************************************************** /*****************************************************************************
* LLInstanceTracker with key * LLInstanceTracker with key
...@@ -73,7 +76,7 @@ template<typename T, typename KEY = void, ...@@ -73,7 +76,7 @@ template<typename T, typename KEY = void,
class LLInstanceTracker class LLInstanceTracker
{ {
typedef std::map<KEY, std::shared_ptr<T>> InstanceMap; typedef std::map<KEY, std::shared_ptr<T>> InstanceMap;
struct StaticData: public LLInstanceTrackerStuff::StaticBase struct StaticData: public LLInstanceTrackerPrivate::StaticBase
{ {
InstanceMap mMap; InstanceMap mMap;
}; };
...@@ -232,7 +235,7 @@ class LLInstanceTracker ...@@ -232,7 +235,7 @@ class LLInstanceTracker
// for logging // for logging
template <typename K> template <typename K>
static K report(K key) { return key; } static std::string report(K key) { return stringize(key); }
static std::string report(const std::string& key) { return "'" + key + "'"; } static std::string report(const std::string& key) { return "'" + key + "'"; }
static std::string report(const char* key) { return report(std::string(key)); } static std::string report(const char* key) { return report(std::string(key)); }
...@@ -249,8 +252,8 @@ class LLInstanceTracker ...@@ -249,8 +252,8 @@ class LLInstanceTracker
auto pair = map.emplace(key, ptr); auto pair = map.emplace(key, ptr);
if (! pair.second) if (! pair.second)
{ {
LL_ERRS("LLInstanceTracker") << "Instance with key " << report(key) LLInstanceTrackerPrivate::logerrs(typeid(*this).name(), " instance with key ",
<< " already exists!" << LL_ENDL; report(key), " already exists!");
} }
break; break;
} }
...@@ -299,7 +302,7 @@ template<typename T, EInstanceTrackerAllowKeyCollisions KEY_COLLISION_BEHAVIOR> ...@@ -299,7 +302,7 @@ template<typename T, EInstanceTrackerAllowKeyCollisions KEY_COLLISION_BEHAVIOR>
class LLInstanceTracker<T, void, KEY_COLLISION_BEHAVIOR> class LLInstanceTracker<T, void, KEY_COLLISION_BEHAVIOR>
{ {
typedef std::set<std::shared_ptr<T>> InstanceSet; typedef std::set<std::shared_ptr<T>> InstanceSet;
struct StaticData: public LLInstanceTrackerStuff::StaticBase struct StaticData: public LLInstanceTrackerPrivate::StaticBase
{ {
InstanceSet mSet; InstanceSet mSet;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment