api_generator: c++: move base classes to common code