Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup of sub device manager state inside device to simplify porting to meshdevice #16625

Open
tt-aho opened this issue Jan 10, 2025 · 1 comment
Assignees
Labels

Comments

@tt-aho
Copy link
Contributor

tt-aho commented Jan 10, 2025

    std::unordered_map<SubDeviceManagerId, std::unique_ptr<detail::SubDeviceManager>> sub_device_managers_;
    SubDeviceManagerId active_sub_device_manager_id_ = {0};
    detail::SubDeviceManager *active_sub_device_manager_ = nullptr;
    SubDeviceManagerId next_sub_device_manager_id_ = {0};
    SubDeviceManagerId default_sub_device_manager_id_ = {0};
    detail::SubDeviceManager *default_sub_device_manager_ = nullptr;

Currently, the single device object manages a number of different attributes regarding what the configured manager is, and if we want to uplift the SubDeviceManager concept to the mesh device level, this would require MeshDevice to copy/implement all of this logic as well, even though the logic would basically be duplicated.

The current thought/plan is to hoist all of this into an owning object that manages all of this, and then device/mesh device just needs instantiate this single owning object that they can query to get ex the active/default managers.

Ex. Change the existing SubDeviceManager to be SubDeviceConfiguration, and have the new owning object be the SubDeviceManager (final naming tbd)

Device {
    unique_ptr<SubDeviceManager> sub_device_manager_;
}

SubDeviceManager {
    std::unordered_map<SubDeviceConfigurationId, std::unique_ptr<detail::SubDeviceConfiguration>> sub_device_configurations_;
    SubDeviceConfigurationId active_sub_device_configuration_id_ = {0};
    detail:: SubDeviceConfigurationId *active_sub_device_configuration_ = nullptr;
    SubDeviceConfigurationId next_sub_device_configuration_id_ = {0};
    SubDeviceConfigurationId default_sub_device_configuration_id_ = {0};
    detail:: SubDeviceConfigurationId *default_sub_device_configuration_ = nullptr;
}
@tt-aho tt-aho added the cleanup label Jan 10, 2025
@tt-aho tt-aho self-assigned this Jan 10, 2025
@tt-aho
Copy link
Contributor Author

tt-aho commented Jan 10, 2025

@cfjchu fyi

tt-aho added a commit that referenced this issue Jan 13, 2025
… class to enable easy porting for MeshDevice
tt-aho added a commit that referenced this issue Jan 14, 2025
… class to enable easy porting for MeshDevice
tt-aho added a commit that referenced this issue Jan 14, 2025
… class to enable easy porting for MeshDevice
tt-aho added a commit that referenced this issue Jan 14, 2025
… class to enable easy porting for MeshDevice
tt-aho added a commit that referenced this issue Jan 14, 2025
… class to enable easy porting for MeshDevice
tt-aho added a commit that referenced this issue Jan 14, 2025
… class to enable easy porting for MeshDevice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant