[TS-2321] C++ API: Clean up header code to no longer use intermediate data structures