generate C++ interface header, proxy and stub headers and sources.
diff --git a/ScalarType.cpp b/ScalarType.cpp
index ef816a9..c498f8c 100644
--- a/ScalarType.cpp
+++ b/ScalarType.cpp
@@ -16,5 +16,69 @@
     out << kName[mKind];
 }
 
+std::string ScalarType::getCppType(StorageMode, std::string *extra) const {
+    static const char *const kName[] = {
+        "char",
+        "bool",
+        "void *",
+        "int8_t",
+        "uint8_t",
+        "int16_t",
+        "uint16_t",
+        "int32_t",
+        "uint32_t",
+        "int64_t",
+        "uint64_t",
+        "float",
+        "double"
+    };
+
+    extra->clear();
+
+    return kName[mKind];
+}
+
+void ScalarType::emitReaderWriter(
+        Formatter &out,
+        const std::string &name,
+        const std::string &parcelObj,
+        bool parcelObjIsPointer,
+        bool isReader,
+        ErrorMode mode) const {
+    static const char *const kSuffix[] = {
+        "Uint8",
+        "Uint8",
+        "Pointer",
+        "Int8",
+        "Uint8",
+        "Int16",
+        "Uint16",
+        "Int32",
+        "Uint32",
+        "Int64",
+        "Uint64",
+        "Float",
+        "Double"
+    };
+
+    const std::string parcelObjDeref =
+        parcelObj + (parcelObjIsPointer ? "->" : ".");
+
+    out << "_aidl_err = "
+        << parcelObjDeref
+        << (isReader ? "read" : "write")
+        << kSuffix[mKind]
+        << "(";
+
+    if (isReader) {
+        out << "&";
+    }
+
+    out << name
+        << ");\n";
+
+    handleError(out, mode);
+}
+
 }  // namespace android