ManaPlus
resource.h
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2017 The ManaPlus Developers
6  *
7  * This file is part of The ManaPlus Client.
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef RESOURCES_RESOURCE_H
24 #define RESOURCES_RESOURCE_H
25 
27 
28 #include "localconsts.h"
29 
34 {
35  public:
40  MemoryCounter(),
41  mTimeStamp(0),
42  mIdPath(),
43  mSource(),
44  mRefCount(0),
45  mProtected(false),
46 #ifdef DEBUG_DUMP_LEAKS
47  mNotCount(false),
48  mDumped(false)
49 #else // DEBUG_DUMP_LEAKS
50  mNotCount(false)
51 #endif // DEBUG_DUMP_LEAKS
52  {
53  }
54 
56 
57 
60  virtual ~Resource();
61 
65  virtual void incRef();
66 
74  virtual void decRef();
75 
76  int calcMemoryLocal() const override;
77 
78  std::string getCounterName() const override
79  { return mIdPath + "-" + mSource; }
80 
81  time_t mTimeStamp;
83  std::string mIdPath;
84  std::string mSource;
85 
86  unsigned int mRefCount;
87  bool mProtected;
88  bool mNotCount;
89 
90 #ifdef DEBUG_DUMP_LEAKS
91  bool mDumped;
92 #endif // DEBUG_DUMP_LEAKS
93 };
94 
95 #endif // RESOURCES_RESOURCE_H
#define A_DELETE_COPY(func)
Definition: localconsts.h:52
std::string mSource
Definition: resource.h:84
Resource()
Definition: resource.h:39
bool mNotCount
Definition: resource.h:88
virtual ~Resource()
Definition: resource.cpp:33
virtual void decRef()
Definition: resource.cpp:49
int calcMemoryLocal() const
Definition: resource.cpp:75
unsigned int mRefCount
Definition: resource.h:86
time_t mTimeStamp
Definition: resource.h:81
bool mProtected
Definition: resource.h:87
#define notfinal
Definition: localconsts.h:289
std::string getCounterName() const
Definition: resource.h:78
virtual void incRef()
Definition: resource.cpp:37
std::string mIdPath
Definition: resource.h:83