… | |
… | |
83 | struct attachable_base |
83 | struct attachable_base |
84 | { |
84 | { |
85 | void *self, *cb; // CF+ perl self and callback |
85 | void *self, *cb; // CF+ perl self and callback |
86 | const char *attach; // generic extension attachment information |
86 | const char *attach; // generic extension attachment information |
87 | |
87 | |
88 | void clear (); // called when free'ing objects |
88 | void clear (); // called when free'ing objects |
89 | void optimise (); // possibly save some memory by destroying unneeded data |
89 | void optimise (); // possibly save some memory by destroying unneeded data |
|
|
90 | void instantiate (data_type type, void *obj); |
90 | |
91 | |
91 | void attachable_init () |
92 | void attachable_init () |
92 | { |
93 | { |
93 | self = cb = 0; |
94 | self = cb = 0; |
94 | attach = 0; |
95 | attach = 0; |
… | |
… | |
101 | template<class subclass> |
102 | template<class subclass> |
102 | struct attachable : attachable_base |
103 | struct attachable : attachable_base |
103 | { |
104 | { |
104 | static data_type get_dt () |
105 | static data_type get_dt () |
105 | { |
106 | { |
106 | subclass::get_dt (); |
107 | return subclass::get_dt (); |
|
|
108 | } |
|
|
109 | |
|
|
110 | void instantiate () |
|
|
111 | { |
|
|
112 | if (attach) |
|
|
113 | attachable_base::instantiate (get_dt (), static_cast<subclass *>(this)); |
107 | } |
114 | } |
108 | }; |
115 | }; |
109 | |
116 | |
110 | struct object_freezethaw |
117 | struct object_freezethaw |
111 | { |
118 | { |