Add obtain_from_generic() method and improve print_result() in CGradientResult class

also add some **const** qualifiers