1
/* Copyright (C) 2008 PrimeBase Technologies GmbH, Germany
3
* PrimeBase Media Stream for MySQL
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
* Original author: Paul McCullagh (H&G2JCtL)
20
* Continued development: Barry Leslie
24
* A basic syncronized object.
43
* ---------------------------------------------------------------
48
void CSObject::retain(const char *func, const char *file, uint32_t line)
50
CSException::throwAssertion(func, file, line, "Non-referenced object cannot be referenced");
53
void CSObject::retain()
55
CSException::throwAssertion(CS_CONTEXT, "Non-referenced object cannot be referenced");
60
void CSObject::release(const char *, const char *, uint32_t )
62
void CSObject::release()
68
CSObject *CSObject::getKey() { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return NULL; }
70
int CSObject::compareKey(CSObject *) { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return 0; }
72
uint32_t CSObject::hashKey() { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return 0; }
74
CSObject *CSObject::getHashLink() { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return NULL; }
76
void CSObject::setHashLink(CSObject *) { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); }
78
CSObject *CSObject::getNextLink() { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return NULL; }
80
CSObject *CSObject::getPrevLink() { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); return NULL; }
82
void CSObject::setNextLink(CSObject *) { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); }
84
void CSObject::setPrevLink(CSObject *) { CSException::throwCoreError(CS_CONTEXT, CS_ERR_IMPL_MISSING, __FUNC__); }
87
* ---------------------------------------------------------------
92
void CSStaticObject::retain(const char *, const char *, uint32_t )
94
void CSStaticObject::retain()
100
void CSStaticObject::release(const char *, const char *, uint32_t )
102
void CSStaticObject::release()
109
* ---------------------------------------------------------------
113
CSRefObject::CSRefObject():
119
cs_mm_track_memory(NULL, NULL, 0, this, true, iRefCount, iTrackMe);
123
CSRefObject::~CSRefObject()
125
ASSERT(iRefCount == 0);
129
void CSRefObject::retain(const char *func, const char *file, uint32_t line)
131
void CSRefObject::retain()
135
CSException::throwAssertion(CS_CONTEXT, "Freed object being retained.");
139
cs_mm_track_memory(func, file, line, this, true, iRefCount, iTrackMe);
144
void CSRefObject::release(const char *func, const char *file, uint32_t line)
146
void CSRefObject::release()
152
cs_mm_track_memory(func, file, line, this, false, iRefCount, iTrackMe);
165
void CSRefObject::startTracking()
168
cs_mm_track_memory(NULL, NULL, 0, this, true, iRefCount, iTrackMe);
173
* ---------------------------------------------------------------
174
* SHARED REFERENCE OBJECTS
177
CSSharedRefObject::CSSharedRefObject():
184
cs_mm_track_memory(NULL, NULL, 0, this, true, iRefCount, iTrackMe);
188
CSSharedRefObject::~CSSharedRefObject()
190
ASSERT(iRefCount == 0);
194
void CSSharedRefObject::retain(const char *func, const char *file, uint32_t line)
196
void CSSharedRefObject::retain()
202
cs_mm_track_memory(func, file, line, this, true, iRefCount, iTrackMe);
208
void CSSharedRefObject::release(const char *func, const char *file, uint32_t line)
210
void CSSharedRefObject::release()
217
cs_mm_track_memory(func, file, line, this, false, iRefCount, iTrackMe);
231
void CSSharedRefObject::startTracking()
234
cs_mm_track_memory(NULL, NULL, 0, this, true, iRefCount, iTrackMe);
240
void CSSharedRefObject::retain(const char *func, const char *file, uint32_t line)
244
cs_mm_print_track(func, file, line, this, true, iRefCount);
248
void CSSharedRefObject::release(const char *func, const char *file, uint32_t line)
253
cs_mm_track_memory(func, file, line, this, false, iRefCount, iTrackMe);