Optical switching and logic gates with vertical cavity surface-emitting lasers