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