Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions parameter/ArrayParameter.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -34,6 +34,7 @@
#include "ParameterAccessContext.h"
#include "ConfigurationAccessContext.h"
#include "ParameterBlackboard.h"
#include "Utility.h"
#include <assert.h>

#define base CParameter
Expand Down Expand Up @@ -62,7 +63,7 @@ void CArrayParameter::showProperties(string& strResult) const

// Array length
strResult += "Array length: ";
strResult += toString(getArrayLength());
strResult += CUtility::toString(getArrayLength());
strResult += "\n";
}

Expand Down Expand Up @@ -281,7 +282,8 @@ bool CArrayParameter::setValues(uint32_t uiStartIndex, uint32_t uiBaseOffset, co
if (!doSetValue(astrValues[uiValueIndex], uiOffset, parameterAccessContext)) {

// Append parameter path to error
parameterAccessContext.appendToError(" " + getPath() + "/" + toString(uiValueIndex + uiStartIndex));
parameterAccessContext.appendToError(" " + getPath() + "/" +
CUtility::toString(uiValueIndex + uiStartIndex));

return false;
}
Expand Down
5 changes: 3 additions & 2 deletions parameter/BitParameterBlockType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -29,6 +29,7 @@
*/
#include "BitParameterBlockType.h"
#include "BitParameterBlock.h"
#include "Utility.h"

#define base CTypeElement

Expand Down Expand Up @@ -74,7 +75,7 @@ CInstanceConfigurableElement* CBitParameterBlockType::doInstantiate() const
void CBitParameterBlockType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
xmlElement.setAttributeString("Size", toString(_uiSize * 8));
xmlElement.setAttributeString("Size", CUtility::toString(_uiSize * 8));

base::toXml(xmlElement, serializingContext);
}
15 changes: 8 additions & 7 deletions parameter/BitParameterType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -33,6 +33,7 @@
#include <sstream>
#include "ParameterAccessContext.h"
#include "BitParameterBlockType.h"
#include "Utility.h"

#define base CTypeElement

Expand All @@ -55,17 +56,17 @@ void CBitParameterType::showProperties(string& strResult) const

// Bit Pos
strResult += "Bit pos: ";
strResult += toString(_uiBitPos);
strResult += CUtility::toString(_uiBitPos);
strResult += "\n";

// Bit size
strResult += "Bit size: ";
strResult += toString(_uiBitSize);
strResult += CUtility::toString(_uiBitSize);
strResult += "\n";

// Max
strResult += "Max: ";
strResult += toString(_uiMax);
strResult += CUtility::toString(_uiMax);
strResult += "\n";
}

Expand Down Expand Up @@ -245,13 +246,13 @@ bool CBitParameterType::isEncodable(uint64_t uiData) const
void CBitParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Position
xmlElement.setAttributeString("Pos", toString(_uiBitPos));
xmlElement.setAttributeString("Pos", CUtility::toString(_uiBitPos));

// Size
xmlElement.setAttributeString("Size", toString(_uiBitSize));
xmlElement.setAttributeString("Size", CUtility::toString(_uiBitSize));

// Maximum
xmlElement.setAttributeString("Max", toString(_uiMax));
xmlElement.setAttributeString("Max", CUtility::toString(_uiMax));

base::toXml(xmlElement, serializingContext);

Expand Down
25 changes: 8 additions & 17 deletions parameter/ConfigurableElement.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -34,6 +34,7 @@
#include "ConfigurationAccessContext.h"
#include "ConfigurableElementAggregator.h"
#include "AreaConfiguration.h"
#include "Utility.h"
#include <assert.h>

