16cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard/* 2b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * Copyright (c) 2011-2014, Intel Corporation 3b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * All rights reserved. 4b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 5b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * Redistribution and use in source and binary forms, with or without modification, 6b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * are permitted provided that the following conditions are met: 7b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 8b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 1. Redistributions of source code must retain the above copyright notice, this 9b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * list of conditions and the following disclaimer. 10b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 11b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 2. Redistributions in binary form must reproduce the above copyright notice, 12b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * this list of conditions and the following disclaimer in the documentation and/or 13b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * other materials provided with the distribution. 14b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 15b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 3. Neither the name of the copyright holder nor the names of its contributors 16b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * may be used to endorse or promote products derived from this software without 17b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * specific prior written permission. 18b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * 19b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 23b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2968a912857707864bbaaff9808717813105072a6ePatrick Benavoli */ 3068a912857707864bbaaff9808717813105072a6ePatrick Benavoli#pragma once 3168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 3268a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "ConfigurableElement.h" 3301c7495e66caea59165316bc025a69cce1383311David Wagner#include "ConfigurableElementWithMapping.h" 3468a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "Mapper.h" 3568a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "MappingContext.h" 36d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve#include <list> 3768a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include <stack> 38d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve#include <string> 3968a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include <vector> 4068a912857707864bbaaff9808717813105072a6ePatrick Benavoli 4168a912857707864bbaaff9808717813105072a6ePatrick Benavoliclass CInstanceDefinition; 4268a912857707864bbaaff9808717813105072a6ePatrick Benavoliclass CComponentLibrary; 4368a912857707864bbaaff9808717813105072a6ePatrick Benavoliclass CSubsystemObject; 4468a912857707864bbaaff9808717813105072a6ePatrick Benavoliclass CSubsystemObjectCreator; 456cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnardclass CInstanceConfigurableElement; 4601c7495e66caea59165316bc025a69cce1383311David Wagnerclass CMappingData; 4768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 4801c7495e66caea59165316bc025a69cce1383311David Wagnerclass CSubsystem : public CConfigurableElementWithMapping, private IMapper 4968a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 5068a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Subsystem objects iterator 51d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve typedef std::list<CSubsystemObject*>::const_iterator SubsystemObjectListIterator; 5268a912857707864bbaaff9808717813105072a6ePatrick Benavolipublic: 53d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve CSubsystem(const std::string& strName); 5468a912857707864bbaaff9808717813105072a6ePatrick Benavoli virtual ~CSubsystem(); 5568a912857707864bbaaff9808717813105072a6ePatrick Benavoli 5668a912857707864bbaaff9808717813105072a6ePatrick Benavoli // From IXmlSink 5768a912857707864bbaaff9808717813105072a6ePatrick Benavoli virtual bool fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext); 5868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 5968a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Susbsystem Endianness 6068a912857707864bbaaff9808717813105072a6ePatrick Benavoli bool isBigEndian() const; 6168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 62f2fd15a331fd3b5b63f0dc6f492651330adcedf9Guillaume Denneulin // Susbsystem sanity 63f2fd15a331fd3b5b63f0dc6f492651330adcedf9Guillaume Denneulin virtual bool isAlive() const; 64f2fd15a331fd3b5b63f0dc6f492651330adcedf9Guillaume Denneulin 65f2fd15a331fd3b5b63f0dc6f492651330adcedf9Guillaume Denneulin // Resynchronization after subsystem restart needed 66f2fd15a331fd3b5b63f0dc6f492651330adcedf9Guillaume Denneulin virtual bool needResync(bool bClear); 67f2fd15a331fd3b5b63f0dc6f492651330adcedf9Guillaume Denneulin 6868a912857707864bbaaff9808717813105072a6ePatrick Benavoli // XML configuration settings parsing 696ba361d96bc2581667b3400f87ff89fae6449e1fPatrick Benavoli virtual bool serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const; 7068a912857707864bbaaff9808717813105072a6ePatrick Benavoli 7168a912857707864bbaaff9808717813105072a6ePatrick Benavoli // from CElement 72d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve virtual std::string getKind() const; 736cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard 7401c7495e66caea59165316bc025a69cce1383311David Wagner virtual bool getMappingData(const std::string& strKey, const std::string*& pStrValue) const; 7501c7495e66caea59165316bc025a69cce1383311David Wagner 766cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard /** 776cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * Fetch mapping data of an element. 786cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 79d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve * The mapping is represented as a std::string of all the mapping data (key:value) defined in the 806cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * context of the element. 816cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * This method gathers the mapping data found in each Element of the configurableElementPath 82d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve * list to format the resulting std::string. 836cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 846cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[in] configurableElementPath List of all the ConfigurableElements found 856cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * that have a mapping. Elements are added at the end of the list, so the root Element will be 866cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * the last one. 876cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 88d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve * @return Formatted std::string of the mapping data 896cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard */ 90d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve virtual std::string getMapping(std::list<const CConfigurableElement*>& configurableElementPath) const; 916cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard 9268a912857707864bbaaff9808717813105072a6ePatrick Benavoliprotected: 9368a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Parameter access 94d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve virtual bool accessValue(CPathNavigator& pathNavigator, std::string& strValue, bool bSet, CParameterAccessContext& parameterAccessContext) const; 95d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve virtual void logValue(std::string& strValue, CErrorContext& errorContext) const; 966ccab9d382c08323fb1f000d859a696f05719c92Patrick Benavoli // Used for simulation and virtual subsystems 9768a912857707864bbaaff9808717813105072a6ePatrick Benavoli virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const; 9868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 9968a912857707864bbaaff9808717813105072a6ePatrick Benavoli /// Functionality intendedn for derived Subsystems 10068a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Subsystem context mapping keys publication 101d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve void addContextMappingKey(const std::string& strMappingKey); 10268a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Subsystem object creator publication (strong reference) 1036ba361d96bc2581667b3400f87ff89fae6449e1fPatrick Benavoli void addSubsystemObjectFactory(CSubsystemObjectCreator* pSubsystemObjectCreator); 10468a912857707864bbaaff9808717813105072a6ePatrick Benavoliprivate: 1054ebc0984c7afe9a6f0168169d5141421b4adcc67JhinX Lee CSubsystem(const CSubsystem&); 1064ebc0984c7afe9a6f0168169d5141421b4adcc67JhinX Lee CSubsystem& operator=(const CSubsystem&); 1074ebc0984c7afe9a6f0168169d5141421b4adcc67JhinX Lee 10868a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Belonging subsystem 10968a912857707864bbaaff9808717813105072a6ePatrick Benavoli virtual const CSubsystem* getBelongingSubsystem() const; 11068a912857707864bbaaff9808717813105072a6ePatrick Benavoli 11168a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Mapping execution 112d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve bool mapSubsystemElements(std::string& strError); 11368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 1143414f994f9d2bf971caa4abd03932529619a81ecKevin Rocard /** 115084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * Handle a configurable element mapping. 116084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * 117084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * Add context mappings to the context and instantiate a subsystem object if needed. 118084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * 119084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * @param[in:out] pInstanceConfigurableElement The configurable element 120084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * @param[out] bKeepDiving Keep diving for mapping keys 121084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard Is set to true if a subsystem object (tree leave) has been instantiated. 122084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard Undetermined on error 123084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * @param[out] strError String filled with an human readable error on error, 124084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard left unmodified otherwise 125084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * 126084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * @return true on success, false on failure 127084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard */ 128d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve virtual bool mapBegin(CInstanceConfigurableElement* pInstanceConfigurableElement, bool& bKeepDiving, std::string& strError); 12968a912857707864bbaaff9808717813105072a6ePatrick Benavoli virtual void mapEnd(); 13068a912857707864bbaaff9808717813105072a6ePatrick Benavoli 1316cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard // Mapping access 1326cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard /** 1336cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * Generic mapping error handling 1346cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 135d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve * Format an human readable error std::string from a key and a message in case of mapping error 1366cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 1376cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[in] strKey The key on which the error refers 1386cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[in] strMessage The error message 13901c7495e66caea59165316bc025a69cce1383311David Wagner * @param[in] pConfigurableElementWithMapping The element on which the error refers 1406cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 141d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve * returns The formated error std::string 1426cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard */ 143d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::string getMappingError( 144d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve const std::string& strKey, 145d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve const std::string& strMessage, 14601c7495e66caea59165316bc025a69cce1383311David Wagner const CConfigurableElementWithMapping* pConfigurableElementWithMapping) const; 1476cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard 1486cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard /** 1496cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * Format the mapping data of the ConfigurableElements that have been gathered through recursive 1506cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * calls to the getMapping() method. 1516cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * These elements shall be evaluated from the root level to the leaves level, so the list must 1526cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * be parsed in reverse order. 1536cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 1546cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[in] configurableElementPath List of ConfigurableElements containing mapping data 1556cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 1566cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @return String containing the formatted mapping 1576cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard */ 158d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::string formatMappingDataList( 159d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve const std::list<const CConfigurableElement*>& configurableElementPath) const; 1606cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard 1616cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard /** 1626cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * Find the SubystemObject which contains a specific CInstanceConfigurableElement. 1636cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 1646cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[in] pInstanceConfigurableElement The CInstanceConfigurableElement that is related to 1656cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * the wanted SubsystemObject. Each SubsystemObject of the Subystem internal list is checked in 1666cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * order to find a match. 1676cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 1686cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @return A pointer to the SubsystemObject related to pInstanceConfigurableElement 1696cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard */ 1706cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard const CSubsystemObject* findSubsystemObjectFromConfigurableElement( 1716cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard const CInstanceConfigurableElement* pInstanceConfigurableElement) const; 1726cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard 1736cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard /** 1746cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * Find the mapping data defined for the CInstanceConfigurableElement given in parameter, that 175487ce850cc5f884f7689a2bfd55a7e1cf6eb3053Frédéric Boisnard * corresponds to Subsystem level mapping (Subsystem level mapping keys are defined in 1766cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * CSubsystemObjectCreator classes). 1776cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * The CInstanceConfigurableElement might as well contain local mapping data. 1786cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 1796cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[in] pInstanceConfigurableElement The element which mapping data will be parsed for 1806cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * a match 1816cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[out] strMappingKey Mapping key defined at the Subsystem level 1826cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[out] strMappingValue Mapping value contained in pInstanceConfigurableElement 1836cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard */ 184487ce850cc5f884f7689a2bfd55a7e1cf6eb3053Frédéric Boisnard void findSubsystemLevelMappingKeyValue( 1856cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard const CInstanceConfigurableElement* pInstanceConfigurableElement, 186d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::string& strMappingKey, 187d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::string& strMappingValue) const; 1886cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard 1896cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard /** 1906cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * Formats the mapping of a SubsystemObject 1916cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 1926cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[in] pInstanceConfigurableElement Element corresponding to a SubsystemObject 1936cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 1946cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @return String containing the formatted mapping 1956cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard */ 196d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::string getFormattedSubsystemMappingData( 1976cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard const CInstanceConfigurableElement* pInstanceConfigurableElement) const; 1986cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard /** 1996cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * Generic context handling 2006cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 2016cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * Feed context with mapping data of the current element 2026cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * 20301c7495e66caea59165316bc025a69cce1383311David Wagner * @param[in] pConfigurableElementWithMapping The element containing mapping data 2046cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @param[out] context The context mapping to update with the current element mapping values 205d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve * @param[out] strError The formated error std::string 20646966e050fdd1ae48c7692ae9818762ba262e781Renaud de Chivre * 2076cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard * @return true on success 2086cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard */ 20901c7495e66caea59165316bc025a69cce1383311David Wagner bool handleMappingContext( 21001c7495e66caea59165316bc025a69cce1383311David Wagner const CConfigurableElementWithMapping* pConfigurableElementWithMapping, 21101c7495e66caea59165316bc025a69cce1383311David Wagner CMappingContext& context, 212d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::string& strError) const; 213084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard 214084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard /** 215084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * Looks if a subsystem object needs to be instantiated for the given configurable 216084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * element, then instantiate it if needed. 217084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * 218084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * @param[in:out] pInstanceConfigurableElement The configurable element to check 219084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * for instanciation 220084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * @param[in] context The mapping values container 221084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * @param[out] bHasCreatedSubsystemObject If a subsystem object has been instantiated. 222084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard Undetermined on error 223084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * @param[out] strError String filled with an human readable error on error, 224084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard left unmodified otherwise 225084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * 226084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard * @return true on success, false on failure 227084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard */ 228084cafba76fa5c987cdffeaaa7401202473554cbKevin Rocard bool handleSubsystemObjectCreation(CInstanceConfigurableElement* pInstanceConfigurableElement, 2296cae0ecf49ec7815aa59a4f4a0ec99976ca38032Frederic Boisnard CMappingContext& context, bool& bHasCreatedSubsystemObject, 230d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::string& strError); 23168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 23268a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Subsystem context mapping keys 233d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::vector<std::string> _contextMappingKeyArray; 23468a912857707864bbaaff9808717813105072a6ePatrick Benavoli 23568a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Subsystem object creator map 236d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::vector<CSubsystemObjectCreator*> _subsystemObjectCreatorArray; 23768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 23868a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Subsystem sync objects (house keeping) 239d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::list<CSubsystemObject*> _subsystemObjectList; 24068a912857707864bbaaff9808717813105072a6ePatrick Benavoli 24168a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Mapping Context stack 242d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::stack<CMappingContext> _contextStack; 24368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 24468a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Subelements 24568a912857707864bbaaff9808717813105072a6ePatrick Benavoli CComponentLibrary* _pComponentLibrary; 24668a912857707864bbaaff9808717813105072a6ePatrick Benavoli CInstanceDefinition* _pInstanceDefinition; 24768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 24868a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Endianness 24968a912857707864bbaaff9808717813105072a6ePatrick Benavoli bool _bBigEndian; 25001c7495e66caea59165316bc025a69cce1383311David Wagner 25101c7495e66caea59165316bc025a69cce1383311David Wagner //! Contains the mapping info at Subsystem level 25201c7495e66caea59165316bc025a69cce1383311David Wagner CMappingData* _pMappingData; 25368a912857707864bbaaff9808717813105072a6ePatrick Benavoli}; 254