Function simics::api::base::conf_object::_object_data

source ·
fn _object_data<'a, T>(obj: *mut ConfObject) -> &'a mut T
Expand description

Returns the private data pointer of an object. This pointer is available to the class for storing instance-specific state. It is initialised to the return value of the init (from class_info_t) method that is called during object creation. For classes created using the legacy [register_class], the same functionality is provided by the init_object method .

For classes implemented in Python, the data (which is then a Python value) can also be accessed as obj.object_data.

For classes written in C, the preferred way to store instance-specific state is by co-allocation with the object’s conf_object_t structure instead of using object_data. Such classes should define the alloc method in the class_info_t passed to create_class for allocating its instance data. For classes using the legacy [register_class] class registration function, they should define the alloc_object method in the class_data_t data structure.

§Arguments

  • obj - The object to retrieve extra data for

§Return value

A reference to the object’s inner data

§Context

All Contexts