Skip to content

Parameter Validation Callbacks are Not Triggered for Extension Parameters #577

@kathlenemagnus-mips

Description

@kathlenemagnus-mips

I have a sparta::ExtensionsParamsOnly class that defines a set of parameters. The parameters are initialized in postCreate(). I am attaching a validation callback, but it is never triggered.

public:
void postCreate() override
{
    ex_param.reset(new sparta::Parameter<uint32_t>("ex_param", 0, "Example parameter with limited number of valid values (0, 1, 2, or 3)", ps));
    ex_param->addDependentValidationCallback(&validateParam_, "example param constraint");
}

private:
    std::unique_ptr<sparta::Parameter<uint32_t>> vlen_;

static bool validateParam_(uint32_t & param_val, const sparta::TreeNode*)
{
    const std::vector<uint32_t> valid_param_values{0, 1, 2, 3};
    return std::find(valid_param_values.begin(), valid_param_values.end(), param_val) != valid_param_values.end();
};

I can manually call Parameter::validateIndependently to test that the callback has been registered properly.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions