Add getHashChain() to IBase.
Each interface has a getHashChain() method that
returns the hash of all .hal files from the rtti
of the interface up to IBase.
Test: hidl_test
Bug: 36602587
Change-Id: I13f2e54bd45593c70064dff05fa934d5cd01996a
diff --git a/ConstantExpression.cpp b/ConstantExpression.cpp
index 850faf8..084f9df 100644
--- a/ConstantExpression.cpp
+++ b/ConstantExpression.cpp
@@ -152,19 +152,32 @@
ConstantExpression::ConstantExpression() {
}
+// static
ConstantExpression ConstantExpression::Zero(ScalarType::Kind kind) {
- ConstantExpression ce("0");
- CHECK(isSupported(kind));
- ce.mValueKind = kind;
- return ce;
-}
-ConstantExpression ConstantExpression::One(ScalarType::Kind kind) {
- ConstantExpression ce("1");
- CHECK(isSupported(kind));
- ce.mValueKind = kind;
+ ConstantExpression ce = ValueOf(kind, 0);
+ ce.mExpr = "0";
return ce;
}
+// static
+ConstantExpression ConstantExpression::One(ScalarType::Kind kind) {
+ ConstantExpression ce = ValueOf(kind, 1);
+ ce.mExpr = "1";
+ return ce;
+}
+
+// static
+ConstantExpression ConstantExpression::ValueOf(ScalarType::Kind kind, uint64_t value) {
+ ConstantExpression ce;
+ CHECK(isSupported(kind));
+
+ ce.mExpr = "";
+ ce.mType = kConstExprLiteral;
+ ce.mValueKind = kind;
+ ce.mValue = value;
+ ce.mTrivialDescription = true;
+ return ce;
+}
ConstantExpression::ConstantExpression(const ConstantExpression& other) {
*this = other;
}