aboutsummaryrefslogtreecommitdiffstats
path: root/parameter
diff options
context:
space:
mode:
Diffstat (limited to 'parameter')
-rw-r--r--parameter/Android.mk2
-rw-r--r--parameter/CMakeLists.txt3
-rw-r--r--parameter/ParameterMgrLogger.h21
-rw-r--r--parameter/ParameterMgrPlatformConnector.cpp2
-rw-r--r--parameter/include/ParameterMgrLoggerForward.h (renamed from parameter/ParameterMgrLogger.cpp)19
-rw-r--r--parameter/include/ParameterMgrPlatformConnector.h6
6 files changed, 24 insertions, 29 deletions
diff --git a/parameter/Android.mk b/parameter/Android.mk
index aaa40ea..247c745 100644
--- a/parameter/Android.mk
+++ b/parameter/Android.mk
@@ -34,6 +34,7 @@ LOCAL_PATH := $(call my-dir)
common_copy_headers_to := parameter
common_copy_headers := \
+ include/ParameterMgrLoggerForward.h \
include/ParameterMgrPlatformConnector.h \
include/SelectionCriterionTypeInterface.h \
include/SelectionCriterionInterface.h \
@@ -92,7 +93,6 @@ common_src_files := \
BitParameterType.cpp \
BitParameter.cpp \
ElementLocator.cpp \
- ParameterMgrLogger.cpp \
AutoLog.cpp \
CompoundRule.cpp \
SelectionCriterionRule.cpp \
diff --git a/parameter/CMakeLists.txt b/parameter/CMakeLists.txt
index 50fc15b..590c7b1 100644
--- a/parameter/CMakeLists.txt
+++ b/parameter/CMakeLists.txt
@@ -79,7 +79,6 @@ add_library(parameter SHARED
BitParameterType.cpp
BitParameter.cpp
ElementLocator.cpp
- ParameterMgrLogger.cpp
AutoLog.cpp
CompoundRule.cpp
SelectionCriterionRule.cpp
@@ -153,7 +152,6 @@ add_library(parameter SHARED
BitParameterType.cpp
BitParameter.cpp
ElementLocator.cpp
- ParameterMgrLogger.cpp
AutoLog.cpp
CompoundRule.cpp
SelectionCriterionRule.cpp
@@ -189,6 +187,7 @@ install(TARGETS parameter LIBRARY DESTINATION lib)
# Client headers
install(FILES
include/ParameterHandle.h
+ include/ParameterMgrLoggerForward.h
include/ParameterMgrPlatformConnector.h
include/SelectionCriterionInterface.h
include/SelectionCriterionTypeInterface.h
diff --git a/parameter/ParameterMgrLogger.h b/parameter/ParameterMgrLogger.h
index 5a8dd9d..0e42d8a 100644
--- a/parameter/ParameterMgrLogger.h
+++ b/parameter/ParameterMgrLogger.h
@@ -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,
@@ -29,22 +29,29 @@
*/
#pragma once
+#include "ParameterMgrLoggerForward.h"
#include "ParameterMgr.h"
#include <string>
-class CParameterMgrPlatformConnector;
-
+/* Wrap a class to expose its logging [log(bool, string&)] capabilities
+ * through ILogger. */
+template<class T>
class CParameterMgrLogger : public CParameterMgr::ILogger
{
public:
- CParameterMgrLogger(CParameterMgrPlatformConnector* pParameterMgrPlatformConnector);
+ CParameterMgrLogger(T& parameterMgrConnector) :
+ _parameterMgrConnector(parameterMgrConnector)
+ {
+ }
- // Logging
- virtual void log(bool bIsWarning, const std::string& strLog);
+ virtual void log(bool bIsWarning, const std::string& strLog)
+ {
+ _parameterMgrConnector.doLog(bIsWarning, strLog);
+ }
private:
// Log destination
- CParameterMgrPlatformConnector* _pParameterMgrPlatformConnector;
+ T& _parameterMgrConnector;
};
diff --git a/parameter/ParameterMgrPlatformConnector.cpp b/parameter/ParameterMgrPlatformConnector.cpp
index b98692c..7a8511b 100644
--- a/parameter/ParameterMgrPlatformConnector.cpp
+++ b/parameter/ParameterMgrPlatformConnector.cpp
@@ -40,7 +40,7 @@ CParameterMgrPlatformConnector::CParameterMgrPlatformConnector(
_pParameterMgr(new CParameterMgr(strConfigurationFilePath)), _bStarted(false), _pLogger(NULL)
{
// Logging
- _pParameterMgrLogger = new CParameterMgrLogger(this);
+ _pParameterMgrLogger = new CParameterMgrLogger<CParameterMgrPlatformConnector>(*this);
_pParameterMgr->setLogger(_pParameterMgrLogger);
}
diff --git a/parameter/ParameterMgrLogger.cpp b/parameter/include/ParameterMgrLoggerForward.h
index ddd81ef..28b26db 100644
--- a/parameter/ParameterMgrLogger.cpp
+++ b/parameter/include/ParameterMgrLoggerForward.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2014, Intel Corporation
+ * Copyright (c) 2015, Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
@@ -27,18 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "ParameterMgrLogger.h"
-#include "ParameterMgrPlatformConnector.h"
+#pragma once
-
-using std::string;
-
-CParameterMgrLogger::CParameterMgrLogger(CParameterMgrPlatformConnector *pParameterMgrPlatformConnector) :
- _pParameterMgrPlatformConnector(pParameterMgrPlatformConnector)
-{
-}
-
-void CParameterMgrLogger::log(bool bIsWarning, const string &strLog)
-{
- _pParameterMgrPlatformConnector->doLog(bIsWarning, strLog);
-}
+// Shared forward declaration, to ensure declaration alignment
+template<class T> class CParameterMgrLogger;
diff --git a/parameter/include/ParameterMgrPlatformConnector.h b/parameter/include/ParameterMgrPlatformConnector.h
index d489545..baa0e7e 100644
--- a/parameter/include/ParameterMgrPlatformConnector.h
+++ b/parameter/include/ParameterMgrPlatformConnector.h
@@ -32,13 +32,13 @@
#include "SelectionCriterionTypeInterface.h"
#include "SelectionCriterionInterface.h"
#include "ParameterHandle.h"
+#include "ParameterMgrLoggerForward.h"
class CParameterMgr;
-class CParameterMgrLogger;
class CParameterMgrPlatformConnector
{
- friend class CParameterMgrLogger;
+ friend class CParameterMgrLogger<CParameterMgrPlatformConnector>;
public:
// Logger interface
class ILogger
@@ -144,5 +144,5 @@ private:
// Logging
ILogger* _pLogger;
// Private logging
- CParameterMgrLogger* _pParameterMgrLogger;
+ CParameterMgrLogger<CParameterMgrPlatformConnector>* _pParameterMgrLogger;
};