Fixed two minor issues in bx_param_num_c class.
- reset() must call set() to ensure the set handler is called if present. - don't set value if parameter is disabled.
This commit is contained in:
parent
dc9c93f0c5
commit
0ccf537103
@ -231,6 +231,8 @@ Bit64s bx_param_num_c::get64()
|
||||
|
||||
void bx_param_num_c::set(Bit64s newval)
|
||||
{
|
||||
if (!enabled) return;
|
||||
|
||||
if (handler) {
|
||||
// the handler can override the new value and/or perform some side effect
|
||||
val.number = (*handler)(this, 1, newval);
|
||||
|
@ -211,7 +211,7 @@ public:
|
||||
const char *description,
|
||||
Bit64s min, Bit64s max, Bit64s initial_val,
|
||||
bool is_shadow = 0);
|
||||
virtual void reset() { val.number = initial_val; }
|
||||
virtual void reset() { set(initial_val); }
|
||||
void set_handler(param_event_handler handler);
|
||||
void set_sr_handlers(void *devptr, param_save_handler save, param_restore_handler restore);
|
||||
void set_enable_handler(param_enable_handler handler) { enable_handler = handler; }
|
||||
|
Loading…
Reference in New Issue
Block a user