6 #include "cln/symbol.h"
7 #include "cln/malloc.h"
11 // The only extensible way to extend objects at runtime in an extensible
12 // and decentralized way (without having to modify the object's class)
13 // is to add a property table to every object.
14 // For the moment, only very few properties are planned, so lists should be
15 // enough. Since properties represent additional information about the object,
16 // there is no need for removing properties, so singly linked lists will be
19 // This is the base class for all properties.
26 cl_property (const cl_symbol& k) : next (NULL), key (k) {}
28 virtual ~cl_property () {}
29 // Allocation and deallocation.
30 void* operator new (size_t size) { return malloc_hook(size); }
31 void operator delete (void* ptr) { free_hook(ptr); }
33 virtual void dummy ();
34 // Friend declarations. They are for the compiler. Just ignore them.
35 friend class cl_property_list;
37 #define SUBCLASS_cl_property() \
38 void* operator new (size_t size) { return malloc_hook(size); } \
39 void operator delete (void* ptr) { free_hook(ptr); }
41 struct cl_property_list {
45 cl_property* get_property (const cl_symbol& key);
46 void add_property (cl_property* new_property);
48 cl_property_list () : list (NULL) {}
55 #endif /* _CL_PROPLIST_H */