File indexing completed on 2024-04-28 05:32:12
0001 /* 0002 this file is part of the oxygen gtk engine 0003 SPDX-FileCopyrightText: 2012 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #include "oxygenobjectcounter.h" 0009 #include "oxygenobjectcountermap.h" 0010 0011 namespace Oxygen 0012 { 0013 //____________________________________________________________ 0014 ObjectCounter::ObjectCounter( const std::string& name ): 0015 count_( 0 ) 0016 { 0017 count_ = ObjectCounterMap::get().counter( name ); 0018 ObjectCounterMap::get().increment( *count_ ); 0019 return; 0020 } 0021 0022 //____________________________________________________________ 0023 ObjectCounter::ObjectCounter( const ObjectCounter& counter ): 0024 count_( counter.count_ ) 0025 { 0026 ObjectCounterMap::get().increment( *count_ ); 0027 return; 0028 } 0029 0030 //____________________________________________________________ 0031 ObjectCounter::~ObjectCounter( void ) 0032 { if( count_ ) ObjectCounterMap::get().decrement( *count_ ); } 0033 0034 //____________________________________________________________ 0035 int ObjectCounter::count( void ) const 0036 { return (count_) ? *count_:0; } 0037 0038 }