Pointer support and embedded types in HIDL.
* Pointers work per transaction. Don't work
across transactions.
* ref<T> in HIDL translates to T const* in C++.
* No Java support.
* Embedded types like ref<vec<vec<int32_t>>>
or vec<ref<T>> is supported. Pointers to
pointers like ref<ref<ref<T>>> is supported.
* Array of pointers and pointer to array supported.
* Pointer inside a union is NOT supported.
Test: `mma`
Test: `make hidl_test && adb sync && adb shell hidl_test`
Note that this only works with a kernel patch.
Bug: 31300815
Bug: 31349114
Change-Id: I15b74ca74a801009cc8bdc7132bd53d0185dbcbf
diff --git a/Type.cpp b/Type.cpp
index e54fdc5..0b2b715 100644
--- a/Type.cpp
+++ b/Type.cpp
@@ -120,6 +120,32 @@
CHECK(!"Should not be here");
}
+void Type::emitResolveReferences(
+ Formatter &,
+ const std::string &,
+ bool,
+ const std::string &,
+ bool,
+ bool,
+ ErrorMode) const {
+ CHECK(!"Should not be here");
+}
+
+void Type::emitResolveReferencesEmbedded(
+ Formatter &,
+ size_t,
+ const std::string &,
+ const std::string &,
+ bool,
+ const std::string &,
+ bool,
+ bool,
+ ErrorMode,
+ const std::string &,
+ const std::string &) const {
+ CHECK(!"Should not be here");
+}
+
void Type::emitReaderWriterEmbedded(
Formatter &,
size_t,
@@ -298,6 +324,10 @@
return false;
}
+bool Type::needsResolveReferences() const {
+ return false;
+}
+
bool Type::resultNeedsDeref() const {
return false;
}
@@ -356,5 +386,14 @@
CHECK(!"Should not be here");
}
+////////////////////////////////////////
+
+TemplatedType::TemplatedType() : mElementType(nullptr) {
+}
+void TemplatedType::setElementType(Type *elementType) {
+ CHECK(mElementType == nullptr); // can only be set once.
+ mElementType = elementType;
+}
+
} // namespace android