__init__.py
1 # SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-or-later OR CERN-OHL-S-2.0+ OR Apache-2.0 2 3 """The dispatch module contains classes inspirec by the visitor pattern in order 4 to allow to execute code specific to a certain object type but also allow to 5 have common code for all subclasses of a common parent class. 6 7 For each type of base class there is a sepearate \*Dispatched class that are based 8 on the same principle. 9 If one wants to implement some code for a class, typically one subclasses the 10 corresponding dispatcher class and then overloads one of the methods to implement 11 class specific code. The method name to overload is based on the class name. 12 Code for a common parent class can be implement by only overloaded the corresponding 13 method for this common class without needing to overload each of the subclasses. 14 For multi-inheritance each of the super classes methods will be tried in order. 15 The dispatched for the base '_Shape' class will raise NotImplementedError if 16 not overloaded. 17 18 API Notes: 19 * The multi-inheritance support is still done ad-hoc and may in the future 20 be changed in a backwards incompatible way for code expecting certain 21 order for calling parent classes. 22 """ 23 # TODO: think through dispatching for multi-inheritance 24 25 from .shape import * 26 from .primitive import * 27 from .rule import * 28 from .mask import * 29 from .edge import *