Symphony-DAS / symphony-matlab

Symphony Data Acquisition System
http://symphony-das.github.io
MIT License
19 stars 5 forks source link

Descriptor value getter methods can be more efficient #35

Closed cafarm closed 7 years ago

cafarm commented 7 years ago

Descriptor value getters like:

Can be more efficient by not retrieving all the descriptors and using findByName() and instead getting the value from the core map directly.

For example:

Current:

function v = getConfigurationSetting(obj, name)
    % Gets the value of an existing configuration setting

    descriptors = obj.getConfigurationSettingDescriptors();
    d = descriptors.findByName(name);
    if isempty(d)
        error([name ' does not exist']);
    end
    v = d.value;
end

More efficient:

function v = getConfigurationSetting(obj, name)
    % Gets the value of an existing configuration setting

    v = obj.tryCoreWithReturn(@()obj.cobj.Configuration.Item(name));
    v = obj.valueFromPropertyValue(convert(v));
end