equal
deleted
inserted
replaced
|
1 /** |
|
2 * \file manual.c |
|
3 */ |
|
4 |
|
5 typedef struct Object Object; //!< Object type |
|
6 typedef struct Vehicle Vehicle; //!< Vehicle type |
|
7 typedef struct Car Car; //!< Car type |
|
8 typedef struct Truck Truck; //!< Truck type |
|
9 |
|
10 /*! |
|
11 * Base object class. |
|
12 */ |
|
13 struct Object |
|
14 { |
|
15 int ref; //!< \private Reference count. |
|
16 }; |
|
17 |
|
18 |
|
19 /*! |
|
20 * Increments object reference count by one. |
|
21 * \public \memberof Object |
|
22 */ |
|
23 static Object * objRef(Object *obj); |
|
24 |
|
25 |
|
26 /*! |
|
27 * Decrements object reference count by one. |
|
28 * \public \memberof Object |
|
29 */ |
|
30 static Object * objUnref(Object *obj); |
|
31 |
|
32 |
|
33 /*! |
|
34 * Vehicle class. |
|
35 * \extends Object |
|
36 */ |
|
37 struct Vehicle |
|
38 { |
|
39 Object base; //!< \protected Base class. |
|
40 }; |
|
41 |
|
42 |
|
43 /*! |
|
44 * Starts the vehicle. |
|
45 * \public \memberof Vehicle |
|
46 */ |
|
47 void vehicleStart(Vehicle *obj); |
|
48 |
|
49 |
|
50 /*! |
|
51 * Stops the vehicle. |
|
52 * \public \memberof Vehicle |
|
53 */ |
|
54 void vehicleStop(Vehicle *obj); |
|
55 |
|
56 |
|
57 /*! |
|
58 * Car class. |
|
59 * \extends Vehicle |
|
60 */ |
|
61 struct Car |
|
62 { |
|
63 Vehicle base; //!< \protected Base class. |
|
64 }; |
|
65 |
|
66 |
|
67 /*! |
|
68 * Truck class. |
|
69 * \extends Vehicle |
|
70 */ |
|
71 struct Truck |
|
72 { |
|
73 Vehicle base; //!< \protected Base class. |
|
74 }; |
|
75 |
|
76 |
|
77 /*! |
|
78 * Main function. |
|
79 * |
|
80 * Ref vehicleStart(), objRef(), objUnref(). |
|
81 */ |
|
82 int main(void) |
|
83 { |
|
84 Car c; |
|
85 vehicleStart((Vehicle*) &c); |
|
86 } |
|
87 |