Add getter macros for attributes (#1931)