Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
InstanciatedObject.h
1
#if !defined(CINSTANCIATEDOBJECT_H)
2
#define CINSTANCIATEDOBJECT_H
3
4
#ifdef _MSC_VER
5
#pragma once
6
#endif
// _MSC_VER
7
8
BEGIN_MOOTOOLS_NAMESPACE
9
10
class
CInstanciatedObject
;
11
DLL_TOOLSFUNCTION
bool
DeleteMe(
CInstanciatedObject
*
object
);
// object can be NULL
12
13
// CInstanciatedObject derived object should have their destructor made protected to prevent using delete on them and use ->Delete() instead
14
// If the destructor is public, caller must take care about object destruction, which should occurs only if the object is referenced once.
15
class
DLL_TOOLSFUNCTION
CInstanciatedObject
16
{
17
template
<
typename
CInstanciatedObject>
friend
void
xDestroy(
CInstanciatedObject
*);
18
19
private
:
20
mutable
int
lock;
21
22
protected
:
23
virtual
~CInstanciatedObject
(
void
);
24
25
public
:
26
CInstanciatedObject
(
void
);
27
28
virtual
bool
Delete();
29
int
GetRefCount()
const
;
30
int
AddRef()
const
;
31
};
32
33
// This template allows to construct a CInstanciatedObject derived object on the stack, and destroy it automatically.
34
// This is useful when the destructor is made protected. The template must be used only if the caller knows that the object is referenced only once
35
// when destruction occurs.
36
template
<
typename
T>
class
CStackInstanciatedObject
37
{
38
protected
:
39
T
*type;
40
41
public
:
42
CStackInstanciatedObject
()
43
{
44
type =
new
T
;
45
}
46
47
virtual
~CStackInstanciatedObject
()
48
{
49
type->Delete();
50
}
51
52
operator
const
T
*()
53
{
54
return
type;
55
}
56
57
operator
T
*()
58
{
59
return
type;
60
}
61
};
62
63
END_MOOTOOLS_NAMESPACE
64
65
#endif
C3DTPoint
The class defines an x, y, z 3D point which can use int, float or double.
Definition
3DPoint.h:27
CInstanciatedObject
Definition
InstanciatedObject.h:16
CStackInstanciatedObject
Definition
InstanciatedObject.h:37
VS2022-PolygonCruncherSDK-Full-IO
SDK
Includes
InstanciatedObject.h
Generated by
1.9.8