#define base CElement
Expand Down Expand Up @@ -161,7 +162,7 @@ void CConfigurableElement::getListOfElementsWithMapping(
{
// Check parent
const CElement* pParent = getParent();
if (isOfConfigurableElementType(pParent)) {
if (pParent != NULL) {

const CConfigurableElement* pConfigurableElement =
static_cast<const CConfigurableElement*>(pParent);
Expand Down Expand Up @@ -241,7 +242,7 @@ ISyncer* CConfigurableElement::getSyncer() const
// Check parent
const CElement* pParent = getParent();

if (isOfConfigurableElementType(pParent)) {
if (pParent != NULL) {

return static_cast<const CConfigurableElement*>(pParent)->getSyncer();
}
Expand Down Expand Up @@ -310,7 +311,7 @@ void CConfigurableElement::getBelongingDomains(std::list<const CConfigurableDoma
// Check parent
const CElement* pParent = getParent();

if (isOfConfigurableElementType(pParent)) {
if (pParent != NULL) {

static_cast<const CConfigurableElement*>(pParent)->getBelongingDomains(configurableDomainList);
}
Expand Down Expand Up @@ -360,7 +361,7 @@ bool CConfigurableElement::isRogue() const
std::string CConfigurableElement::getFootprintAsString() const
{
// Get size as string
return toString(getFootPrint()) + " byte(s)";
return CUtility::toString(getFootPrint()) + " byte(s)";
}

// Matching check for no domain association
Expand Down Expand Up @@ -465,7 +466,7 @@ bool CConfigurableElement::belongsToDomainAscending(const CConfigurableDomain* p
// Check parent
const CElement* pParent = getParent();

if (isOfConfigurableElementType(pParent)) {
if (pParent != NULL) {

return static_cast<const CConfigurableElement*>(pParent)->belongsTo(pConfigurableDomain);
}
Expand All @@ -478,7 +479,7 @@ const CSubsystem* CConfigurableElement::getBelongingSubsystem() const
const CElement* pParent = getParent();

// Stop at system class
if (!pParent->getParent()) {
if (pParent == NULL) {

return NULL;
}
Expand All @@ -491,13 +492,3 @@ bool CConfigurableElement::isParameter() const
{
return false;
}


// Check parent is still of current type (by structure knowledge)
bool CConfigurableElement::isOfConfigurableElementType(const CElement* pParent) const
{
assert(pParent);

// Up to system class
return !!pParent->getParent();
}
3 changes: 0 additions & 3 deletions parameter/ConfigurableElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,6 @@ class CConfigurableElement : public CElement
void getBelongingDomains(std::list<const CConfigurableDomain*>& configurableDomainList) const;
void listDomains(const std::list<const CConfigurableDomain*>& configurableDomainList, std::string& strResult, bool bVertical) const;

// Check parent is still of current type (by structure knowledge)
bool isOfConfigurableElementType(const CElement* pParent) const;

// Offset in main blackboard
uint32_t _uiOffset;

Expand Down
72 changes: 1 addition & 71 deletions parameter/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <sstream>

using std::string;

Expand Down Expand Up @@ -64,23 +63,6 @@ bool CElement::childrenAreDynamic() const
return false;
}

bool CElement::init(string& strError)
{
uint32_t uiIndex;

for (uiIndex = 0; uiIndex < _childArray.size(); uiIndex++) {

CElement* pElement = _childArray[uiIndex];;

if (!pElement->init(strError)) {

return false;
}
}

return true;
}

void CElement::dumpContent(string& strContent, CErrorContext& errorContext, const uint32_t uiDepth) const
{
string strIndent;
Expand Down Expand Up @@ -127,43 +109,6 @@ void CElement::showProperties(string& strResult) const
strResult += "Kind: " + getKind() + "\n";
}

// Conversion utilities
string CElement::toString(uint32_t uiValue)
{
std::ostringstream ostr;

ostr << uiValue;

return ostr.str();
}

string CElement::toString(uint64_t uiValue)
{
std::ostringstream ostr;

ostr << uiValue;

return ostr.str();
}

string CElement::toString(int32_t iValue)
{
std::ostringstream ostr;

ostr << iValue;

return ostr.str();
}

string CElement::toString(double dValue)
{
std::ostringstream ostr;

ostr << dValue;

return ostr.str();
}

// Content dumping
void CElement::logValue(string& strValue, CErrorContext& errorContext) const
{
Expand Down Expand Up @@ -586,8 +531,7 @@ const CElement* CElement::findChildOfKind(const string& strKind) const

string CElement::getPath() const
{
// Take out root element from the path
if (_pParent && _pParent->_pParent) {
if (_pParent != NULL) {

return _pParent->getPath() + "/" + getPathName();
}
Expand Down Expand Up @@ -627,17 +571,3 @@ uint8_t CElement::computeStructureChecksum() const

return uiChecksum;
}

// Utility to underline
void CElement::appendTitle(string& strTo, const string& strTitle)
{
strTo += "\n" + strTitle + "\n";

string::size_type uiLength = strTitle.size();

while (uiLength--) {

strTo += "=";
}
strTo += "\n";
}
10 changes: 0 additions & 10 deletions parameter/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ class CElement : public IXmlSink, public IXmlSource
std::string getPath() const;
std::string getQualifiedPath() const;

// Creation / build
virtual bool init(std::string& strError);
virtual void clean();

// Children management
Expand Down Expand Up @@ -126,12 +124,6 @@ class CElement : public IXmlSink, public IXmlSource
// Element properties
virtual void showProperties(std::string& strResult) const;

// Conversion utilities
static std::string toString(uint32_t uiValue);
static std::string toString(uint64_t uiValue);
static std::string toString(int32_t iValue);
static std::string toString(double dValue);

// Checksum for integrity checks
uint8_t computeStructureChecksum() const;

Expand All @@ -140,8 +132,6 @@ class CElement : public IXmlSink, public IXmlSource
protected:
// Content dumping
virtual void logValue(std::string& strValue, CErrorContext& errorContext) const;
// Utility to underline
static void appendTitle(std::string& strTo, const std::string& strTitle);

// Hierarchy
CElement* getParent();
Expand Down
5 changes: 3 additions & 2 deletions parameter/EnumParameterType.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -35,6 +35,7 @@
#include <assert.h>
#include "ParameterAccessContext.h"
#include "EnumValuePair.h"
#include "Utility.h"
#include <errno.h>

#define base CParameterType
Expand Down Expand Up @@ -344,7 +345,7 @@ bool CEnumParameterType::isValid(int iNumerical, CParameterAccessContext& parame
void CEnumParameterType::toXml(CXmlElement& xmlElement, CXmlSerializingContext& serializingContext) const
{
// Size
xmlElement.setAttributeString("Size", toString(getSize() * 8));
xmlElement.setAttributeString("Size", CUtility::toString(getSize() * 8));

base::toXml(xmlElement, serializingContext);
}
5 changes: 3 additions & 2 deletions parameter/EnumValuePair.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2014, Intel Corporation
* Copyright (c) 2011-2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
Expand Down Expand Up @@ -28,6 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "EnumValuePair.h"
#include "Utility.h"

#define base CElement

Expand All @@ -51,7 +52,7 @@ int32_t CEnumValuePair::getNumerical() const

string CEnumValuePair::getNumericalAsString() const
{
return toString(_iNumerical);
return CUtility::toString(_iNumerical);
}

// From IXmlSink
Expand Down
Loading