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

DynamicOnTime: code moved from constructor to setup #4

Merged
merged 4 commits into from
Jul 9, 2023

Conversation

hostcc
Copy link
Owner

@hostcc hostcc commented Jul 9, 2023

  • All code initializing component callbacks have been moved from constructor to setup() method, new protected method
    update_schedule_() has been introduced to perform actual instantiation/configuration of CronTrigger instance
  • Removed assert on members since component schema now takes care of ensuring all configuration options are present
  • DynamicOnTime: App.register_component() is called in setup method only once, to simplify update_schedule_()
  • Added DynamicOnTime::dump_config() method to log configuration

* All code initializing component callbacks have been moved from
  constructor to `setup()` method, new protected method
  `update_schedule_()` has been introduced to perform actual
  instatiation/configuration of `CronTrigger` instance
- Removed `assert` on members since component schema now takes care of
  ensuring all configuration options are present
  callbacks for `Number` and `Switch`, as solutions to properly cast to
  derived class in single loop over vector of base class instances
  seemingly imply more code than just two loops
* `DynamicOnTime::setup()`: call `update_schedule_()` before setting
  callbacks above, to ensure all entities are created before callback
  would be called on them
* `DynamicOnTime`: `App.register_component()` is called in `setup`
  method only once, to simplify `update_schedule_()`
* `DynamicOnTime::setup()`: fixed setting up state callbacks, those
  should be calling `this->update_schedule_()` not `this->setup()`
* Added `DynamicOnTime::dump_config()` method to log configuration
@hostcc hostcc marked this pull request as ready for review July 9, 2023 12:21
@hostcc hostcc merged commit 2f71f27 into main Jul 9, 2023
2 checks passed
@hostcc hostcc deleted the feature/from-cosntructor-to-dedicated-method branch July 9, 2023 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant