/*
* refcounted.h
*
* Copyright (c) 2003 Frerich Raabe <raabe@kde.org>
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the
* accompanying file 'COPYING'.
*/
#ifndef BARRY_REFCOUNTED_H
#define BARRY_REFCOUNTED_H
namespace Barry
{
class RefCounted
{
public:
RefCounted() : m_count( 1 ) { }
void ref() { ++m_count; }
bool deref() { return !--m_count; }
unsigned int count() const { return m_count; }
private:
unsigned int m_count;
};
}
#endif // BARRY_REFCOUNTED_H
// vim:ts=4:sw=4:noet:list
syntax highlighted by Code2HTML, v. 0.9.1