Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
df01d8b
Remove unused AutoLog header from SelectionCriterion class
clero Feb 26, 2015
f2dd767
Move logging up to ParameterMgr
clero Mar 2, 2015
249f328
Introduce Results type to avoid copy paste
clero Mar 10, 2015
c58e516
Remove plugin load attempt log
clero Mar 3, 2015
2f66b4f
Remove unused XmlFileIncluderElement header from ParameterMgr
clero Mar 3, 2015
00a4af2
Remove log from XmlFileIncluderElement
clero Mar 3, 2015
f9ff872
Delegate addValuePair error logging to client
clero Mar 3, 2015
36b3b1d
Temporarily remove Subsystems logging ability
clero Feb 26, 2015
5f56c58
Change Criterion modifications counter type
clero Apr 13, 2015
1554cfe
Rework project log
clero Feb 25, 2015
8eb4c34
Remove unused remote-processor include location from test-subsystem
clero Apr 7, 2015
ca361e3
Enable subsystems logging
clero Mar 4, 2015
e85bd06
Update Skeleton Subsystem for log ability.
clero Mar 5, 2015
390f97c
Update domainGenerator python script to use the new log API
clero Apr 2, 2015
3cfeff4
Merge pull request #87 from clero/log_contextualisable_subsystems int…
dawagner Apr 14, 2015
8b3253d
README: change url to CI badges for the 'next' branch
dawagner Apr 14, 2015
5ab361d
Merge remote-tracking branch 'master' into next
dawagner Apr 14, 2015
620e27f
Remove init function member from Element
clero Mar 11, 2015
1f10e60
Move toString and appendtitle out of element
OznOg Feb 28, 2015
90e6d75
Remove SelectionCriteria based subtree from structure checksum.
clero Mar 12, 2015
cc344d6
Avoid ParameterManager inheritance to Element god class.
clero Mar 11, 2015
34880fe
Enable C++11
clero Feb 23, 2015
9fb6747
Remove unused ISelectionCriterionObserver forward declaration
clero Mar 16, 2015
7e955e8
Avoid SelectionCriteria Element inheritance
clero Mar 12, 2015
6a5216d
Avoid SelectionCriterionLibrary Element inheritance
clero Mar 16, 2015
48471a7
Avoid SelectionCriteriaDefinition Element inheritance
clero Mar 16, 2015
034d6ef
Avoid Element inheritance in the whole criterion tree.
clero Mar 13, 2015
7eb381f
Remove useless SelectionCriterionLibrary delegate
clero Mar 17, 2015
6f53863
Remove SelectionCriteriaDefinition delegate
clero Mar 17, 2015
1e43070
Remove Strategy Design pattern use for Criterion type
clero Mar 17, 2015
fca6135
Rework SelectionCriterionRule matching functions
clero Mar 19, 2015
3a4690d
Add none value pair of InclusiveCriterion through initialization list
clero Mar 19, 2015
3f2d1ee
Make a separate library for Criteria
clero Mar 20, 2015
af01e35
criterion fix
clero Apr 8, 2015
fefacf2
Type criterion name consistency
clero Apr 9, 2015
06f8027
Add unit test to criterion lib
clero Apr 6, 2015
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ after_success:
--exclude "skeleton-subsystem"
--exclude "test/test-subsystem"
--exclude "bindings/c/Test.cpp"
--exclude "parameter/criterion/test/"
--exclude "test/tokenizer"
--gcov-options '\--long-file-names --preserve-paths'

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ endif(COMMAND cmake_policy)

project(parameter-framework)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -std=c++11")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# parameter-framework

