1b76c9d6de717a9a1cfd94e7a8eca7ee4a2035cd7David Wagner/* 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#include "DomainConfiguration.h" 3168a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "AreaConfiguration.h" 3268a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "ConfigurableElement.h" 3368a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "CompoundRule.h" 3463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli#include "Subsystem.h" 3563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli#include "XmlDomainSerializingContext.h" 3629fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner#include "XmlDomainImportContext.h" 3729fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner#include "XmlDomainExportContext.h" 3863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli#include "ConfigurationAccessContext.h" 3968a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include <assert.h> 400bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli#include "RuleParser.h" 4168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 4268a912857707864bbaaff9808717813105072a6ePatrick Benavoli#define base CBinarySerializableElement 4368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 44d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalveusing std::string; 45d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve 4668a912857707864bbaaff9808717813105072a6ePatrick BenavoliCDomainConfiguration::CDomainConfiguration(const string& strName) : base(strName) 4768a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 4868a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 4968a912857707864bbaaff9808717813105072a6ePatrick Benavoli 5068a912857707864bbaaff9808717813105072a6ePatrick BenavoliCDomainConfiguration::~CDomainConfiguration() 5168a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 5268a912857707864bbaaff9808717813105072a6ePatrick Benavoli AreaConfigurationListIterator it; 5368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 5468a912857707864bbaaff9808717813105072a6ePatrick Benavoli for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) { 5568a912857707864bbaaff9808717813105072a6ePatrick Benavoli 5668a912857707864bbaaff9808717813105072a6ePatrick Benavoli delete *it; 5768a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 5868a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 5968a912857707864bbaaff9808717813105072a6ePatrick Benavoli 6068a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Class kind 6168a912857707864bbaaff9808717813105072a6ePatrick Benavolistring CDomainConfiguration::getKind() const 6268a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 6368a912857707864bbaaff9808717813105072a6ePatrick Benavoli return "Configuration"; 6468a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 6568a912857707864bbaaff9808717813105072a6ePatrick Benavoli 6668a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Child dynamic creation 6768a912857707864bbaaff9808717813105072a6ePatrick Benavolibool CDomainConfiguration::childrenAreDynamic() const 6868a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 6968a912857707864bbaaff9808717813105072a6ePatrick Benavoli return true; 7068a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 7168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 7268a912857707864bbaaff9808717813105072a6ePatrick Benavoli// XML configuration settings parsing 7363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavolibool CDomainConfiguration::parseSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext) 7468a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 7563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Actual XML context 7629fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner CXmlDomainImportContext& xmlDomainImportContext = static_cast<CXmlDomainImportContext&>(serializingContext); 7768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 7863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Take care of configurable elements / area configurations ranks 79d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::list<CAreaConfiguration*> areaConfigurationList; 8063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 8163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Parse configurable element's configuration settings 8263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli CXmlElement::CChildIterator it(xmlConfigurationSettingsElement); 8363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 8463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli CXmlElement xmlConfigurableElementSettingsElement; 8563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 8663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli while (it.next(xmlConfigurableElementSettingsElement)) { 8763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 8863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Retrieve area configuration 8963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli string strConfigurableElementPath = xmlConfigurableElementSettingsElement.getAttributeString("Path"); 9063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 9163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli CAreaConfiguration* pAreaConfiguration = findAreaConfiguration(strConfigurableElementPath); 9263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 9363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (!pAreaConfiguration) { 9463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 9529fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner xmlDomainImportContext.setError("Configurable Element " + strConfigurableElementPath + " referred to by Configuration " + getPath() + " not associated to Domain"); 9663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 9763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return false; 9863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 9963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Ranks 10063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli areaConfigurationList.push_back(pAreaConfiguration); 10163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 10263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Parse 10329fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner if (!serializeConfigurableElementSettings(pAreaConfiguration, xmlConfigurableElementSettingsElement, xmlDomainImportContext, false)) { 10463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 10563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return false; 10663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 10763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 10863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 10963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Reorder area configurations according to XML content 11063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli reorderAreaConfigurations(areaConfigurationList); 11163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 11263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return true; 11363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli} 11463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 11563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli// XML configuration settings composing 11663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavolivoid CDomainConfiguration::composeSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext) const 11763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli{ 11863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Go through all are configurations 11963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli AreaConfigurationListIterator it; 12063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 12163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (it = _orderedAreaConfigurationList.begin(); it != _orderedAreaConfigurationList.end(); ++it) { 12263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 12363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli const CAreaConfiguration* pAreaConfiguration = *it; 12463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 12563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Retrieve configurable element 12663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli const CConfigurableElement* pConfigurableElement = pAreaConfiguration->getConfigurableElement(); 12763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 12863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Create configurable element child element 12963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli CXmlElement xmlConfigurableElementSettingsElement; 13063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 13163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli xmlConfigurationSettingsElement.createChild(xmlConfigurableElementSettingsElement, "ConfigurableElement"); 13263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 13363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Set Path attribute 13463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli xmlConfigurableElementSettingsElement.setAttributeString("Path", pConfigurableElement->getPath()); 13563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 13663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Delegate composing to area configuration 13763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli ((CDomainConfiguration&)(*this)).serializeConfigurableElementSettings((CAreaConfiguration*)pAreaConfiguration, xmlConfigurableElementSettingsElement, serializingContext, true); 13863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 13963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli} 14063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 14163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli// Serialize one configuration for one configurable element 14263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavolibool CDomainConfiguration::serializeConfigurableElementSettings(CAreaConfiguration* pAreaConfiguration, CXmlElement& xmlConfigurableElementSettingsElement, CXmlSerializingContext& serializingContext, bool bSerializeOut) 14363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli{ 14463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Actual XML context 14529fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner CXmlDomainExportContext& xmlDomainExportContext = 14629fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner static_cast<CXmlDomainExportContext&>(serializingContext); 14763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 14863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Configurable Element 14963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli const CConfigurableElement* pConfigurableElement = pAreaConfiguration->getConfigurableElement(); 15063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 15163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Element content 15263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli CXmlElement xmlConfigurableElementSettingsElementContent; 15363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 15463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Deal with element itself 15563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (!bSerializeOut) { 15663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 15763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Check structure 15863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (xmlConfigurableElementSettingsElement.getNbChildElements() != 1) { 15963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 16063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Structure error 16163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli serializingContext.setError("Struture error encountered while parsing settings of " + pConfigurableElement->getKind() + " " + pConfigurableElement->getName() + " in Configuration " + getPath()); 16263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 16363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return false; 16463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 16563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 16663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Check name and kind 16763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (!xmlConfigurableElementSettingsElement.getChildElement(pConfigurableElement->getKind(), pConfigurableElement->getName(), xmlConfigurableElementSettingsElementContent)) { 16863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 16963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli serializingContext.setError("Couldn't find settings for " + pConfigurableElement->getKind() + " " + pConfigurableElement->getName() + " for Configuration " + getPath()); 17063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 17163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return false; 17263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 17363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } else { 17463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 17563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Create child XML element 17663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli xmlConfigurableElementSettingsElement.createChild(xmlConfigurableElementSettingsElementContent, pConfigurableElement->getKind()); 17763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 17863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Set Name 17963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli xmlConfigurableElementSettingsElementContent.setNameAttribute(pConfigurableElement->getName()); 18063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 18163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 18263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Change context type to parameter settings access 18363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli string strError; 18463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 18563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Create configuration access context 18663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli CConfigurationAccessContext configurationAccessContext(strError, bSerializeOut); 18763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 18863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Provide current value space 18929fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner configurationAccessContext.setValueSpaceRaw(xmlDomainExportContext.valueSpaceIsRaw()); 19063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 19163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Provide current output raw format 19229fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner configurationAccessContext.setOutputRawFormat(xmlDomainExportContext.outputRawFormatIsHex()); 19363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 19463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Get subsystem 19563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli const CSubsystem* pSubsystem = pConfigurableElement->getBelongingSubsystem(); 19663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 19763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (pSubsystem && pSubsystem != pConfigurableElement) { 19863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 19963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Element is a descendant of subsystem 20068a912857707864bbaaff9808717813105072a6ePatrick Benavoli 20163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Deal with Endianness 20263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli configurationAccessContext.setBigEndianSubsystem(pSubsystem->isBigEndian()); 20363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 20463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 20563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Have domain configuration parse settings for configurable element 20663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (!pAreaConfiguration->serializeXmlSettings(xmlConfigurableElementSettingsElementContent, configurationAccessContext)) { 20763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 20863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Forward error 20929fa61fc5bc02f72f99e66ad50e4de8cb6b8490bDavid Wagner xmlDomainExportContext.setError(strError); 21063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 21163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return false; 21263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 21363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return true; 21468a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 21568a912857707864bbaaff9808717813105072a6ePatrick Benavoli 21668a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Configurable Elements association 21763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavolivoid CDomainConfiguration::addConfigurableElement(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet) 21868a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 2199620e44c6c7605bf589f60331eb5b05b71336853Frédéric Boisnard CAreaConfiguration* pAreaConfiguration = pConfigurableElement->createAreaConfiguration(pSyncerSet); 22063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 22163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli _areaConfigurationList.push_back(pAreaConfiguration); 22263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli _orderedAreaConfigurationList.push_back(pAreaConfiguration); 22368a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 22468a912857707864bbaaff9808717813105072a6ePatrick Benavoli 22568a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::removeConfigurableElement(const CConfigurableElement* pConfigurableElement) 22668a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 22768a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfigurationToRemove = getAreaConfiguration(pConfigurableElement); 22868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 22968a912857707864bbaaff9808717813105072a6ePatrick Benavoli _areaConfigurationList.remove(pAreaConfigurationToRemove); 23063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli _orderedAreaConfigurationList.remove(pAreaConfigurationToRemove); 23168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 23268a912857707864bbaaff9808717813105072a6ePatrick Benavoli delete pAreaConfigurationToRemove; 23368a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 23468a912857707864bbaaff9808717813105072a6ePatrick Benavoli 23563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli// Sequence management 236d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalvebool CDomainConfiguration::setElementSequence(const std::vector<string>& astrNewElementSequence, string& strError) 23763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli{ 23863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Build a new list of AreaConfiguration objects 239d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalve std::list<CAreaConfiguration*> areaConfigurationList; 24063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 24163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli uint32_t uiConfigurableElement; 24263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 24363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (uiConfigurableElement = 0; uiConfigurableElement < astrNewElementSequence.size(); uiConfigurableElement++) { 24463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 24563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli string strConfigurableElementPath = astrNewElementSequence[uiConfigurableElement]; 24663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 24763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli CAreaConfiguration* pAreaConfiguration = findAreaConfiguration(strConfigurableElementPath); 24863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 24963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (!pAreaConfiguration) { 25063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 25163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli strError = "Element " + strConfigurableElementPath + " not found in domain"; 25263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 25363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return false; 25463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 25563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Check not already present in the list 25663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (findAreaConfiguration(strConfigurableElementPath, areaConfigurationList)) { 25763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 25863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli strError = "Element " + strConfigurableElementPath + " provided more than once"; 25963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 26063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return false; 26163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 26263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 26363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Store new ordered area configuration 26463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli areaConfigurationList.push_back(pAreaConfiguration); 26563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 26663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 26763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Reorder area configurations according to given path list 26863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli reorderAreaConfigurations(areaConfigurationList); 26963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 27063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return true; 27163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli} 27263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 27363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavolivoid CDomainConfiguration::getElementSequence(string& strResult) const 27463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli{ 27563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli strResult = "\n"; 27663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 27763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli AreaConfigurationListIterator it; 27863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 27963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // List configurable element paths out of ordered area configuration list 28063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (it = _orderedAreaConfigurationList.begin(); it != _orderedAreaConfigurationList.end(); ++it) { 28163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 28263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli const CAreaConfiguration* pAreaConfiguration = *it; 28363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 28463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli const CConfigurableElement* pConfigurableElement = pAreaConfiguration->getConfigurableElement(); 28563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 28663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli strResult += pConfigurableElement->getPath() + "\n"; 28763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 28863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli} 28963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 2900bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli// Application rule 2910bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavolibool CDomainConfiguration::setApplicationRule(const string& strApplicationRule, const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition, string& strError) 2920bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli{ 2930bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Parser 2940bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli CRuleParser ruleParser(strApplicationRule, pSelectionCriteriaDefinition); 2950bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 2960bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Attempt to parse it 2970bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli if (!ruleParser.parse(NULL, strError)) { 2980bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 2990bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli return false; 3000bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli } 3010bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Replace compound rule 3020bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli setRule(ruleParser.grabRootRule()); 3030bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 3040bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli return true; 3050bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli} 3060bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 3070bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavolivoid CDomainConfiguration::clearApplicationRule() 3080bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli{ 3090bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Replace compound rule 3100bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli setRule(NULL); 3110bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli} 3120bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 3130bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavolivoid CDomainConfiguration::getApplicationRule(string& strResult) const 3140bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli{ 3150bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Rule 3160bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli const CCompoundRule* pRule = getRule(); 3170bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 3180bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli if (pRule) { 3190bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Start clear 3200bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli strResult.clear(); 3210bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 3220bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Dump rule 3230bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli pRule->dump(strResult); 3240bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 3250bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli } else { 3260bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 3270bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli strResult = "<none>"; 3280bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli } 3290bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli} 3300bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 331e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard/** 332e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * Get the Configuration Blackboard. 333e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * 334e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * Fetch the Configuration Blackboard related to the ConfigurableElement given in parameter. This 335e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * Element is used to retrieve the correct AreaConfiguration where the Blackboard is stored. 336e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * 337e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * @param[in] pConfigurableElement A pointer to a ConfigurableElement that is part of the 338e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * Domain. This must have been checked previously, as an 339e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * assertion is performed. 340e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * 341e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard * return Pointer to the Blackboard of the Configuration. 342e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard */ 343e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric BoisnardCParameterBlackboard* CDomainConfiguration::getBlackboard(const CConfigurableElement* pConfigurableElement) const 344e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard{ 345e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard AreaConfigurationListIterator it; 346e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard 347e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) { 348e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard 349e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard CAreaConfiguration* pAreaConfiguration = *it; 350e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard 351e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard // Check if the Element is associated with the Domain 352e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard if (pAreaConfiguration->getConfigurableElement() == pConfigurableElement) { 353e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard 354e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard return &pAreaConfiguration->getBlackboard(); 355e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard } 356e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard } 357e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard 358e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard assert(0); 359e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard return NULL; 360e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard} 361e42dacdeaf82d63000be61c6f1583a2ab08e0a98Frédéric Boisnard 36268a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Save data from current 36368a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::save(const CParameterBlackboard* pMainBlackboard) 36468a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 36568a912857707864bbaaff9808717813105072a6ePatrick Benavoli AreaConfigurationListIterator it; 36668a912857707864bbaaff9808717813105072a6ePatrick Benavoli 36768a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Just propagate to areas 36868a912857707864bbaaff9808717813105072a6ePatrick Benavoli for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) { 36968a912857707864bbaaff9808717813105072a6ePatrick Benavoli 37068a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfiguration = *it; 37168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 37268a912857707864bbaaff9808717813105072a6ePatrick Benavoli pAreaConfiguration->save(pMainBlackboard); 37368a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 37468a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 37568a912857707864bbaaff9808717813105072a6ePatrick Benavoli 37668a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Apply data to current 377d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalvebool CDomainConfiguration::restore(CParameterBlackboard* pMainBlackboard, bool bSync, std::list<string>* plstrError) const 37868a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 379ace81f873b910493ab884dc5a6a38ba6ec3d56d3Kevin Rocard bool bSuccess = true; 380ace81f873b910493ab884dc5a6a38ba6ec3d56d3Kevin Rocard 38168a912857707864bbaaff9808717813105072a6ePatrick Benavoli AreaConfigurationListIterator it; 38268a912857707864bbaaff9808717813105072a6ePatrick Benavoli 38368a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Just propagate to areas 38463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (it = _orderedAreaConfigurationList.begin(); it != _orderedAreaConfigurationList.end(); ++it) { 38568a912857707864bbaaff9808717813105072a6ePatrick Benavoli 38668a912857707864bbaaff9808717813105072a6ePatrick Benavoli const CAreaConfiguration* pAreaConfiguration = *it; 38768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 388ace81f873b910493ab884dc5a6a38ba6ec3d56d3Kevin Rocard bSuccess &= pAreaConfiguration->restore(pMainBlackboard, bSync, plstrError); 38968a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 39063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 391ace81f873b910493ab884dc5a6a38ba6ec3d56d3Kevin Rocard return bSuccess; 39268a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 39368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 39468a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Ensure validity for configurable element area configuration 39568a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::validate(const CConfigurableElement* pConfigurableElement, const CParameterBlackboard* pMainBlackboard) 39668a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 39768a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfigurationToValidate = getAreaConfiguration(pConfigurableElement); 39868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 39968a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Delegate 40068a912857707864bbaaff9808717813105072a6ePatrick Benavoli pAreaConfigurationToValidate->validate(pMainBlackboard); 40168a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 40268a912857707864bbaaff9808717813105072a6ePatrick Benavoli 40368a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Ensure validity of all area configurations 40468a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::validate(const CParameterBlackboard* pMainBlackboard) 40568a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 40668a912857707864bbaaff9808717813105072a6ePatrick Benavoli AreaConfigurationListIterator it; 40768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 40868a912857707864bbaaff9808717813105072a6ePatrick Benavoli for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) { 40968a912857707864bbaaff9808717813105072a6ePatrick Benavoli 41068a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfiguration = *it; 41168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 41268a912857707864bbaaff9808717813105072a6ePatrick Benavoli pAreaConfiguration->validate(pMainBlackboard); 41368a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 41468a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 41568a912857707864bbaaff9808717813105072a6ePatrick Benavoli 41668a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Return configuration validity for given configurable element 41768a912857707864bbaaff9808717813105072a6ePatrick Benavolibool CDomainConfiguration::isValid(const CConfigurableElement* pConfigurableElement) const 41868a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 41968a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Get child configurable elemnt's area configuration 42068a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfiguration = getAreaConfiguration(pConfigurableElement); 42168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 42268a912857707864bbaaff9808717813105072a6ePatrick Benavoli assert(pAreaConfiguration); 42368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 42468a912857707864bbaaff9808717813105072a6ePatrick Benavoli return pAreaConfiguration->isValid(); 42568a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 42668a912857707864bbaaff9808717813105072a6ePatrick Benavoli 42768a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Ensure validity of configurable element's area configuration by copying in from a valid one 42868a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::validateAgainst(const CDomainConfiguration* pValidDomainConfiguration, const CConfigurableElement* pConfigurableElement) 42968a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 43068a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Retrieve related area configurations 43168a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfigurationToValidate = getAreaConfiguration(pConfigurableElement); 43268a912857707864bbaaff9808717813105072a6ePatrick Benavoli const CAreaConfiguration* pAreaConfigurationToValidateAgainst = pValidDomainConfiguration->getAreaConfiguration(pConfigurableElement); 43368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 43468a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Delegate to area 43568a912857707864bbaaff9808717813105072a6ePatrick Benavoli pAreaConfigurationToValidate->validateAgainst(pAreaConfigurationToValidateAgainst); 43668a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 43768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 43868a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Ensure validity of all configurable element's area configuration by copying in from a valid ones 43968a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::validateAgainst(const CDomainConfiguration* pValidDomainConfiguration) 44068a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 44168a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Copy in configuration data from against domain 44268a912857707864bbaaff9808717813105072a6ePatrick Benavoli AreaConfigurationListIterator it, itAgainst; 44368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 44468a912857707864bbaaff9808717813105072a6ePatrick Benavoli for (it = _areaConfigurationList.begin(), itAgainst = pValidDomainConfiguration->_areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it, ++itAgainst) { 44568a912857707864bbaaff9808717813105072a6ePatrick Benavoli 44668a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfigurationToValidate = *it; 44768a912857707864bbaaff9808717813105072a6ePatrick Benavoli const CAreaConfiguration* pAreaConfigurationToValidateAgainst = *itAgainst; 44868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 44968a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Delegate to area 45068a912857707864bbaaff9808717813105072a6ePatrick Benavoli pAreaConfigurationToValidate->validateAgainst(pAreaConfigurationToValidateAgainst); 45168a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 45268a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 45368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 45468a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Dynamic data application 45568a912857707864bbaaff9808717813105072a6ePatrick Benavolibool CDomainConfiguration::isApplicable() const 45668a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 45768a912857707864bbaaff9808717813105072a6ePatrick Benavoli const CCompoundRule* pRule = getRule(); 45868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 45968a912857707864bbaaff9808717813105072a6ePatrick Benavoli return pRule && pRule->matches(); 46068a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 46168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 46268a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Merge existing configurations to given configurable element ones 46368a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::merge(CConfigurableElement* pToConfigurableElement, CConfigurableElement* pFromConfigurableElement) 46468a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 46568a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Retrieve related area configurations 46668a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfigurationToMergeTo = getAreaConfiguration(pToConfigurableElement); 46768a912857707864bbaaff9808717813105072a6ePatrick Benavoli const CAreaConfiguration* pAreaConfigurationToMergeFrom = getAreaConfiguration(pFromConfigurableElement); 46868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 46968a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Do the merge 4709620e44c6c7605bf589f60331eb5b05b71336853Frédéric Boisnard pAreaConfigurationToMergeFrom->copyToOuter(pAreaConfigurationToMergeTo); 47168a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 47268a912857707864bbaaff9808717813105072a6ePatrick Benavoli 47368a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Domain splitting 47468a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::split(CConfigurableElement* pFromConfigurableElement) 47568a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 47668a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Retrieve related area configuration 47768a912857707864bbaaff9808717813105072a6ePatrick Benavoli const CAreaConfiguration* pAreaConfigurationToSplitFrom = getAreaConfiguration(pFromConfigurableElement); 47868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 47968a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Go through children areas to copy configuration data to them 480911844b16c6b627f421bc3368de427de3ca9f60cPatrick Benavoli size_t uiNbConfigurableElementChildren = pFromConfigurableElement->getNbChildren(); 481911844b16c6b627f421bc3368de427de3ca9f60cPatrick Benavoli size_t uiChild; 48268a912857707864bbaaff9808717813105072a6ePatrick Benavoli 48368a912857707864bbaaff9808717813105072a6ePatrick Benavoli for (uiChild = 0; uiChild < uiNbConfigurableElementChildren; uiChild++) { 48468a912857707864bbaaff9808717813105072a6ePatrick Benavoli 48568a912857707864bbaaff9808717813105072a6ePatrick Benavoli CConfigurableElement* pToChildConfigurableElement = static_cast<CConfigurableElement*>(pFromConfigurableElement->getChild(uiChild)); 48668a912857707864bbaaff9808717813105072a6ePatrick Benavoli 48768a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Get child configurable elemnt's area configuration 48868a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pChildAreaConfiguration = getAreaConfiguration(pToChildConfigurableElement); 48968a912857707864bbaaff9808717813105072a6ePatrick Benavoli 49068a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Do the copy 4919620e44c6c7605bf589f60331eb5b05b71336853Frédéric Boisnard pChildAreaConfiguration->copyFromOuter(pAreaConfigurationToSplitFrom); 49268a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 49368a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 49468a912857707864bbaaff9808717813105072a6ePatrick Benavoli 49568a912857707864bbaaff9808717813105072a6ePatrick Benavoli// AreaConfiguration retrieval from configurable element 49668a912857707864bbaaff9808717813105072a6ePatrick BenavoliCAreaConfiguration* CDomainConfiguration::getAreaConfiguration(const CConfigurableElement* pConfigurableElement) const 49768a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 49868a912857707864bbaaff9808717813105072a6ePatrick Benavoli AreaConfigurationListIterator it; 49968a912857707864bbaaff9808717813105072a6ePatrick Benavoli 50068a912857707864bbaaff9808717813105072a6ePatrick Benavoli for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) { 50168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 50268a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfiguration = *it; 50368a912857707864bbaaff9808717813105072a6ePatrick Benavoli 50468a912857707864bbaaff9808717813105072a6ePatrick Benavoli if (pAreaConfiguration->getConfigurableElement() == pConfigurableElement) { 50568a912857707864bbaaff9808717813105072a6ePatrick Benavoli 50668a912857707864bbaaff9808717813105072a6ePatrick Benavoli return pAreaConfiguration; 50768a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 50868a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 50968a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Not found? 51068a912857707864bbaaff9808717813105072a6ePatrick Benavoli assert(0); 51168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 51268a912857707864bbaaff9808717813105072a6ePatrick Benavoli return NULL; 51368a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 51468a912857707864bbaaff9808717813105072a6ePatrick Benavoli 51563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli// AreaConfiguration retrieval from present area configurations 51663499d4763e42d76bfd39b79871f611381d2d164Patrick BenavoliCAreaConfiguration* CDomainConfiguration::findAreaConfiguration(const string& strConfigurableElementPath) const 51763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli{ 5184bed9212041d94d52e55e624bd081fcbf01ee04ePatrick Benavoli return findAreaConfiguration(strConfigurableElementPath, _areaConfigurationList); 51963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli} 52063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 52163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli// AreaConfiguration retrieval from given area configuration list 522d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien GonzalveCAreaConfiguration* CDomainConfiguration::findAreaConfiguration(const string& strConfigurableElementPath, const std::list<CAreaConfiguration*>& areaConfigurationList) const 52363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli{ 52463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli AreaConfigurationListIterator it; 52563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 52663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (it = areaConfigurationList.begin(); it != areaConfigurationList.end(); ++it) { 52763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 52863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli CAreaConfiguration* pAreaConfiguration = *it; 52963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 53063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (pAreaConfiguration->getConfigurableElement()->getPath() == strConfigurableElementPath) { 53163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 53263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return pAreaConfiguration; 53363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 53463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 53563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 53663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Not found 53763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return NULL; 53863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli} 53963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 54063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli// Area configuration ordering 541d9526499d6ab53b7d13d1434f748f6f2161c2e0aSebastien Gonzalvevoid CDomainConfiguration::reorderAreaConfigurations(const std::list<CAreaConfiguration*>& areaConfigurationList) 54263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli{ 54363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Ensure elements in provided list appear first and ordered the same way in internal one 54463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 54563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Remove all elements present in the provided list from the internal one 54663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli AreaConfigurationListIterator it; 54763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 54863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (it = areaConfigurationList.begin(); it != areaConfigurationList.end(); ++it) { 54963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 55063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli _orderedAreaConfigurationList.remove(*it); 55163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 55263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 55363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Prepended provided elements into internal list 55463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli _orderedAreaConfigurationList.insert(_orderedAreaConfigurationList.begin(), areaConfigurationList.begin(), areaConfigurationList.end()); 55563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli} 55663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 55763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli// Find area configuration rank from regular list: for ordered list maintainance 55863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoliuint32_t CDomainConfiguration::getAreaConfigurationRank(const CAreaConfiguration* pAreaConfiguration) const 55963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli{ 56063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli uint32_t uiAreaConfigurationRank; 56163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli AreaConfigurationListIterator it; 56263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 56363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Propagate request to areas 56463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (it = _areaConfigurationList.begin(), uiAreaConfigurationRank = 0; it != _areaConfigurationList.end(); ++it, ++uiAreaConfigurationRank) { 56563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 56663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (*it == pAreaConfiguration) { 56763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 56863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return uiAreaConfigurationRank; 56963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 57063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 57163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 57263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli assert(0); 57363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 57463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return 0; 57563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli} 57663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 57763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli// Find area configuration from regular list based on rank: for ordered list maintainance 57863499d4763e42d76bfd39b79871f611381d2d164Patrick BenavoliCAreaConfiguration* CDomainConfiguration::getAreaConfiguration(uint32_t uiAreaConfigurationRank) const 57963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli{ 58063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli AreaConfigurationListIterator it; 58163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli uint32_t uiCurrentAreaConfigurationRank; 58263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 58363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Propagate request to areas 58463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (it = _areaConfigurationList.begin(), uiCurrentAreaConfigurationRank = 0; it != _areaConfigurationList.end(); ++it, ++uiCurrentAreaConfigurationRank) { 58563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 58663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (uiCurrentAreaConfigurationRank == uiAreaConfigurationRank) { 58763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 58863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return *it; 58963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 59063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 59163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 59263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli assert(0); 59363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 59463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli return NULL; 59563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli} 59663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 59768a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Rule 59868a912857707864bbaaff9808717813105072a6ePatrick Benavoliconst CCompoundRule* CDomainConfiguration::getRule() const 59968a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 60068a912857707864bbaaff9808717813105072a6ePatrick Benavoli if (getNbChildren()) { 60168a912857707864bbaaff9808717813105072a6ePatrick Benavoli // Rule created 60268a912857707864bbaaff9808717813105072a6ePatrick Benavoli return static_cast<const CCompoundRule*>(getChild(ECompoundRule)); 60368a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 60468a912857707864bbaaff9808717813105072a6ePatrick Benavoli return NULL; 60568a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 60668a912857707864bbaaff9808717813105072a6ePatrick Benavoli 6070bd50546a8d06a6865d32c695adf8893fa71250aPatrick BenavoliCCompoundRule* CDomainConfiguration::getRule() 6080bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli{ 6090bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli if (getNbChildren()) { 6100bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Rule created 6110bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli return static_cast<CCompoundRule*>(getChild(ECompoundRule)); 6120bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli } 6130bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli return NULL; 6140bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli} 6150bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 6160bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavolivoid CDomainConfiguration::setRule(CCompoundRule* pRule) 6170bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli{ 6180bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli CCompoundRule* pOldRule = getRule(); 6190bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 6200bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli if (pOldRule) { 6210bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Remove previous rule 6220bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli removeChild(pOldRule); 6230bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 6240bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli delete pOldRule; 6250bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli } 6260bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 6270bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Set new one 6280bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli if (pRule) { 6290bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli // Chain 6300bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli addChild(pRule); 6310bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli } 6320bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli} 6330bd50546a8d06a6865d32c695adf8893fa71250aPatrick Benavoli 63468a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Serialization 63568a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::binarySerialize(CBinaryStream& binaryStream) 63668a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 63768a912857707864bbaaff9808717813105072a6ePatrick Benavoli AreaConfigurationListIterator it; 63868a912857707864bbaaff9808717813105072a6ePatrick Benavoli 63963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Area configurations order 64063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli if (binaryStream.isOut()) { 64163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 64263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (it = _orderedAreaConfigurationList.begin(); it != _orderedAreaConfigurationList.end(); ++it) { 64363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 64463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Get rank 64563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli uint32_t uiAreaConfigurationRank = getAreaConfigurationRank(*it); 64663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 64763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Store it 64863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli binaryStream.write((const uint8_t*)&uiAreaConfigurationRank, sizeof(uiAreaConfigurationRank)); 64963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 65063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } else { 65163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 65263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Empty ordered list first 65363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli _orderedAreaConfigurationList.resize(0); 65463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 65563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli uint32_t uiAreaConfiguration; 65663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 65763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli for (uiAreaConfiguration = 0; uiAreaConfiguration < _areaConfigurationList.size(); uiAreaConfiguration++) { 65863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 65963499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Get rank 66063499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli uint32_t uiAreaConfigurationRank; 66163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 66263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli binaryStream.read((uint8_t*)&uiAreaConfigurationRank, sizeof(uiAreaConfigurationRank)); 66363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 66463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli _orderedAreaConfigurationList.push_back(getAreaConfiguration(uiAreaConfigurationRank)); 66563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 66663499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli } 66763499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 66863499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Propagate to areas 66968a912857707864bbaaff9808717813105072a6ePatrick Benavoli for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) { 67068a912857707864bbaaff9808717813105072a6ePatrick Benavoli 67168a912857707864bbaaff9808717813105072a6ePatrick Benavoli CAreaConfiguration* pAreaConfiguration = *it; 67268a912857707864bbaaff9808717813105072a6ePatrick Benavoli 67368a912857707864bbaaff9808717813105072a6ePatrick Benavoli pAreaConfiguration->serialize(binaryStream); 67468a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 67568a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 67668a912857707864bbaaff9808717813105072a6ePatrick Benavoli 67768a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Data size 678911844b16c6b627f421bc3368de427de3ca9f60cPatrick Benavolisize_t CDomainConfiguration::getDataSize() const 67968a912857707864bbaaff9808717813105072a6ePatrick Benavoli{ 680911844b16c6b627f421bc3368de427de3ca9f60cPatrick Benavoli size_t uiDataSize; 68163499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 68263499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Add necessary size to store area configurations order 68363499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli uiDataSize = _areaConfigurationList.size() * sizeof(uint32_t); 68463499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli 68563499d4763e42d76bfd39b79871f611381d2d164Patrick Benavoli // Propagate request to areas 68668a912857707864bbaaff9808717813105072a6ePatrick Benavoli AreaConfigurationListIterator it; 68768a912857707864bbaaff9808717813105072a6ePatrick Benavoli 68868a912857707864bbaaff9808717813105072a6ePatrick Benavoli for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) { 68968a912857707864bbaaff9808717813105072a6ePatrick Benavoli 69068a912857707864bbaaff9808717813105072a6ePatrick Benavoli const CAreaConfiguration* pAreaConfiguration = *it; 69168a912857707864bbaaff9808717813105072a6ePatrick Benavoli 69268a912857707864bbaaff9808717813105072a6ePatrick Benavoli uiDataSize += pAreaConfiguration->getSize(); 69368a912857707864bbaaff9808717813105072a6ePatrick Benavoli } 69468a912857707864bbaaff9808717813105072a6ePatrick Benavoli return uiDataSize; 69568a912857707864bbaaff9808717813105072a6ePatrick Benavoli} 696