Function simics::api::base::conf_object::extend_class
source · pub fn extend_class(cls: *mut ConfClass, ext: *mut ConfClass) -> Result<()>
Expand description
The function extends the class cls with attributes, interfaces, port objects and port interfaces defined by the extension class ext.
The extension class must be of the type Sim_Class_Kind_Extension and must not define any attributes or interfaces which have already been defined by the class being augmented.
Besides normal object initialization, the init_object method for the extension class, will be called when cls is instantiated. The pointer returned by init_object can be retrieved using SIM_extension_data. The init_object method may return NULL if no private data pointer is needed; this does not signify an error condition for extension classes.
The finalize_instance method defined by the extension class will be called before the finalize_instance method is called for the class being extended.
The SIM_extension_class function is intended to be used to extend a class with generic functionality, common to multiple classes.
§Arguments
cls
- The class to extendext
- The extension class to extend the class with
§Context
Global Context