Switching state space models: likelihood, filtering and smoothing