GammaLib and ctools: A software framework for the analysis of astronomical gamma-ray data