Describe the bug
First of all, I'm not sure whether this is a bug or intended behavior.
I have noticed that the default network implementations do not trigger the on_add events when their create_pi() function is called.
I found this behavior misleading as, e.g., depth_view makes explicit usage of this event type to recompute levels on creation of new nodes. There is a test case in depth_view.cpp that tests this feature which of course works because PIs are placed in level 0 anyway, i.e., the default-constructed value for the level data type (uint32_t). To be more precise, PIs show their intended level on creation even though on_add was never called on them.
I'm currently implementing a view that's similar to depth_view and I wanted to rely on this event to process new nodes (including PIs) on creation. @lee30sonia recommended to override the create_pi function and manually call on_add (many thanks for this idea!). While that provides intended behavior for my use case, it would break as soon as someone introduced a new network type that did trigger on_add events on create_pi() because it'd then process PIs twice.
Any input on this matter is welcome. Many thanks in advance!
Describe the bug
First of all, I'm not sure whether this is a bug or intended behavior.
I have noticed that the default network implementations do not trigger the
on_addevents when theircreate_pi()function is called.I found this behavior misleading as, e.g.,
depth_viewmakes explicit usage of this event type to recompute levels on creation of new nodes. There is a test case indepth_view.cppthat tests this feature which of course works because PIs are placed in level 0 anyway, i.e., the default-constructed value for the level data type (uint32_t). To be more precise, PIs show their intended level on creation even thoughon_addwas never called on them.I'm currently implementing a view that's similar to
depth_viewand I wanted to rely on this event to process new nodes (including PIs) on creation. @lee30sonia recommended to override thecreate_pifunction and manually callon_add(many thanks for this idea!). While that provides intended behavior for my use case, it would break as soon as someone introduced a new network type that did triggeron_addevents oncreate_pi()because it'd then process PIs twice.Any input on this matter is welcome. Many thanks in advance!