Support vts generation for fmq type in hidl-gen.
* Also did a few cleanup for Templated type.
Bug: 34385794
Test: make hidl-gen
Change-Id: I539bf8fe5a1bb65c36f6041417b34ddaf99840d7
diff --git a/Type.cpp b/Type.cpp
index f155816..71279c0 100644
--- a/Type.cpp
+++ b/Type.cpp
@@ -153,6 +153,11 @@
return std::string();
}
+std::string Type::getVtsValueName() const {
+ CHECK(!"Should not be here");
+ return std::string();
+}
+
void Type::emitReaderWriter(
Formatter &,
const std::string &,
@@ -470,5 +475,30 @@
return true;
}
+status_t TemplatedType::emitVtsTypeDeclarations(Formatter &out) const {
+ out << "type: " << getVtsType() << "\n";
+ out << getVtsValueName() << ": {\n";
+ out.indent();
+ status_t err = mElementType->emitVtsTypeDeclarations(out);
+ if (err != OK) {
+ return err;
+ }
+ out.unindent();
+ out << "}\n";
+ return OK;
+}
+
+status_t TemplatedType::emitVtsAttributeType(Formatter &out) const {
+ out << "type: " << getVtsType() << "\n";
+ out << getVtsValueName() << ": {\n";
+ out.indent();
+ status_t status = mElementType->emitVtsAttributeType(out);
+ if (status != OK) {
+ return status;
+ }
+ out.unindent();
+ out << "}\n";
+ return OK;
+}
} // namespace android