Refactor port base class to handle port type

Recent changes mean that all port classes now know the type of the port at
initialisation. Move the type down into the base class, to simplify things.