]>
Commit | Line | Data |
---|---|---|
ac884b6a MS |
1 | // |
2 | // "$Id$" | |
3 | // | |
4 | // Shared data class for the CUPS PPD Compiler. | |
5 | // | |
94da7e34 | 6 | // Copyright 2007-2009 by Apple Inc. |
ac884b6a MS |
7 | // Copyright 2002-2005 by Easy Software Products. |
8 | // | |
9 | // These coded instructions, statements, and computer programs are the | |
10 | // property of Apple Inc. and are protected by Federal copyright | |
11 | // law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
12 | // which should have been included with this file. If this file is | |
13 | // file is missing or damaged, see the license at "http://www.cups.org/". | |
14 | // | |
15 | // Contents: | |
16 | // | |
17 | // ppdcShared::ppdcShared() - Create shared data. | |
18 | // ppdcShared::~ppdcShared() - Destroy shared data. | |
ac884b6a | 19 | // ppdcShared::release() - Decrement the use count and delete as needed. |
e4572d57 | 20 | // ppdcShared::retain() - Increment the use count for this data. |
ac884b6a MS |
21 | // |
22 | ||
23 | // | |
24 | // Include necessary headers... | |
25 | // | |
26 | ||
27 | #include "ppdc.h" | |
28 | ||
29 | ||
30 | // | |
31 | // 'ppdcShared::ppdcShared()' - Create shared data. | |
32 | // | |
33 | ||
34 | ppdcShared::ppdcShared() | |
35 | { | |
36 | use = 1; | |
37 | } | |
38 | ||
39 | ||
40 | // | |
41 | // 'ppdcShared::~ppdcShared()' - Destroy shared data. | |
42 | // | |
43 | ||
44 | ppdcShared::~ppdcShared() | |
45 | { | |
46 | } | |
47 | ||
48 | ||
49 | // | |
e4572d57 | 50 | // 'ppdcShared::release()' - Decrement the use count and delete as needed. |
ac884b6a MS |
51 | // |
52 | ||
53 | void | |
e4572d57 | 54 | ppdcShared::release(void) |
ac884b6a | 55 | { |
94da7e34 MS |
56 | #ifdef DEBUG |
57 | fprintf(stderr, "DEBUG: %p release %s use=%d\n", this, class_name(), use); | |
58 | #endif // DEBUG | |
59 | ||
e4572d57 MS |
60 | use --; |
61 | if (!use) | |
62 | delete this; | |
ac884b6a MS |
63 | } |
64 | ||
65 | ||
66 | // | |
e4572d57 | 67 | // 'ppdcShared::retain()' - Increment the use count for this data. |
ac884b6a MS |
68 | // |
69 | ||
70 | void | |
e4572d57 | 71 | ppdcShared::retain() |
ac884b6a | 72 | { |
e4572d57 | 73 | use ++; |
94da7e34 MS |
74 | |
75 | #ifdef DEBUG | |
76 | fprintf(stderr, "DEBUG: %p retain %s use=%d\n", this, class_name(), use); | |
77 | #endif // DEBUG | |
ac884b6a MS |
78 | } |
79 | ||
80 | ||
81 | // | |
82 | // End of "$Id$". | |
83 | // |