The properties have a non-trivial overhead (because of the key, type and subtype identification, and other data). Also, the GEOMLIB cannot use the property mechanism, as it is independent of the kernel. Moreover, some properties have a special meaning and need some additional value checks (sometimes depending on other property values as well).
For these reasons, the virtual properties were introduced. A virtual property looks the same as a regular one; but some special callbacks handle the reading and writing of its value. The callbacks are called by the property manipulating functions.
The information about one virtual property is stored in the
struct prop_virtual
structure (common for all properties of the same key, type
and subtype belonging to the same GO subtype).
It contains the following callback pointers:
prop_value (*get)(struct o* o)
void (*set)(struct o* o, prop_value new_value)
o
.
void (*set_low)(struct o* o, prop_value new_value)
uns (*get_unit)(struct o* o)
void (*set_unit)(struct o* o, uns unit)
Every object has its own property list. In the beginning of the list, there are non-virtual properties, and the last non-virtual property points to the first virtual property. Each GO subtype has its own list of virtual properties. The last virtual property is always the “name” property.