All optical switching via diffraction grating formed by interference of Gaussian beams