9 // The only extensible way to extend objects at runtime in an extensible
10 // and decentralized way (without having to modify the object's class)
11 // is to add a property table to every object.
12 // For the moment, only very few properties are planned, so lists should be
13 // enough. Since properties represent additional information about the object,
14 // there is no need for removing properties, so singly linked lists will be
17 // This is the base class for all properties.
24 cl_property (const cl_symbol& k) : next (NULL), key (k) {}
26 virtual ~cl_property () {}
27 // Allocation and deallocation.
28 void* operator new (size_t size) { return cl_malloc_hook(size); }
29 void operator delete (void* ptr) { cl_free_hook(ptr); }
31 virtual void dummy ();
32 // Friend declarations. They are for the compiler. Just ignore them.
33 friend class cl_property_list;
35 #define SUBCLASS_cl_property() \
36 void* operator new (size_t size) { return cl_malloc_hook(size); } \
37 void operator delete (void* ptr) { cl_free_hook(ptr); }
39 struct cl_property_list {
43 cl_property* get_property (const cl_symbol& key);
44 void add_property (cl_property* new_property);
46 cl_property_list () : list (NULL) {}
51 #endif /* _CL_PROPLIST_H */