Helical equilibria and magnetic structures in the reversed field pinch and analogies to the tokamak and stellarator