summaryrefslogtreecommitdiffstats
path: root/parameter/ParameterType.h
diff options
context:
space:
mode:
Diffstat (limited to 'parameter/ParameterType.h')
-rw-r--r--parameter/ParameterType.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/parameter/ParameterType.h b/parameter/ParameterType.h
index d83dbce..ed30ac3 100644
--- a/parameter/ParameterType.h
+++ b/parameter/ParameterType.h
@@ -25,6 +25,7 @@
#pragma once
#include <stdint.h>
+#include <limits>
#include "TypeElement.h"
@@ -87,6 +88,15 @@ protected:
// Remove all bits set outside available range
uint32_t makeEncodable(uint32_t uiData) const;
+ /** Compute max value according to the parameter type */
+ template <typename type>
+ type getMaxValue() const
+ {
+ return getSize() < sizeof(type) ?
+ (static_cast<type>(1) << (getSize() * numeric_limits<unsigned char>::digits - 1)) - 1 :
+ numeric_limits<type>::max();
+ }
+
private:
// Instantiation
virtual CInstanceConfigurableElement* doInstantiate() const;