This page aims at detailing the steps to follow when moving, renaming or removing code in SOFA. It focuses on: components and data field.
Components
Moving a Component to another module
- do the move
- deprecated phase (6 months)
- [dev] in Sofa.Compat
- create a compatibility header with same name and same path
- in compat header, include new header
- add macro SOFA_DEPRECATED_HEADER
- add aliases for all classes, static functions, global variables
- add a macro SOFA_ATTRIBUTE_DEPRECATED on these aliases
- [user] in ComponentChange
- add as CreatableMoved() in deprecatedComponents
- [dev] in Sofa.Compat
- deleted phase (6 months)
- [dev] in Sofa.Compat
- change the macro for SOFA_DISABLED_HEADER
- change the alias to be on DeprecatedOrRemoved
- change the alias macro for SOFA_ATTRIBUTE_DISABLED
- [user] in ComponentChange
- changed to Removed() and move to uncreatableComponents
- [dev] in Sofa.Compat
- remove the compat + cleanup
- [dev] in the component class
- erase the class
- erase the alias
- [user] in ComponentChange
- erase the ComponentChange entry
- [dev] in the component class
Renaming a Component
- do the renaming
- deprecated phase (6 months)
- [dev] in the component class
- create an empty header with old name including the new file
- add a C++ alias for the component name
- add a macro SOFA_ATTRIBUTE_DEPRECATED on this alias
- [user] in the component’s registration to the factory
- add a SOFA alias to OldName in RegisterObject
- [user] in ComponentChange
- add the SOFA alias as Deprecated() in deprecatedComponents
- [dev] in the component class
- renamed phase (6 months)
- [dev] in the component class
- change the C++ alias to be on DeprecatedOrRemoved
- change the macro for SOFA_ATTRIBUTE_DISABLED
- [user] in the component’s registration to the factory
- remove the SOFA alias
- [user] in ComponentChange
- change the SOFA alias to Renamed() and move to uncreatableComponents
- [dev] in the component class
- cleanup
- [dev] in the component class
- remove the C++ alias
- [user] in ComponentChange
- remove the SOFA alias entry
- [dev] in the component class
Removing a Component
- deprecated phase (6 months)
- [dev] in the component class
- use a macro to deprecate the class
- [user] in ComponentChange
- add as Deprecated() in deprecatedComponents
- [dev] in the component class
- deleted phase (6 months)
- [dev] in the component class
- delete the class
- [dev] in Sofa.Compat
- create a compatibility header with same name and same path
- add macro SOFA_DISABLED_HEADER
- add aliases for all classes, static functions, global variables
- add a macro SOFA_ATTRIBUTE_DISABLED on these aliases
- [user] in ComponentChange
- change to Removed() and move to uncreatableComponents
- [dev] in the component class
- cleanup
- [dev] in Sofa.Compat
- remove the compatibility header
- [user] in ComponentChange
- remove the entry
- [dev] in Sofa.Compat
Datafields
Renaming a Datafield
- do the renaming
- deprecated phase (6 months)
- [user] in the component
parse()
method- add the macro NOT YET existing: warn about deprecation and renaming to come + copy value in the new data
- [user] update all scenes using the data
- [user] in the component
- renamed phase (6 months)
- [user] in the component
parse()
method- add the macro NOT YET existing: error about renaming
- [user] in the component
- cleanup
- [user] in the component
parse()
method- remove the macro
- [user] in the component
Removing a Datafield
- deprecated phase (6 months)
- [dev] in the component class
- add macro SOFA_ATTRIBUTE_DEPRECATED on the Data member
- [dev] in whole codebase
- remove all references to this Datafield
- [user] in component constructor
- remove initData
- [user] in the component
parse()
method- add the macro NOT YET existing: warn about deprecation and deletion to come
- [user] update all scenes using the data
- [dev] in the component class
- deleted phase (6 months)
- [dev] in the component class
- change macro to SOFA_ATTRIBUTE_DISABLED and member type to DeprecatedOrRemoved
- [user] in the component
parse()
method- change the macro NOT YET existing: error about deletion
- [dev] in the component class
- cleanup
- [dev] in the component class
- remove the member
- [user] in the component
parse()
method- remove the macro
- [dev] in the component class
Changing Data default value
As suggested in #3563, when the default value of a Data is changed the following warning should be added in the init()
function:
Last modified: 6 January 2023