sumo icon indicating copy to clipboard operation
sumo copied to clipboard

add getType to Named

Open behrisch opened this issue 3 years ago • 2 comments

This is an idea to add a type attribute (maybe reuse the XML tag) to every Named object. This came up while thinking about context subscriptions and whether we really need a separate rtree for every domain.

Pro: may help on other occasions as well where we currently need dynamic type casts or other means Con: memory consumption (adds another int to almost every object)

Please discuss

behrisch avatar Jul 16 '22 08:07 behrisch

How about just adding the virtual (abstract?) method getType to every Named object? Most objects should already be able to provide this so we don't get a memory overhead.

namdre avatar Jul 16 '22 09:07 namdre

Yes, of course. Since this is basically a class property anyway there is no need to store it as an attribute. I changed the title accordingly.

behrisch avatar Jul 16 '22 09:07 behrisch