Nonlinear pulse switching using cross-phase modulation and fiber Bragg gratings