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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
* Original author: Paul McCullagh (H&G2JCtL)
20
* Continued development: Barry Leslie
27
#ifndef __CSOBJECT_H__
28
#define __CSOBJECT_H__
34
// The RETAIN() macro is useful when passing object references to functions
35
// that you want to retain. For example istead of:
41
// After 20 years of programming I have finally found a use for the 'C' comma
42
// operator out side of a 'for' loop. :)
43
#define RETAIN(x) ((x)->retain(),(x))
48
virtual ~CSObject() { }
50
virtual void retain();
51
virtual void release();
54
* All objects are sortable, hashable and linkable,
55
* as long as these methods are implemented:
57
virtual CSObject *getKey();
58
virtual int compareKey(CSObject *);
59
virtual u_int hashKey();
60
virtual CSObject *getHashLink();
61
virtual void setHashLink(CSObject *);
62
virtual CSObject *getNextLink();
63
virtual CSObject *getPrevLink();
64
virtual void setNextLink(CSObject *);
65
virtual void setPrevLink(CSObject *);
68
static void *operator new(size_t size, const char *func, const char *file, u_int line) {
69
return cs_mm_malloc(func, file, line, size);
72
static void operator delete(void *ptr, size_t size) {
76
//virtual void retain(const char *func, const char *file, u_int line);
77
//virtual void release(const char *func, const char *file, u_int line);
81
class CSRefObject : public CSObject {
84
virtual ~CSRefObject();
86
virtual void retain();
87
virtual void release();
89
//virtual void retain(const char *func, const char *file, u_int line);
90
//virtual void release(const char *func, const char *file, u_int line);
100
class CSSharedRefObject : public CSObject, public CSSync {
103
virtual ~CSSharedRefObject();
105
virtual void retain();
106
virtual void release();
108
virtual void startTracking();
109
//virtual void retain(const char *func, const char *file, u_int line);
110
//virtual void release(const char *func, const char *file, u_int line);
121
#define new new(__FUNC__, __FILE__, __LINE__)
126
virtual void returnToPool() = 0;