[![Build Status](https://travis-ci.org/01org/parameter-framework.svg?branch=master)](https://travis-ci.org/01org/parameter-framework)
[![Coverage Status](https://coveralls.io/repos/01org/parameter-framework/badge.svg?branch=master)](https://coveralls.io/r/01org/parameter-framework)
[![Build Status](https://travis-ci.org/01org/parameter-framework.svg?branch=next)](https://travis-ci.org/01org/parameter-framework)
[![Coverage Status](https://coveralls.io/repos/01org/parameter-framework/badge.svg?branch=next)](https://coveralls.io/r/01org/parameter-framework)

## Introduction

Expand Down
4 changes: 3 additions & 1 deletion bindings/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@

add_library(cparameter SHARED ParameterFramework.cpp)

include_directories("${PROJECT_SOURCE_DIR}/parameter/include")
include_directories(
"${PROJECT_SOURCE_DIR}/parameter/criterion/include"
"${PROJECT_SOURCE_DIR}/parameter/include")

install(FILES ParameterFramework.h
DESTINATION "include/parameter/c")
Expand Down
38 changes: 25 additions & 13 deletions bindings/c/ParameterFramework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@
#include <cstdlib>

using std::string;
using core::selection::criterion::CriterionInterface;

/** Rename long pfw types to short ones in pfw namespace. */
namespace pfw
{
typedef ISelectionCriterionInterface Criterion;
typedef CriterionInterface Criterion;
typedef std::map<string, Criterion *> Criteria;
typedef CParameterMgrPlatformConnector Pfw;
}
Expand Down Expand Up @@ -105,15 +106,24 @@ class LogWrapper : public CParameterMgrPlatformConnector::ILogger
LogWrapper() : mLogger() {}
virtual ~LogWrapper() {}
private:
virtual void log(bool bIsWarning, const string &strLog)
virtual void info(const string &msg)
{
log(pfwLogInfo, msg);
}

virtual void warning(const string &msg)
{
log(pfwLogWarning, msg);
}

void log(PfwLogLevel level, const string &strLog)
{
// A LogWrapper should NOT be register to the pfw (thus log called)
// if logCb is NULL.
assert(mLogger.logCb != NULL);
mLogger.logCb(mLogger.userCtx,
bIsWarning ? pfwLogWarning : pfwLogInfo,
strLog.c_str());
mLogger.logCb(mLogger.userCtx, level, strLog.c_str());
}

PfwLogger mLogger;
};

Expand Down Expand Up @@ -178,10 +188,11 @@ bool PfwHandler::createCriteria(const PfwCriterion criteriaArray[], size_t crite
"\" already exist");
}

// Create criterion type
ISelectionCriterionTypeInterface *type =
pfw->createSelectionCriterionType(criterion.inclusive);
assert(type != NULL);
// Create criterion
CriterionInterface *newCriterion = (criterion.inclusive ?
pfw->createInclusiveCriterion(criterion.name) :
pfw->createExclusiveCriterion(criterion.name));
assert(newCriterion != NULL);
// Add criterion values
for (size_t valueIndex = 0; criterion.values[valueIndex] != NULL; ++valueIndex) {
int value;
Expand All @@ -196,13 +207,14 @@ bool PfwHandler::createCriteria(const PfwCriterion criteriaArray[], size_t crite
value = valueIndex;
}
const char * valueName = criterion.values[valueIndex];
if(not type->addValuePair(value, valueName)) {
string error;
if(not newCriterion->addValuePair(value, valueName, error)) {
return status.failure("Could not add value " + string(valueName) +
" to criterion " + criterion.name);
" to criterion " + criterion.name + ": " + error);
}
}
// Create criterion and add it to the pfw
criteria[criterion.name] = pfw->createSelectionCriterion(criterion.name, type);
// Add new criterion to criteria list
criteria[criterion.name] = newCriterion;
}
return status.success();
}
Expand Down
11 changes: 11 additions & 0 deletions bindings/c/Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,17 @@ TEST_CASE_METHOD(Test, "Parameter-framework c api use") {
REQUIRE(value == 3);
}
}
WHEN("Set a new value to a criterion without committing first") {
const char *criterionName = criteria[0].name;
REQUIRE_SUCCESS(pfwSetCriterion(pfw, criterionName, 0));
THEN("A warning message should have been displayed") {
INFO("Previous pfw log: \n" + logLines);
size_t logPos = logLines.find("Warning: Selection criterion "
"'inclusiveCrit' has been modified 1 time(s)"
" without any configuration application");
CHECK(logPos != std::string::npos);
}
}
}
WHEN("Commit criteria without a pfw") {
REQUIRE(not pfwApplyConfigurations(NULL));
Expand Down
4 changes: 3 additions & 1 deletion bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ find_package(PythonInterp 2.7 REQUIRED)
find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})

include_directories(${PROJECT_SOURCE_DIR}/parameter/include)
include_directories(
${PROJECT_SOURCE_DIR}/parameter/include
${PROJECT_SOURCE_DIR}/parameter/criterion/include)

set_property(SOURCE pfw.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE pfw.i PROPERTY SWIG_FLAGS "-Wall" "-Werror")
Expand Down
53 changes: 29 additions & 24 deletions bindings/python/pfw.i
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ public:

void setLogger(ILogger* pLogger);

ISelectionCriterionTypeInterface* createSelectionCriterionType(bool bIsInclusive);
ISelectionCriterionInterface* createSelectionCriterion(const std::string& strName,
const ISelectionCriterionTypeInterface* pSelectionCriterionType);
ISelectionCriterionInterface* getSelectionCriterion(const std::string& strName);
core::selection::criterion::CriterionInterface*
createExclusiveCriterion(const std::string& name);

core::selection::criterion::CriterionInterface*
createInclusiveCriterion(const std::string& name);

core::selection::criterion::CriterionInterface*
getSelectionCriterion(const std::string& name);

// Configuration application
void applyConfigurations();
Expand Down Expand Up @@ -182,43 +186,44 @@ public:
class ILogger
{
public:
virtual void log(bool bIsWarning, const std::string& strLog) = 0;
virtual void info(const std::string& log) = 0;
virtual void warning(const std::string& log) = 0;
protected:
virtual ~ILogger() {}
};
%{
typedef CParameterMgrFullConnector::ILogger ILogger;
%}

class ISelectionCriterionTypeInterface
namespace core
{
namespace selection
{
namespace criterion
{
%{
#include "SelectionCriterionTypeInterface.h"
%}

public:
virtual bool addValuePair(int iValue, const std::string& strValue) = 0;
virtual bool getNumericalValue(const std::string& strValue, int& iValue) const = 0;
virtual bool getLiteralValue(int iValue, std::string& strValue) const = 0;
virtual bool isTypeInclusive() const = 0;
virtual std::string getFormattedState(int iValue) const = 0;

protected:
virtual ~ISelectionCriterionTypeInterface() {}
};

class ISelectionCriterionInterface
class CriterionInterface
{
%{
#include "SelectionCriterionInterface.h"
#include <criterion/client/CriterionInterface.h>
%}

public:
virtual void setCriterionState(int iState) = 0;
virtual int getCriterionState() const = 0;
virtual std::string getCriterionName() const = 0;
virtual const ISelectionCriterionTypeInterface* getCriterionType() const = 0;
virtual bool addValuePair(int numericalValue,
const std::string& literalValue,
std::string& error) = 0;
virtual bool getNumericalValue(const std::string& literalValue, int& numericalValue) const = 0;
virtual bool getLiteralValue(int numericalValue, std::string& literalValue) const = 0;
virtual std::string getFormattedState() const = 0;
virtual bool isInclusive() const = 0;

protected:
virtual ~ISelectionCriterionInterface() {}
virtual ~CriterionInterface() {}
};

} /** criterion namespace */
} /** selection namespace */
} /** core namespace */
9 changes: 6 additions & 3 deletions parameter/Android.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 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 @@ -44,7 +44,6 @@ common_copy_headers := \
common_src_files := \
AreaConfiguration.cpp \
ArrayParameter.cpp \
AutoLog.cpp \
BaseParameter.cpp \
BinarySerializableElement.cpp \
BinaryStream.cpp \
Expand Down Expand Up @@ -129,6 +128,7 @@ common_cflags := \

