GNU CommonC++
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
inc
cc++
object.h
Go to the documentation of this file.
1
// Copyright (C) 1999-2005 Open Source Telecom Corporation.
2
//
3
// This program is free software; you can redistribute it and/or modify
4
// it under the terms of the GNU General Public License as published by
5
// the Free Software Foundation; either version 2 of the License, or
6
// (at your option) any later version.
7
//
8
// This program is distributed in the hope that it will be useful,
9
// but WITHOUT ANY WARRANTY; without even the implied warranty of
10
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
// GNU General Public License for more details.
12
//
13
// You should have received a copy of the GNU General Public License
14
// along with this program; if not, write to the Free Software
15
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
//
17
// As a special exception, you may use this file as part of a free software
18
// library without restriction. Specifically, if other files instantiate
19
// templates or use macros or inline functions from this file, or you compile
20
// this file and link it with other files to produce an executable, this
21
// file does not by itself cause the resulting executable to be covered by
22
// the GNU General Public License. This exception does not however
23
// invalidate any other reasons why the executable file might be covered by
24
// the GNU General Public License.
25
//
26
// This exception applies only to the code released under the name GNU
27
// Common C++. If you copy code from other releases into a copy of GNU
28
// Common C++, as the General Public License permits, the exception does
29
// not apply to the code that you add in this way. To avoid misleading
30
// anyone as to the status of such modified files, you must delete
31
// this exception notice from them.
32
//
33
// If you write modifications of your own for GNU Common C++, it is your choice
34
// whether to permit this exception to apply to your modifications.
35
// If you do not wish that, delete this exception notice.
36
//
37
44
#ifndef CCXX_OBJECT_H_
45
#define CCXX_OBJECT_H_
46
47
#ifndef CCXX_MISSING_H_
48
#include <
cc++/missing.h
>
49
#endif
50
51
#ifdef CCXX_NAMESPACES
52
namespace
ost {
53
#endif
54
55
class
__EXPORT
MapObject
;
56
64
class
__EXPORT
RefObject
65
{
66
protected
:
67
friend
class
RefPointer
;
68
69
unsigned
refCount
;
70
74
inline
RefObject
()
75
{refCount = 0;};
76
81
virtual
~
RefObject
();
82
83
public
:
92
virtual
void
*getObject(
void
) = 0;
93
};
94
103
class
__EXPORT
RefPointer
104
{
105
protected
:
106
RefObject
*
ref
;
107
111
void
detach(
void
);
112
117
virtual
void
enterLock(
void
);
118
123
virtual
void
leaveLock(
void
);
124
125
public
:
129
inline
RefPointer
()
130
{ref = NULL;};
131
137
RefPointer
(
RefObject
*obj);
138
144
RefPointer
(
const
RefPointer
&ptr);
145
146
virtual
~
RefPointer
();
147
148
RefPointer
& operator=(
const
RefObject
&ref);
149
150
inline
void
*operator*()
const
151
{
return
getObject();};
152
153
inline
void
*operator->()
const
154
{
return
getObject();};
155
156
void
*getObject(
void
)
const
;
157
158
bool
operator!()
const
;
159
};
160
168
class
__EXPORT
LinkedSingle
169
{
170
protected
:
171
LinkedSingle
*
nextObject
;
172
173
inline
LinkedSingle
()
174
{nextObject = NULL;};
175
176
virtual
~
LinkedSingle
();
177
178
public
:
188
virtual
LinkedSingle
*getFirst(
void
);
189
197
virtual
LinkedSingle
*getLast(
void
);
198
205
inline
LinkedSingle
*getNext(
void
)
206
{
return
nextObject;};
207
215
virtual
void
insert(
LinkedSingle
& obj);
216
217
LinkedSingle
&operator+=(
LinkedSingle
&obj);
218
};
219
227
class
__EXPORT
LinkedDouble
228
{
229
protected
:
230
LinkedDouble
*nextObject, *
prevObject
;
231
232
inline
LinkedDouble
()
233
{nextObject = prevObject = NULL;};
234
235
virtual
~
LinkedDouble
();
236
237
virtual
void
enterLock(
void
);
238
239
virtual
void
leaveLock(
void
);
240
241
public
:
242
247
enum
InsertMode
248
{
249
modeAtFirst
,
250
modeAtLast
,
251
modeBefore
,
252
modeAfter
253
};
254
262
virtual
LinkedDouble
*getFirst(
void
);
263
271
virtual
LinkedDouble
*getLast(
void
);
272
280
virtual
LinkedDouble
*getInsert(
void
);
281
288
inline
LinkedDouble
*getNext(
void
)
289
{
return
nextObject;};
290
296
inline
LinkedDouble
*getPrev(
void
)
297
{
return
prevObject;};
298
304
virtual
void
insert(
LinkedDouble
& obj);
305
312
virtual
void
insert(InsertMode position,
LinkedDouble
& obj);
313
317
virtual
void
detach(
void
);
318
319
LinkedDouble
&operator+=(
LinkedDouble
&obj);
320
321
LinkedDouble
&operator--();
322
};
323
334
class
__EXPORT
MapTable
:
public
Mutex
335
{
336
protected
:
337
friend
class
MapObject
;
338
unsigned
range
;
339
MapObject
**
map
;
340
341
void
cleanup(
void
);
342
343
public
:
349
MapTable
(
unsigned
size);
350
354
virtual
~
MapTable
();
355
364
virtual
unsigned
getIndex(
const
char
*
id
);
365
371
inline
unsigned
getRange(
void
)
372
{
return
range;};
373
381
void
*getObject(
const
char
*
id
);
382
389
void
addObject(
MapObject
&obj);
390
400
void
*getFree(
void
);
401
408
void
addFree(
MapObject
*obj);
409
416
MapTable
&operator+=(
MapObject
&obj);
417
425
virtual
MapTable
&operator-=(
MapObject
&obj);
426
};
427
436
class
__EXPORT
MapObject
437
{
438
protected
:
439
friend
class
MapTable
;
440
MapObject
*
nextObject
;
441
const
char
*
idObject
;
442
MapTable
*
table
;
443
447
void
detach(
void
);
448
454
MapObject
(
const
char
*
id
);
455
};
456
457
#ifdef CCXX_NAMESPACES
458
}
459
#endif
460
461
#endif
462
Generated by
1.8.1