The structure of generalized inverse semigroups