DomainConfiguration.cpp revision 68a912857707864bbaaff9808717813105072a6e
168a912857707864bbaaff9808717813105072a6ePatrick Benavoli/* <auto_header>
268a912857707864bbaaff9808717813105072a6ePatrick Benavoli * <FILENAME>
368a912857707864bbaaff9808717813105072a6ePatrick Benavoli *
468a912857707864bbaaff9808717813105072a6ePatrick Benavoli * INTEL CONFIDENTIAL
568a912857707864bbaaff9808717813105072a6ePatrick Benavoli * Copyright © 2011 Intel
668a912857707864bbaaff9808717813105072a6ePatrick Benavoli * Corporation All Rights Reserved.
768a912857707864bbaaff9808717813105072a6ePatrick Benavoli *
868a912857707864bbaaff9808717813105072a6ePatrick Benavoli * The source code contained or described herein and all documents related to
968a912857707864bbaaff9808717813105072a6ePatrick Benavoli * the source code ("Material") are owned by Intel Corporation or its suppliers
1068a912857707864bbaaff9808717813105072a6ePatrick Benavoli * or licensors. Title to the Material remains with Intel Corporation or its
1168a912857707864bbaaff9808717813105072a6ePatrick Benavoli * suppliers and licensors. The Material contains trade secrets and proprietary
1268a912857707864bbaaff9808717813105072a6ePatrick Benavoli * and confidential information of Intel or its suppliers and licensors. The
1368a912857707864bbaaff9808717813105072a6ePatrick Benavoli * Material is protected by worldwide copyright and trade secret laws and
1468a912857707864bbaaff9808717813105072a6ePatrick Benavoli * treaty provisions. No part of the Material may be used, copied, reproduced,
1568a912857707864bbaaff9808717813105072a6ePatrick Benavoli * modified, published, uploaded, posted, transmitted, distributed, or
1668a912857707864bbaaff9808717813105072a6ePatrick Benavoli * disclosed in any way without Intel’s prior express written permission.
1768a912857707864bbaaff9808717813105072a6ePatrick Benavoli *
1868a912857707864bbaaff9808717813105072a6ePatrick Benavoli * No license under any patent, copyright, trade secret or other intellectual
1968a912857707864bbaaff9808717813105072a6ePatrick Benavoli * property right is granted to or conferred upon you by disclosure or delivery
2068a912857707864bbaaff9808717813105072a6ePatrick Benavoli * of the Materials, either expressly, by implication, inducement, estoppel or
2168a912857707864bbaaff9808717813105072a6ePatrick Benavoli * otherwise. Any license under such intellectual property rights must be
2268a912857707864bbaaff9808717813105072a6ePatrick Benavoli * express and approved by Intel in writing.
2368a912857707864bbaaff9808717813105072a6ePatrick Benavoli *
2468a912857707864bbaaff9808717813105072a6ePatrick Benavoli *  AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com)
2568a912857707864bbaaff9808717813105072a6ePatrick Benavoli * CREATED: 2011-06-01
2668a912857707864bbaaff9808717813105072a6ePatrick Benavoli * UPDATED: 2011-07-27
2768a912857707864bbaaff9808717813105072a6ePatrick Benavoli *
2868a912857707864bbaaff9808717813105072a6ePatrick Benavoli *
2968a912857707864bbaaff9808717813105072a6ePatrick Benavoli * </auto_header>
3068a912857707864bbaaff9808717813105072a6ePatrick Benavoli */
3168a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "DomainConfiguration.h"
3268a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "AreaConfiguration.h"
3368a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "ConfigurableElement.h"
3468a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include "CompoundRule.h"
3568a912857707864bbaaff9808717813105072a6ePatrick Benavoli#include <assert.h>
3668a912857707864bbaaff9808717813105072a6ePatrick Benavoli
3768a912857707864bbaaff9808717813105072a6ePatrick Benavoli#define base CBinarySerializableElement
3868a912857707864bbaaff9808717813105072a6ePatrick Benavoli
3968a912857707864bbaaff9808717813105072a6ePatrick BenavoliCDomainConfiguration::CDomainConfiguration(const string& strName) : base(strName)
4068a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
4168a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
4268a912857707864bbaaff9808717813105072a6ePatrick Benavoli
4368a912857707864bbaaff9808717813105072a6ePatrick BenavoliCDomainConfiguration::~CDomainConfiguration()
4468a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
4568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    AreaConfigurationListIterator it;
4668a912857707864bbaaff9808717813105072a6ePatrick Benavoli
4768a912857707864bbaaff9808717813105072a6ePatrick Benavoli    for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) {
4868a912857707864bbaaff9808717813105072a6ePatrick Benavoli
4968a912857707864bbaaff9808717813105072a6ePatrick Benavoli        delete *it;
5068a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
5168a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
5268a912857707864bbaaff9808717813105072a6ePatrick Benavoli
5368a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Class kind
5468a912857707864bbaaff9808717813105072a6ePatrick Benavolistring CDomainConfiguration::getKind() const
5568a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
5668a912857707864bbaaff9808717813105072a6ePatrick Benavoli    return "Configuration";
5768a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
5868a912857707864bbaaff9808717813105072a6ePatrick Benavoli
5968a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Child dynamic creation
6068a912857707864bbaaff9808717813105072a6ePatrick Benavolibool CDomainConfiguration::childrenAreDynamic() const
6168a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
6268a912857707864bbaaff9808717813105072a6ePatrick Benavoli    return true;
6368a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
6468a912857707864bbaaff9808717813105072a6ePatrick Benavoli
6568a912857707864bbaaff9808717813105072a6ePatrick Benavoli// XML configuration settings parsing
6668a912857707864bbaaff9808717813105072a6ePatrick Benavolibool CDomainConfiguration::serializeXmlSettings(const CConfigurableElement* pConfigurableElement, CXmlElement& xmlConfigurationSettingsElement, CConfigurationAccessContext& configurationAccessContext)
6768a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
6868a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Find related AreaConfiguration
6968a912857707864bbaaff9808717813105072a6ePatrick Benavoli    CAreaConfiguration* pAreaConfiguration = getAreaConfiguration(pConfigurableElement);
7068a912857707864bbaaff9808717813105072a6ePatrick Benavoli
7168a912857707864bbaaff9808717813105072a6ePatrick Benavoli    assert(pAreaConfiguration);
7268a912857707864bbaaff9808717813105072a6ePatrick Benavoli
7368a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Delegate to corresponding area configuration
7468a912857707864bbaaff9808717813105072a6ePatrick Benavoli    return pAreaConfiguration->serializeXmlSettings(xmlConfigurationSettingsElement, configurationAccessContext);
7568a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
7668a912857707864bbaaff9808717813105072a6ePatrick Benavoli
7768a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Configurable Elements association
7868a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::addConfigurableElement(const CConfigurableElement* pConfigurableElement)
7968a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
8068a912857707864bbaaff9808717813105072a6ePatrick Benavoli    _areaConfigurationList.push_back(new CAreaConfiguration(pConfigurableElement));
8168a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
8268a912857707864bbaaff9808717813105072a6ePatrick Benavoli
8368a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::removeConfigurableElement(const CConfigurableElement* pConfigurableElement)
8468a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
8568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    CAreaConfiguration* pAreaConfigurationToRemove = getAreaConfiguration(pConfigurableElement);
8668a912857707864bbaaff9808717813105072a6ePatrick Benavoli
8768a912857707864bbaaff9808717813105072a6ePatrick Benavoli    _areaConfigurationList.remove(pAreaConfigurationToRemove);
8868a912857707864bbaaff9808717813105072a6ePatrick Benavoli
8968a912857707864bbaaff9808717813105072a6ePatrick Benavoli    delete pAreaConfigurationToRemove;
9068a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
9168a912857707864bbaaff9808717813105072a6ePatrick Benavoli
9268a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Save data from current
9368a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::save(const CParameterBlackboard* pMainBlackboard)
9468a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
9568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    AreaConfigurationListIterator it;
9668a912857707864bbaaff9808717813105072a6ePatrick Benavoli
9768a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Just propagate to areas
9868a912857707864bbaaff9808717813105072a6ePatrick Benavoli    for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) {
9968a912857707864bbaaff9808717813105072a6ePatrick Benavoli
10068a912857707864bbaaff9808717813105072a6ePatrick Benavoli        CAreaConfiguration* pAreaConfiguration = *it;
10168a912857707864bbaaff9808717813105072a6ePatrick Benavoli
10268a912857707864bbaaff9808717813105072a6ePatrick Benavoli        pAreaConfiguration->save(pMainBlackboard);
10368a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
10468a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
10568a912857707864bbaaff9808717813105072a6ePatrick Benavoli
10668a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Apply data to current
10768a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::restore(CParameterBlackboard* pMainBlackboard) const
10868a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
10968a912857707864bbaaff9808717813105072a6ePatrick Benavoli    AreaConfigurationListIterator it;
11068a912857707864bbaaff9808717813105072a6ePatrick Benavoli
11168a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Just propagate to areas
11268a912857707864bbaaff9808717813105072a6ePatrick Benavoli    for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) {
11368a912857707864bbaaff9808717813105072a6ePatrick Benavoli
11468a912857707864bbaaff9808717813105072a6ePatrick Benavoli        const CAreaConfiguration* pAreaConfiguration = *it;
11568a912857707864bbaaff9808717813105072a6ePatrick Benavoli
11668a912857707864bbaaff9808717813105072a6ePatrick Benavoli        pAreaConfiguration->restore(pMainBlackboard);
11768a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
11868a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
11968a912857707864bbaaff9808717813105072a6ePatrick Benavoli
12068a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Ensure validity for configurable element area configuration
12168a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::validate(const CConfigurableElement* pConfigurableElement, const CParameterBlackboard* pMainBlackboard)
12268a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
12368a912857707864bbaaff9808717813105072a6ePatrick Benavoli    CAreaConfiguration* pAreaConfigurationToValidate = getAreaConfiguration(pConfigurableElement);
12468a912857707864bbaaff9808717813105072a6ePatrick Benavoli
12568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Delegate
12668a912857707864bbaaff9808717813105072a6ePatrick Benavoli    pAreaConfigurationToValidate->validate(pMainBlackboard);
12768a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
12868a912857707864bbaaff9808717813105072a6ePatrick Benavoli
12968a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Ensure validity of all area configurations
13068a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::validate(const CParameterBlackboard* pMainBlackboard)
13168a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
13268a912857707864bbaaff9808717813105072a6ePatrick Benavoli    AreaConfigurationListIterator it;
13368a912857707864bbaaff9808717813105072a6ePatrick Benavoli
13468a912857707864bbaaff9808717813105072a6ePatrick Benavoli    for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) {
13568a912857707864bbaaff9808717813105072a6ePatrick Benavoli
13668a912857707864bbaaff9808717813105072a6ePatrick Benavoli        CAreaConfiguration* pAreaConfiguration = *it;
13768a912857707864bbaaff9808717813105072a6ePatrick Benavoli
13868a912857707864bbaaff9808717813105072a6ePatrick Benavoli        pAreaConfiguration->validate(pMainBlackboard);
13968a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
14068a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
14168a912857707864bbaaff9808717813105072a6ePatrick Benavoli
14268a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Return configuration validity for given configurable element
14368a912857707864bbaaff9808717813105072a6ePatrick Benavolibool CDomainConfiguration::isValid(const CConfigurableElement* pConfigurableElement) const
14468a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
14568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Get child configurable elemnt's area configuration
14668a912857707864bbaaff9808717813105072a6ePatrick Benavoli    CAreaConfiguration* pAreaConfiguration = getAreaConfiguration(pConfigurableElement);
14768a912857707864bbaaff9808717813105072a6ePatrick Benavoli
14868a912857707864bbaaff9808717813105072a6ePatrick Benavoli    assert(pAreaConfiguration);
14968a912857707864bbaaff9808717813105072a6ePatrick Benavoli
15068a912857707864bbaaff9808717813105072a6ePatrick Benavoli    return pAreaConfiguration->isValid();
15168a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
15268a912857707864bbaaff9808717813105072a6ePatrick Benavoli
15368a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Ensure validity of configurable element's area configuration by copying in from a valid one
15468a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::validateAgainst(const CDomainConfiguration* pValidDomainConfiguration, const CConfigurableElement* pConfigurableElement)
15568a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
15668a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Retrieve related area configurations
15768a912857707864bbaaff9808717813105072a6ePatrick Benavoli    CAreaConfiguration* pAreaConfigurationToValidate = getAreaConfiguration(pConfigurableElement);
15868a912857707864bbaaff9808717813105072a6ePatrick Benavoli    const CAreaConfiguration* pAreaConfigurationToValidateAgainst = pValidDomainConfiguration->getAreaConfiguration(pConfigurableElement);
15968a912857707864bbaaff9808717813105072a6ePatrick Benavoli
16068a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Delegate to area
16168a912857707864bbaaff9808717813105072a6ePatrick Benavoli    pAreaConfigurationToValidate->validateAgainst(pAreaConfigurationToValidateAgainst);
16268a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
16368a912857707864bbaaff9808717813105072a6ePatrick Benavoli
16468a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Ensure validity of all configurable element's area configuration by copying in from a valid ones
16568a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::validateAgainst(const CDomainConfiguration* pValidDomainConfiguration)
16668a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
16768a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Copy in configuration data from against domain
16868a912857707864bbaaff9808717813105072a6ePatrick Benavoli    AreaConfigurationListIterator it, itAgainst;
16968a912857707864bbaaff9808717813105072a6ePatrick Benavoli
17068a912857707864bbaaff9808717813105072a6ePatrick Benavoli    for (it = _areaConfigurationList.begin(), itAgainst = pValidDomainConfiguration->_areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it, ++itAgainst) {
17168a912857707864bbaaff9808717813105072a6ePatrick Benavoli
17268a912857707864bbaaff9808717813105072a6ePatrick Benavoli        CAreaConfiguration* pAreaConfigurationToValidate = *it;
17368a912857707864bbaaff9808717813105072a6ePatrick Benavoli        const CAreaConfiguration* pAreaConfigurationToValidateAgainst = *itAgainst;
17468a912857707864bbaaff9808717813105072a6ePatrick Benavoli
17568a912857707864bbaaff9808717813105072a6ePatrick Benavoli        // Delegate to area
17668a912857707864bbaaff9808717813105072a6ePatrick Benavoli        pAreaConfigurationToValidate->validateAgainst(pAreaConfigurationToValidateAgainst);
17768a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
17868a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
17968a912857707864bbaaff9808717813105072a6ePatrick Benavoli
18068a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Dynamic data application
18168a912857707864bbaaff9808717813105072a6ePatrick Benavolibool CDomainConfiguration::isApplicable() const
18268a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
18368a912857707864bbaaff9808717813105072a6ePatrick Benavoli    const CCompoundRule* pRule = getRule();
18468a912857707864bbaaff9808717813105072a6ePatrick Benavoli
18568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    return pRule && pRule->matches();
18668a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
18768a912857707864bbaaff9808717813105072a6ePatrick Benavoli
18868a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Merge existing configurations to given configurable element ones
18968a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::merge(CConfigurableElement* pToConfigurableElement, CConfigurableElement* pFromConfigurableElement)
19068a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
19168a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Retrieve related area configurations
19268a912857707864bbaaff9808717813105072a6ePatrick Benavoli    CAreaConfiguration* pAreaConfigurationToMergeTo = getAreaConfiguration(pToConfigurableElement);
19368a912857707864bbaaff9808717813105072a6ePatrick Benavoli    const CAreaConfiguration* pAreaConfigurationToMergeFrom = getAreaConfiguration(pFromConfigurableElement);
19468a912857707864bbaaff9808717813105072a6ePatrick Benavoli
19568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Do the merge
19668a912857707864bbaaff9808717813105072a6ePatrick Benavoli    pAreaConfigurationToMergeTo->copyFromInner(pAreaConfigurationToMergeFrom);
19768a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
19868a912857707864bbaaff9808717813105072a6ePatrick Benavoli
19968a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Domain splitting
20068a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::split(CConfigurableElement* pFromConfigurableElement)
20168a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
20268a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Retrieve related area configuration
20368a912857707864bbaaff9808717813105072a6ePatrick Benavoli    const CAreaConfiguration* pAreaConfigurationToSplitFrom = getAreaConfiguration(pFromConfigurableElement);
20468a912857707864bbaaff9808717813105072a6ePatrick Benavoli
20568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Go through children areas to copy configuration data to them
20668a912857707864bbaaff9808717813105072a6ePatrick Benavoli    uint32_t uiNbConfigurableElementChildren = pFromConfigurableElement->getNbChildren();
20768a912857707864bbaaff9808717813105072a6ePatrick Benavoli    uint32_t uiChild;
20868a912857707864bbaaff9808717813105072a6ePatrick Benavoli
20968a912857707864bbaaff9808717813105072a6ePatrick Benavoli    for (uiChild = 0; uiChild < uiNbConfigurableElementChildren; uiChild++) {
21068a912857707864bbaaff9808717813105072a6ePatrick Benavoli
21168a912857707864bbaaff9808717813105072a6ePatrick Benavoli        CConfigurableElement* pToChildConfigurableElement = static_cast<CConfigurableElement*>(pFromConfigurableElement->getChild(uiChild));
21268a912857707864bbaaff9808717813105072a6ePatrick Benavoli
21368a912857707864bbaaff9808717813105072a6ePatrick Benavoli        // Get child configurable elemnt's area configuration
21468a912857707864bbaaff9808717813105072a6ePatrick Benavoli        CAreaConfiguration* pChildAreaConfiguration = getAreaConfiguration(pToChildConfigurableElement);
21568a912857707864bbaaff9808717813105072a6ePatrick Benavoli
21668a912857707864bbaaff9808717813105072a6ePatrick Benavoli        // Do the copy
21768a912857707864bbaaff9808717813105072a6ePatrick Benavoli        pAreaConfigurationToSplitFrom->copyToInner(pChildAreaConfiguration);
21868a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
21968a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
22068a912857707864bbaaff9808717813105072a6ePatrick Benavoli
22168a912857707864bbaaff9808717813105072a6ePatrick Benavoli// AreaConfiguration retrieval from configurable element
22268a912857707864bbaaff9808717813105072a6ePatrick BenavoliCAreaConfiguration* CDomainConfiguration::getAreaConfiguration(const CConfigurableElement* pConfigurableElement) const
22368a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
22468a912857707864bbaaff9808717813105072a6ePatrick Benavoli    AreaConfigurationListIterator it;
22568a912857707864bbaaff9808717813105072a6ePatrick Benavoli
22668a912857707864bbaaff9808717813105072a6ePatrick Benavoli    for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) {
22768a912857707864bbaaff9808717813105072a6ePatrick Benavoli
22868a912857707864bbaaff9808717813105072a6ePatrick Benavoli        CAreaConfiguration* pAreaConfiguration = *it;
22968a912857707864bbaaff9808717813105072a6ePatrick Benavoli
23068a912857707864bbaaff9808717813105072a6ePatrick Benavoli        if (pAreaConfiguration->getConfigurableElement() == pConfigurableElement) {
23168a912857707864bbaaff9808717813105072a6ePatrick Benavoli
23268a912857707864bbaaff9808717813105072a6ePatrick Benavoli            return pAreaConfiguration;
23368a912857707864bbaaff9808717813105072a6ePatrick Benavoli        }
23468a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
23568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Not found?
23668a912857707864bbaaff9808717813105072a6ePatrick Benavoli    assert(0);
23768a912857707864bbaaff9808717813105072a6ePatrick Benavoli
23868a912857707864bbaaff9808717813105072a6ePatrick Benavoli    return NULL;
23968a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
24068a912857707864bbaaff9808717813105072a6ePatrick Benavoli
24168a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Presence of application condition
24268a912857707864bbaaff9808717813105072a6ePatrick Benavolibool CDomainConfiguration::hasRule() const
24368a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
24468a912857707864bbaaff9808717813105072a6ePatrick Benavoli    return !!getRule();
24568a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
24668a912857707864bbaaff9808717813105072a6ePatrick Benavoli
24768a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Rule
24868a912857707864bbaaff9808717813105072a6ePatrick Benavoliconst CCompoundRule* CDomainConfiguration::getRule() const
24968a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
25068a912857707864bbaaff9808717813105072a6ePatrick Benavoli    if (getNbChildren()) {
25168a912857707864bbaaff9808717813105072a6ePatrick Benavoli        // Rule created
25268a912857707864bbaaff9808717813105072a6ePatrick Benavoli        return static_cast<const CCompoundRule*>(getChild(ECompoundRule));
25368a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
25468a912857707864bbaaff9808717813105072a6ePatrick Benavoli    return NULL;
25568a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
25668a912857707864bbaaff9808717813105072a6ePatrick Benavoli
25768a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Serialization
25868a912857707864bbaaff9808717813105072a6ePatrick Benavolivoid CDomainConfiguration::binarySerialize(CBinaryStream& binaryStream)
25968a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
26068a912857707864bbaaff9808717813105072a6ePatrick Benavoli    AreaConfigurationListIterator it;
26168a912857707864bbaaff9808717813105072a6ePatrick Benavoli
26268a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Just propagate to areas
26368a912857707864bbaaff9808717813105072a6ePatrick Benavoli    for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) {
26468a912857707864bbaaff9808717813105072a6ePatrick Benavoli
26568a912857707864bbaaff9808717813105072a6ePatrick Benavoli        CAreaConfiguration* pAreaConfiguration = *it;
26668a912857707864bbaaff9808717813105072a6ePatrick Benavoli
26768a912857707864bbaaff9808717813105072a6ePatrick Benavoli        pAreaConfiguration->serialize(binaryStream);
26868a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
26968a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
27068a912857707864bbaaff9808717813105072a6ePatrick Benavoli
27168a912857707864bbaaff9808717813105072a6ePatrick Benavoli// Data size
27268a912857707864bbaaff9808717813105072a6ePatrick Benavoliuint32_t CDomainConfiguration::getDataSize() const
27368a912857707864bbaaff9808717813105072a6ePatrick Benavoli{
27468a912857707864bbaaff9808717813105072a6ePatrick Benavoli    uint32_t uiDataSize = 0;
27568a912857707864bbaaff9808717813105072a6ePatrick Benavoli    AreaConfigurationListIterator it;
27668a912857707864bbaaff9808717813105072a6ePatrick Benavoli
27768a912857707864bbaaff9808717813105072a6ePatrick Benavoli    // Just propagate request to areas
27868a912857707864bbaaff9808717813105072a6ePatrick Benavoli    for (it = _areaConfigurationList.begin(); it != _areaConfigurationList.end(); ++it) {
27968a912857707864bbaaff9808717813105072a6ePatrick Benavoli
28068a912857707864bbaaff9808717813105072a6ePatrick Benavoli        const CAreaConfiguration* pAreaConfiguration = *it;
28168a912857707864bbaaff9808717813105072a6ePatrick Benavoli
28268a912857707864bbaaff9808717813105072a6ePatrick Benavoli        uiDataSize += pAreaConfiguration->getSize();
28368a912857707864bbaaff9808717813105072a6ePatrick Benavoli    }
28468a912857707864bbaaff9808717813105072a6ePatrick Benavoli    return uiDataSize;
28568a912857707864bbaaff9808717813105072a6ePatrick Benavoli}
286