… | |
… | |
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 | { |
… | |
… | |
131 | } |
138 | } |
132 | }; |
139 | }; |
133 | |
140 | |
134 | struct object_thawer : object_freezethaw |
141 | struct object_thawer : object_freezethaw |
135 | { |
142 | { |
136 | object_thawer (FILE *fp, const char *filename = 0); |
143 | object_thawer (const char *filename = 0); |
137 | ~object_thawer (); |
144 | ~object_thawer (); |
138 | |
145 | |
139 | void get (data_type type, void *obj, attachable_base *ext, int oid); |
146 | void get (data_type type, void *obj, attachable_base *ext, int oid); |
140 | |
147 | |
141 | template<class subclass> |
148 | template<class subclass> |