common_c_includes := \
$(LOCAL_PATH)/include/ \
$(LOCAL_PATH)/log/include/ \
$(LOCAL_PATH)/../utility/ \
$(LOCAL_PATH)/../xmlserializer/ \
$(LOCAL_PATH)/../remote-processor/
Expand Down Expand Up @@ -197,7 +197,10 @@ include $(CLEAR_VARS)
LOCAL_MODULE := $(common_module)_includes
LOCAL_MODULE_OWNER := intel

LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDE_DIRS := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/log/include


LOCAL_STATIC_LIBRARIES := \
libxmlserializer \
Expand Down
8 changes: 5 additions & 3 deletions parameter/AreaConfiguration.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 @@ -54,14 +54,16 @@ void CAreaConfiguration::save(const CParameterBlackboard* pMainBlackboard)
}

// Apply data to current
bool CAreaConfiguration::restore(CParameterBlackboard* pMainBlackboard, bool bSync, std::list<std::string>* plstrError) const
bool CAreaConfiguration::restore(CParameterBlackboard* pMainBlackboard,
bool bSync,
core::Results* errors) const
{
assert(_bValid);

copyTo(pMainBlackboard, _pConfigurableElement->getOffset());

// Synchronize if required
return !bSync || _pSyncerSet->sync(*pMainBlackboard, false, plstrError);
return !bSync || _pSyncerSet->sync(*pMainBlackboard, false, errors);
}

// Ensure validity
Expand Down
13 changes: 10 additions & 3 deletions parameter/AreaConfiguration.h
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 @@ -32,6 +32,7 @@
#include "ParameterBlackboard.h"
#include "BinaryStream.h"
#include "SyncerSet.h"
#include "Results.h"

class CConfigurableElement;
class CXmlElement;
Expand All @@ -48,8 +49,14 @@ class CAreaConfiguration
// Save data from current
void save(const CParameterBlackboard* pMainBlackboard);

// Apply data to current
bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, std::list<std::string>* plstrError) const;
/** Restore the configuration area
*
* @param[in] pMainBlackboard the application main blackboard
* @param[in] bSync indicates if a synchronisation has to be done
* @param[out] errors, errors encountered during restoration
* @return true if success false otherwise
*/
bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, core::Results* errors) const;

// Ensure validity
void validate(const CParameterBlackboard* pMainBlackboard);
Expand Down
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
Loading