diff options
-rw-r--r-- | Schemas/Parameter.xsd | 11 | ||||
-rw-r--r-- | parameter/BitParameter.cpp | 10 | ||||
-rw-r--r-- | parameter/BitParameter.h | 4 | ||||
-rw-r--r-- | parameter/BitParameterType.cpp | 24 | ||||
-rw-r--r-- | parameter/BitParameterType.h | 18 | ||||
-rw-r--r-- | parameter/BitwiseAreaConfiguration.cpp | 8 | ||||
-rw-r--r-- | parameter/Element.cpp | 9 | ||||
-rw-r--r-- | parameter/Element.h | 1 |
8 files changed, 50 insertions, 35 deletions
diff --git a/Schemas/Parameter.xsd b/Schemas/Parameter.xsd index 81f87c8..f198e82 100644 --- a/Schemas/Parameter.xsd +++ b/Schemas/Parameter.xsd @@ -9,6 +9,11 @@ <xs:pattern value="8|16|32"/>
</xs:restriction>
</xs:simpleType>
+ <xs:simpleType name="SizeType64">
+ <xs:restriction base="xs:positiveInteger">
+ <xs:pattern value="8|16|32|64"/>
+ </xs:restriction>
+ </xs:simpleType>
<xs:attributeGroup name="IntegerParameterAttributes">
<xs:attribute name="Size" type="SizeType" use="required"/>
<xs:attribute name="Min" type="xs:integer" use="optional"/>
@@ -105,14 +110,14 @@ <xs:attribute name="Size" use="required">
<xs:simpleType>
<xs:restriction base="xs:positiveInteger">
- <xs:maxInclusive value="32"/>
+ <xs:maxInclusive value="64"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="Pos" use="required">
<xs:simpleType>
<xs:restriction base="xs:nonNegativeInteger">
- <xs:maxInclusive value="31"/>
+ <xs:maxInclusive value="63"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
@@ -124,7 +129,7 @@ <xs:element name="BitParameter" type="BitParameterType" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attributeGroup ref="Nameable"/>
- <xs:attribute name="Size" type="SizeType" use="required"/>
+ <xs:attribute name="Size" type="SizeType64" use="required"/>
<xs:attribute name="Mapping" type="xs:string" use="optional"/>
</xs:complexType>
<xs:unique name="BitParameterBlockSubElementsUniqueness">
diff --git a/parameter/BitParameter.cpp b/parameter/BitParameter.cpp index 1ee3178..1f1b3b7 100644 --- a/parameter/BitParameter.cpp +++ b/parameter/BitParameter.cpp @@ -81,7 +81,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon } // Rely on integer access - uint32_t uiValue; + uint64_t uiValue; if (bSet) { @@ -102,7 +102,7 @@ bool CBitParameter::accessAsBoolean(bool& bValue, bool bSet, CParameterAccessCon } // Integer Access -bool CBitParameter::accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const +bool CBitParameter::accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const { uint32_t uiOffset = getOffset(); @@ -127,7 +127,7 @@ bool CBitParameter::accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAcce template <typename type> bool CBitParameter::doSet(type value, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const { - uint32_t uiData = 0; + uint64_t uiData = 0; // Read/modify/write CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); @@ -149,7 +149,7 @@ bool CBitParameter::doSet(type value, uint32_t uiOffset, CParameterAccessContext template <typename type> void CBitParameter::doGet(type& value, uint32_t uiOffset, CParameterAccessContext& parameterAccessContext) const { - uint32_t uiData = 0; + uint64_t uiData = 0; // Read blackboard const CParameterBlackboard* pBlackboard = parameterAccessContext.getParameterBlackboard(); @@ -168,7 +168,7 @@ CAreaConfiguration* CBitParameter::createAreaConfiguration(const CSyncerSet* pSy } // Access from area configuration -uint32_t CBitParameter::merge(uint32_t uiOriginData, uint32_t uiNewData) const +uint64_t CBitParameter::merge(uint64_t uiOriginData, uint64_t uiNewData) const { // Convert return static_cast<const CBitParameterType*>(getTypeElement())->merge(uiOriginData, uiNewData); diff --git a/parameter/BitParameter.h b/parameter/BitParameter.h index b7844c7..50e59c6 100644 --- a/parameter/BitParameter.h +++ b/parameter/BitParameter.h @@ -44,7 +44,7 @@ public: virtual bool accessAsBoolean(bool& bValue, bool bSet, CParameterAccessContext& parameterAccessContext) const; // Integer Access - virtual bool accessAsInteger(uint32_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const; + virtual bool accessAsInteger(uint64_t& uiValue, bool bSet, CParameterAccessContext& parameterAccessContext) const; // AreaConfiguration creation virtual CAreaConfiguration* createAreaConfiguration(const CSyncerSet* pSyncerSet) const; @@ -53,7 +53,7 @@ public: uint32_t getBelongingBlockSize() const; // Access from area configuration - uint32_t merge(uint32_t uiOriginData, uint32_t uiNewData) const; + uint64_t merge(uint64_t uiOriginData, uint64_t uiNewData) const; private: // String Access diff --git a/parameter/BitParameterType.cpp b/parameter/BitParameterType.cpp index 6c5a90f..20d29d3 100644 --- a/parameter/BitParameterType.cpp +++ b/parameter/BitParameterType.cpp @@ -31,7 +31,7 @@ #define base CTypeElement -CBitParameterType::CBitParameterType(const string& strName) : base(strName), _uiBitPos(0), _uiBitSize(0), _uiMax(uint32_t(-1)) +CBitParameterType::CBitParameterType(const string& strName) : base(strName), _uiBitPos(0), _uiBitSize(0), _uiMax(uint64_t(-1)) { } @@ -114,13 +114,13 @@ bool CBitParameterType::fromXml(const CXmlElement& xmlElement, CXmlSerializingCo } // Conversion -bool CBitParameterType::toBlackboard(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +bool CBitParameterType::toBlackboard(const string& strValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const { // Hexa bool bValueProvidedAsHexa = !strValue.compare(0, 2, "0x"); // Get value - uint32_t uiConvertedValue = strtoul(strValue.c_str(), NULL, 0); + uint64_t uiConvertedValue = strtoull(strValue.c_str(), NULL, 0); if (uiConvertedValue > _uiMax) { @@ -149,9 +149,9 @@ bool CBitParameterType::toBlackboard(const string& strValue, uint32_t& uiValue, return true; } -void CBitParameterType::fromBlackboard(string& strValue, const uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +void CBitParameterType::fromBlackboard(string& strValue, const uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const { - uint32_t uiConvertedValue = (uiValue & getMask()) >> _uiBitPos; + uint64_t uiConvertedValue = (uiValue & getMask()) >> _uiBitPos; // Format ostringstream strStream; @@ -169,7 +169,7 @@ void CBitParameterType::fromBlackboard(string& strValue, const uint32_t& uiValue // Value access // Integer -bool CBitParameterType::toBlackboard(uint32_t uiUserValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const +bool CBitParameterType::toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const { if (uiUserValue > _uiMax) { @@ -184,7 +184,7 @@ bool CBitParameterType::toBlackboard(uint32_t uiUserValue, uint32_t& uiValue, CP return true; } -void CBitParameterType::fromBlackboard(uint32_t& uiUserValue, uint32_t uiValue, CParameterAccessContext& parameterAccessContext) const +void CBitParameterType::fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const { (void)parameterAccessContext; @@ -192,7 +192,7 @@ void CBitParameterType::fromBlackboard(uint32_t& uiUserValue, uint32_t uiValue, } // Access from area configuration -uint32_t CBitParameterType::merge(uint32_t uiOriginData, uint32_t uiNewData) const +uint64_t CBitParameterType::merge(uint64_t uiOriginData, uint64_t uiNewData) const { return (uiOriginData & ~getMask()) | (uiNewData & getMask()); } @@ -209,19 +209,19 @@ CInstanceConfigurableElement* CBitParameterType::doInstantiate() const } // Max value -uint32_t CBitParameterType::getMaxEncodableValue() const +uint64_t CBitParameterType::getMaxEncodableValue() const { - return (uint32_t)-1L >> (8 * sizeof(uint32_t) - _uiBitSize); + return (uint64_t)-1L >> (8 * sizeof(uint64_t) - _uiBitSize); } // Biwise mask -uint32_t CBitParameterType::getMask() const +uint64_t CBitParameterType::getMask() const { return getMaxEncodableValue() << _uiBitPos; } // Check data has no bit set outside available range -bool CBitParameterType::isEncodable(uint32_t uiData) const +bool CBitParameterType::isEncodable(uint64_t uiData) const { uint32_t uiShift = 8 * sizeof(uiData) - _uiBitSize; diff --git a/parameter/BitParameterType.h b/parameter/BitParameterType.h index 08201da..abf3c47 100644 --- a/parameter/BitParameterType.h +++ b/parameter/BitParameterType.h @@ -42,13 +42,13 @@ public: virtual void toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const; /// Conversion // String - bool toBlackboard(const string& strValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const; - void fromBlackboard(string& strValue, const uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const; + bool toBlackboard(const string& strValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const; + void fromBlackboard(string& strValue, const uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const; // Integer - bool toBlackboard(uint32_t uiUserValue, uint32_t& uiValue, CParameterAccessContext& parameterAccessContext) const; - void fromBlackboard(uint32_t& uiUserValue, uint32_t uiValue, CParameterAccessContext& parameterAccessContext) const; + bool toBlackboard(uint64_t uiUserValue, uint64_t& uiValue, CParameterAccessContext& parameterAccessContext) const; + void fromBlackboard(uint64_t& uiUserValue, uint64_t uiValue, CParameterAccessContext& parameterAccessContext) const; // Access from area configuration - uint32_t merge(uint32_t uiOriginData, uint32_t uiNewData) const; + uint64_t merge(uint64_t uiOriginData, uint64_t uiNewData) const; // Bit Size uint32_t getBitSize() const; @@ -62,16 +62,16 @@ private: // Instantiation virtual CInstanceConfigurableElement* doInstantiate() const; // Max encodable value - uint32_t getMaxEncodableValue() const; + uint64_t getMaxEncodableValue() const; // Biwise mask - uint32_t getMask() const; + uint64_t getMask() const; // Check data has no bit set outside available range - bool isEncodable(uint32_t uiData) const; + bool isEncodable(uint64_t uiData) const; // Pos in bits uint32_t _uiBitPos; // Size in bits uint32_t _uiBitSize; // Max value - uint32_t _uiMax; + uint64_t _uiMax; }; diff --git a/parameter/BitwiseAreaConfiguration.cpp b/parameter/BitwiseAreaConfiguration.cpp index d3ea463..3c07c08 100644 --- a/parameter/BitwiseAreaConfiguration.cpp +++ b/parameter/BitwiseAreaConfiguration.cpp @@ -16,8 +16,8 @@ void CBitwiseAreaConfiguration::copyTo(CParameterBlackboard* pToBlackboard, uint // Beware this code works on little endian architectures only! const CBitParameter* pBitParameter = static_cast<const CBitParameter*>(_pConfigurableElement); - uint32_t uiSrcData = 0; - uint32_t uiDstData = 0; + uint64_t uiSrcData = 0; + uint64_t uiDstData = 0; /// Read/modify/write @@ -39,8 +39,8 @@ void CBitwiseAreaConfiguration::copyFrom(const CParameterBlackboard* pFromBlackb // Beware this code works on little endian architectures only! const CBitParameter* pBitParameter = static_cast<const CBitParameter*>(_pConfigurableElement); - uint32_t uiSrcData = 0; - uint32_t uiDstData = 0; + uint64_t uiSrcData = 0; + uint64_t uiDstData = 0; /// Read/modify/write diff --git a/parameter/Element.cpp b/parameter/Element.cpp index 220005b..aa4f1b1 100644 --- a/parameter/Element.cpp +++ b/parameter/Element.cpp @@ -169,6 +169,15 @@ string CElement::toString(uint32_t uiValue) return ostr.str(); } +string CElement::toString(uint64_t uiValue) +{ + ostringstream ostr; + + ostr << uiValue; + + return ostr.str(); +} + string CElement::toString(int32_t iValue) { ostringstream ostr; diff --git a/parameter/Element.h b/parameter/Element.h index 75171cc..6e5abc9 100644 --- a/parameter/Element.h +++ b/parameter/Element.h @@ -96,6 +96,7 @@ public: // Conversion utilities static string toString(uint32_t uiValue); + static string toString(uint64_t uiValue); static string toString(int32_t iValue); static string toString(double dValue); |