Colobot
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Pages
src
common
iman.h
Go to the documentation of this file.
1
// * This file is part of the COLOBOT source code
2
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3
// *
4
// * This program is free software: you can redistribute it and/or modify
5
// * it under the terms of the GNU General Public License as published by
6
// * the Free Software Foundation, either version 3 of the License, or
7
// * (at your option) any later version.
8
// *
9
// * This program is distributed in the hope that it will be useful,
10
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// * GNU General Public License for more details.
13
// *
14
// * You should have received a copy of the GNU General Public License
15
// * along with this program. If not, see http://www.gnu.org/licenses/.
16
22
#pragma once
23
24
25
#include "
common/singleton.h
"
26
27
33
/*
34
* TODO: Non-unique classes have already been removed.
35
* The other class instances along with CInstanceManager will be removed in due course.
36
*/
37
enum
ManagedClassType
38
{
40
CLASS_OBJECT
= 0,
42
CLASS_PHYSICS
= 1,
44
CLASS_BRAIN
= 2,
46
CLASS_PYRO
= 3,
47
49
CLASS_MAX
= 4
50
};
51
52
57
struct
ManagedClassInstances
58
{
59
int
maxCount;
60
int
usedCount;
61
void
** instances;
62
};
63
71
class
CInstanceManager
:
public
CSingleton
<CInstanceManager>
72
{
73
public
:
74
CInstanceManager
();
75
virtual
~
CInstanceManager
();
76
78
void
Flush
();
80
void
Flush
(
ManagedClassType
classType);
82
bool
AddInstance
(
ManagedClassType
classType,
void
* instance,
int
max=1);
84
bool
DeleteInstance
(
ManagedClassType
classType,
void
* instance);
86
void
*
SearchInstance
(
ManagedClassType
classType,
int
rank=0);
87
88
protected
:
90
void
Compress
(
ManagedClassType
classType);
91
92
protected
:
93
ManagedClassInstances
m_table[
CLASS_MAX
];
94
};
95
Generated on Sat Jul 5 2014 09:25:02 for Colobot by
1.8.1.2