This is the first of 2 PRs to handle this functionality. The 2nd PR will handle making sure configuration filepaths do not get saved to JSON with inappropriate path information.
This PR is intended to expand the capabilities of the Configurations without incurring much cost by providing status flags for each ConfigValue that reside within the 4 byte gap the current _type field causes due to 8 byte alignment.
Modifies the ConfigValType (int) _type field to be u_int64_t _typeAndFlags, where the lower 32 bits correspond to the previous _type value and the higher 32 bits are used to record state of the ConfigValue, along with necessary plumbing to consume the type value in the same way as before.
Adds ConfigValStatus enum (u_int64_t) to hold bit flags representing state of the ConfigValue. Currently 3 flags are supported, ConfigValStatus::isDefault , ConfigValStatus::isHidden and ConfigValStatus::isTranslated.
-- isDefault : represents programmatic initialization of a value, as opposed to it being set intentionally from a file or user input.
-- isHidden : represents a value being used internally and not part of the actual Configuration data hierarchy. These values we never want to write to file or expose to a user unless for debugging purposes.
-- isTranslated : represents a value that is stored as a string but is translated, currently to enum values, upon consumption.
Adds "init" setters that set the ConfigValStatus::isDefault bit of the ConfigValue's _typeAndFlags variable to 1, while the legacy "set" setters set it to 0.
Adds "hidden" setters that will set the ConfigValStatus::isHidden bit. The Attributes that consume this bit have as their keys double-underscore + Hungarian notation names, to make them obvious compared to the standard camel-case format of non-hidden values.
All existing Attributes constructors have their default value setting changed from using variants of "set" to using the new "init" and "setHidden" setters where appropriate.
A check on the "isDefault" and "isHidden" flags is added when before writing to JSON.
Not only will these features prevent the unnecessary writing to disk of default fields, but they can also be used to prevent configurations being written in a potentially damaging or indeterminant state due to modifications done internally as part of the program's flow.
Motivation and Context
This is the first of 2 PRs to handle this functionality. The 2nd PR will handle making sure configuration filepaths do not get saved to JSON with inappropriate path information.
This PR is intended to expand the capabilities of the Configurations without incurring much cost by providing status flags for each ConfigValue that reside within the 4 byte gap the current _type field causes due to 8 byte alignment.
Modifies the ConfigValType (int) _type field to be u_int64_t _typeAndFlags, where the lower 32 bits correspond to the previous _type value and the higher 32 bits are used to record state of the ConfigValue, along with necessary plumbing to consume the type value in the same way as before.
Adds ConfigValStatus enum (u_int64_t) to hold bit flags representing state of the ConfigValue. Currently 3 flags are supported, ConfigValStatus::isDefault , ConfigValStatus::isHidden and ConfigValStatus::isTranslated. -- isDefault : represents programmatic initialization of a value, as opposed to it being set intentionally from a file or user input. -- isHidden : represents a value being used internally and not part of the actual Configuration data hierarchy. These values we never want to write to file or expose to a user unless for debugging purposes. -- isTranslated : represents a value that is stored as a string but is translated, currently to enum values, upon consumption.
Adds "init" setters that set the ConfigValStatus::isDefault bit of the ConfigValue's _typeAndFlags variable to 1, while the legacy "set" setters set it to 0.
Adds "hidden" setters that will set the ConfigValStatus::isHidden bit. The Attributes that consume this bit have as their keys double-underscore + Hungarian notation names, to make them obvious compared to the standard camel-case format of non-hidden values.
All existing Attributes constructors have their default value setting changed from using variants of "set" to using the new "init" and "setHidden" setters where appropriate.
A check on the "isDefault" and "isHidden" flags is added when before writing to JSON.
Not only will these features prevent the unnecessary writing to disk of default fields, but they can also be used to prevent configurations being written in a potentially damaging or indeterminant state due to modifications done internally as part of the program's flow.
Also adds a repathing tool in the io namespace :
which converts the absolute path
toRelPath
to be relative to the given targetabsPath
How Has This Been Tested
Locally c++ and python tests pass
Types of changes
Checklist