PolicyManager: Add an base Variable class without type.
The Variable<T> is a parametric type that requires to know the type T
of the exported variable. This new BaseVariable class isn't
parametric and allows to keep a list of variable pointers on the
EvaluationContext to cache their provided results and dump the names
of those variables.
BUG=chromium:338590
TEST=unittest passes.
Change-Id: I1677e3975d44575ed12f35c36381101d4379c5fc
Reviewed-on: https://chromium-review.googlesource.com/184428
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
diff --git a/policy_manager/random_provider.cc b/policy_manager/random_provider.cc
index 73caa04..8359c44 100644
--- a/policy_manager/random_provider.cc
+++ b/policy_manager/random_provider.cc
@@ -25,7 +25,8 @@
// The random variable class implementation.
class RandomVariable : public Variable<uint64_t> {
public:
- RandomVariable(FILE* fp) : fp_(fp) {}
+ RandomVariable(const string& name, FILE* fp)
+ : Variable<uint64_t>(name), fp_(fp) {}
virtual ~RandomVariable() {}
protected:
@@ -65,7 +66,7 @@
FILE* fp = fopen(kRandomDevice, "r");
if (!fp)
return false;
- var_random_seed = new RandomVariable(fp);
+ var_random_seed = new RandomVariable("random_seed", fp);
return true;
}