High-performance latchable optical switch and logic gates based on the integration of surface-emitting lasers and photothyristors