summaryrefslogtreecommitdiffstats
path: root/parameter/Subsystem.h
diff options
context:
space:
mode:
authorFrederic Boisnard <fredericx.boisnard@intel.com>2013-05-23 18:48:58 +0200
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:04:04 +0100
commit6cae0ecf49ec7815aa59a4f4a0ec99976ca38032 (patch)
tree36cc121db7d4ff68c665fb153f5b0dc7da62d679 /parameter/Subsystem.h
parent390b36d8129d3ece769c8542d9d3d3895ab13fbb (diff)
downloadexternal_parameter-framework-6cae0ecf49ec7815aa59a4f4a0ec99976ca38032.zip
external_parameter-framework-6cae0ecf49ec7815aa59a4f4a0ec99976ca38032.tar.gz
external_parameter-framework-6cae0ecf49ec7815aa59a4f4a0ec99976ca38032.tar.bz2
Add showMapping command to the PFW
BZ: 99822 Developers often need to get the mapping corresponding to a specific parameter. However, the PFW doesn't provide a command to achieve this goal. This patch aims to add the showMapping command to the PFW. Change-Id: I05af64a408abe4ceb7f5d177a0ff5fa0461034d0 Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com> Reviewed-on: http://android.intel.com:8080/105145 Reviewed-by: Benavoli, Patrick <patrick.benavoli@intel.com> Reviewed-by: Denneulin, Guillaume <guillaume.denneulin@intel.com> Reviewed-by: Gonzalve, Sebastien <sebastien.gonzalve@intel.com> Tested-by: Barthes, FabienX <fabienx.barthes@intel.com> Reviewed-by: buildbot <buildbot@intel.com> Tested-by: buildbot <buildbot@intel.com>
Diffstat (limited to 'parameter/Subsystem.h')
-rw-r--r--parameter/Subsystem.h119
1 files changed, 102 insertions, 17 deletions
diff --git a/parameter/Subsystem.h b/parameter/Subsystem.h
index 996b546..277ff25 100644
--- a/parameter/Subsystem.h
+++ b/parameter/Subsystem.h
@@ -1,4 +1,4 @@
-/*
+/*
* INTEL CONFIDENTIAL
* Copyright © 2011 Intel
* Corporation All Rights Reserved.
@@ -34,6 +34,7 @@ class CInstanceDefinition;
class CComponentLibrary;
class CSubsystemObject;
class CSubsystemObjectCreator;
+class CInstanceConfigurableElement;
class CSubsystem : public CConfigurableElement, private IMapper
{
@@ -60,6 +61,23 @@ public:
// from CElement
virtual string getKind() const;
+
+ /**
+ * Fetch mapping data of an element.
+ *
+ * The mapping is represented as a string of all the mapping data (key:value) defined in the
+ * context of the element.
+ * This method gathers the mapping data found in each Element of the configurableElementPath
+ * list to format the resulting string.
+ *
+ * @param[in] configurableElementPath List of all the ConfigurableElements found
+ * that have a mapping. Elements are added at the end of the list, so the root Element will be
+ * the last one.
+ *
+ * @return Formatted string of the mapping data
+ */
+ virtual string getMapping(list<const CConfigurableElement*>& configurableElementPath) const;
+
protected:
// Parameter access
virtual bool accessValue(CPathNavigator& pathNavigator, string& strValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;
@@ -83,19 +101,6 @@ private:
bool mapSubsystemElements(string& strError);
/**
- * Generic subsystem mapping error handling
- *
- * Format an human readable error string from a key and a message in case of mapping error
- *
- * @param[out] strError The formated error string
- * @param[in] strKey The key on which the error refers
- * @param[in] strMessage The error message
- * @param[in] pInstanceConfigurableElement The element on wich the error refers
- */
- void getMappingError(string& strError, const string& strKey, const string& strMessage,
- const CInstanceConfigurableElement* pInstanceConfigurableElement);
-
- /**
* Handle a configurable element mapping.
*
* Add context mappings to the context and instantiate a subsystem object if needed.
@@ -112,8 +117,87 @@ private:
virtual bool mapBegin(CInstanceConfigurableElement* pInstanceConfigurableElement, bool& bKeepDiving, string& strError);
virtual void mapEnd();
- // Mapping generic context handling
- bool handleMappingContext(const CInstanceConfigurableElement* pInstanceConfigurableElement, CMappingContext& context, string& strError);
+ // Mapping access
+ /**
+ * Generic mapping error handling
+ *
+ * Format an human readable error string from a key and a message in case of mapping error
+ *
+ * @param[in] strKey The key on which the error refers
+ * @param[in] strMessage The error message
+ * @param[in] pInstanceConfigurableElement The element on wich the error refers
+ *
+ * returns The formated error string
+ */
+ string getMappingError(const string& strKey,
+ const string& strMessage,
+ const CInstanceConfigurableElement* pInstanceConfigurableElement) const;
+
+ /**
+ * Format the mapping data of the ConfigurableElements that have been gathered through recursive
+ * calls to the getMapping() method.
+ * These elements shall be evaluated from the root level to the leaves level, so the list must
+ * be parsed in reverse order.
+ *
+ * @param[in] configurableElementPath List of ConfigurableElements containing mapping data
+ *
+ * @return String containing the formatted mapping
+ */
+ string formatMappingDataList(
+ const list<const CConfigurableElement*>& configurableElementPath) const;
+
+ /**
+ * Find the SubystemObject which contains a specific CInstanceConfigurableElement.
+ *
+ * @param[in] pInstanceConfigurableElement The CInstanceConfigurableElement that is related to
+ * the wanted SubsystemObject. Each SubsystemObject of the Subystem internal list is checked in
+ * order to find a match.
+ *
+ * @return A pointer to the SubsystemObject related to pInstanceConfigurableElement
+ */
+ const CSubsystemObject* findSubsystemObjectFromConfigurableElement(
+ const CInstanceConfigurableElement* pInstanceConfigurableElement) const;
+
+ /**
+ * Find the mapping data defined for the CInstanceConfigurableElement given in parameter, that
+ * corresponds to Susbystem level mapping (Susbystem level mapping keys are defined in
+ * CSubsystemObjectCreator classes).
+ * The CInstanceConfigurableElement might as well contain local mapping data.
+ *
+ * @param[in] pInstanceConfigurableElement The element which mapping data will be parsed for
+ * a match
+ * @param[out] strMappingKey Mapping key defined at the Subsystem level
+ * @param[out] strMappingValue Mapping value contained in pInstanceConfigurableElement
+ */
+ void findSusbystemLevelMappingKeyValue(
+ const CInstanceConfigurableElement* pInstanceConfigurableElement,
+ string& strMappingKey,
+ string& strMappingValue) const;
+
+ /**
+ * Formats the mapping of a SubsystemObject
+ *
+ * @param[in] pInstanceConfigurableElement Element corresponding to a SubsystemObject
+ *
+ * @return String containing the formatted mapping
+ */
+ string getFormattedSubsystemMappingData(
+ const CInstanceConfigurableElement* pInstanceConfigurableElement) const;
+ /**
+ * Generic context handling
+ *
+ * Feed context with mapping data of the current element
+ *
+ * @param[in] pInstanceConfigurableElement The element containing mapping data
+ * @param[in] contextMappingKeyArray The list of keys of the context mapping
+ * @param[out] context The context mapping to update with the current element mapping values
+ * @param[out] strError The formated error string
+ * @return true on success
+ */
+ bool handleMappingContext(const CInstanceConfigurableElement* pInstanceConfigurableElement,
+ const vector<string>& contextMappingKeyArray,
+ CMappingContext& context,
+ string& strError) const;
/**
* Looks if a subsystem object needs to be instantiated for the given configurable
@@ -130,7 +214,8 @@ private:
* @return true on success, false on failure
*/
bool handleSubsystemObjectCreation(CInstanceConfigurableElement* pInstanceConfigurableElement,
- CMappingContext& context, bool& bHasCreatedSubsystemObject, string& strError);
+ CMappingContext& context, bool& bHasCreatedSubsystemObject,
+ string& strError);
// Subsystem context mapping keys
vector<string> _contextMappingKeyArray;