The Assimilation Monitoring Project
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
assimobj.c
Go to the documentation of this file.
1
24
#include <memory.h>
25
#include <
projectcommon.h
>
26
#include <
assimobj.h
>
27
28
DEBUGDECLARATIONS
29
36
37
FSTATIC
void
_assimobj_ref
(gpointer
self
);
38
FSTATIC
void
_assimobj_unref
(gpointer
self
);
39
void
_assimobj_finalize
(
AssimObj
*
self
);
40
FSTATIC
char
*
_assimobj_toString
(gconstpointer
self
);
41
42
FSTATIC
void
43
_assimobj_ref
(gpointer vself)
44
{
45
AssimObj
*
self
=
CASTTOCLASS
(
AssimObj
, vself);
46
g_return_if_fail(
self
!= NULL && self->_refcount > 0);
47
self
->_refcount += 1;
48
}
49
FSTATIC
void
50
_assimobj_unref
(gpointer vself)
51
{
52
AssimObj
*
self
=
CASTTOCLASS
(
AssimObj
, vself);
53
g_return_if_fail(
self
!= NULL && self->_refcount > 0);
54
self
->_refcount -= 1;
55
if
(self->_refcount == 0) {
56
self
->_finalize(
self
);
self
=NULL;
57
}
58
}
59
60
void
61
_assimobj_finalize
(
AssimObj
*
self
)
62
{
63
FREECLASSOBJ
(
self
);
64
}
65
66
FSTATIC
char
*
67
_assimobj_toString
(gconstpointer vself)
68
{
69
const
AssimObj
*
self
=
CASTTOCONSTCLASS
(
AssimObj
,vself);
70
return
g_strdup_printf(
"{%s object at 0x%p}"
,
proj_class_classname
(
self
),
self
);
71
}
72
73
AssimObj
*
74
assimobj_new
(guint objsize)
75
{
76
#ifdef DEBUGLEAKS
77
static
long
sequencenumber = 0;
78
#endif
79
AssimObj
*
self
;
80
BINDDEBUG
(
AssimObj
)
81
if
(objsize <
sizeof
(
AssimObj
)) {
82
objsize =
sizeof
(
AssimObj
);
83
}
84
self
=
MALLOCCLASS
(
AssimObj
, objsize);
85
#ifdef DEBUGLEAKS
86
self
->_bornon = sequencenumber;
87
sequencenumber += 1;
88
#endif
89
self
->_refcount = 1;
90
self
->ref =
_assimobj_ref
;
91
self
->unref =
_assimobj_unref
;
92
self
->_finalize =
_assimobj_finalize
;
93
self
->toString =
_assimobj_toString
;
94
DEBUGMSG5
(
"%s.%d(%d) => REF(%p)"
,
__FUNCTION__
, __LINE__, objsize,
self
);
95
return
self
;
96
}
src
clientlib
assimobj.c
Generated on Fri May 17 2013 16:40:51 for The Assimilation Monitoring Project by
1.8.3.1