Object::Object(void)
{
#ifdef _DEBUG
- boost::mutex::scoped_lock lock(GetMutex());
- GetAliveObjects().insert(this);
+ boost::mutex::scoped_lock lock(*GetMutex());
+ GetAliveObjects()->insert(this);
#endif /* _DEBUG */
}
Object::~Object(void)
{
#ifdef _DEBUG
- boost::mutex::scoped_lock lock(GetMutex());
- GetAliveObjects().erase(this);
+ boost::mutex::scoped_lock lock(*GetMutex());
+ GetAliveObjects()->erase(this);
#endif /* _DEBUG */
}
*/
void Object::Hold(void)
{
- boost::mutex::scoped_lock lock(GetMutex());
+ boost::mutex::scoped_lock lock(*GetMutex());
GetHeldObjects().push_back(GetSelf());
}
*/
void Object::ClearHeldObjects(void)
{
- boost::mutex::scoped_lock lock(GetMutex());
+ boost::mutex::scoped_lock lock(*GetMutex());
GetHeldObjects().clear();
}
*/
int Object::GetAliveObjectsCount(void)
{
- boost::mutex::scoped_lock lock(GetMutex());
- return GetAliveObjects().size();
+ boost::mutex::scoped_lock lock(*GetMutex());
+ return GetAliveObjects()->size();
}
/**
ofstream dictfp("dictionaries.dump.tmp");
{
- boost::mutex::scoped_lock lock(GetMutex());
+ boost::mutex::scoped_lock lock(*GetMutex());
set<Object *>::iterator it;
- BOOST_FOREACH(Object *obj, GetAliveObjects()) {
+ BOOST_FOREACH(Object *obj, *GetAliveObjects()) {
pair<map<String, int>::iterator, bool> tt;
tt = types.insert(make_pair(Utility::GetTypeName(typeid(*obj)), 1));
if (!tt.second)
*
* @returns currently active objects
*/
-set<Object *>& Object::GetAliveObjects(void)
+set<Object *> *Object::GetAliveObjects(void)
{
- static set<Object *> aliveObjects;
+ static set<Object *> *aliveObjects = new set<Object *>();
return aliveObjects;
}
#endif /* _DEBUG */
*
* @returns a mutex
*/
-boost::mutex& Object::GetMutex(void)
+boost::mutex *Object::GetMutex(void)
{
- static boost::mutex mutex;
+ static boost::mutex *mutex = new boost::mutex();
return mutex;
}
Object(const Object& other);
Object& operator=(const Object& rhs);
- static boost::mutex& GetMutex(void);
- static set<Object *>& GetAliveObjects(void);
+ static boost::mutex *GetMutex(void);
+ static set<Object *> *GetAliveObjects(void);
static vector<Object::Ptr>& GetHeldObjects(void);
};