Kevin Rocard | 93250d1 | 2012-07-19 17:48:30 +0200 | [diff] [blame] | 1 | /* |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2 | * INTEL CONFIDENTIAL |
| 3 | * Copyright © 2011 Intel |
| 4 | * Corporation All Rights Reserved. |
| 5 | * |
| 6 | * The source code contained or described herein and all documents related to |
| 7 | * the source code ("Material") are owned by Intel Corporation or its suppliers |
| 8 | * or licensors. Title to the Material remains with Intel Corporation or its |
| 9 | * suppliers and licensors. The Material contains trade secrets and proprietary |
| 10 | * and confidential information of Intel or its suppliers and licensors. The |
| 11 | * Material is protected by worldwide copyright and trade secret laws and |
| 12 | * treaty provisions. No part of the Material may be used, copied, reproduced, |
| 13 | * modified, published, uploaded, posted, transmitted, distributed, or |
| 14 | * disclosed in any way without Intel’s prior express written permission. |
| 15 | * |
| 16 | * No license under any patent, copyright, trade secret or other intellectual |
| 17 | * property right is granted to or conferred upon you by disclosure or delivery |
| 18 | * of the Materials, either expressly, by implication, inducement, estoppel or |
| 19 | * otherwise. Any license under such intellectual property rights must be |
| 20 | * express and approved by Intel in writing. |
| 21 | * |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 22 | * CREATED: 2011-06-01 |
| 23 | * UPDATED: 2011-07-27 |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 24 | */ |
| 25 | #pragma once |
| 26 | |
| 27 | #include "BinarySerializableElement.h" |
| 28 | #include <list> |
| 29 | |
| 30 | class CConfigurableElement; |
| 31 | class CAreaConfiguration; |
| 32 | class CParameterBlackboard; |
| 33 | class CConfigurationAccessContext; |
| 34 | class CCompoundRule; |
Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 35 | class CSyncerSet; |
Patrick Benavoli | 0bd5054 | 2011-11-29 11:10:27 +0100 | [diff] [blame] | 36 | class CSelectionCriteriaDefinition; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 37 | |
| 38 | class CDomainConfiguration : public CBinarySerializableElement |
| 39 | { |
| 40 | enum ChildElementType { |
| 41 | ECompoundRule |
| 42 | }; |
| 43 | typedef list<CAreaConfiguration*>::const_iterator AreaConfigurationListIterator; |
| 44 | public: |
| 45 | CDomainConfiguration(const string& strName); |
| 46 | virtual ~CDomainConfiguration(); |
| 47 | |
| 48 | // Configurable Elements association |
Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 49 | void addConfigurableElement(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 50 | void removeConfigurableElement(const CConfigurableElement* pConfigurableElement); |
| 51 | |
Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 52 | // Sequence management |
| 53 | bool setElementSequence(const vector<string>& astrNewElementSequence, string& strError); |
| 54 | void getElementSequence(string& strResult) const; |
| 55 | |
Patrick Benavoli | 0bd5054 | 2011-11-29 11:10:27 +0100 | [diff] [blame] | 56 | // Application rule |
| 57 | bool setApplicationRule(const string& strApplicationRule, const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition, string& strError); |
| 58 | void clearApplicationRule(); |
| 59 | void getApplicationRule(string& strResult) const; |
| 60 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 61 | // Save data from current |
| 62 | void save(const CParameterBlackboard* pMainBlackboard); |
| 63 | // Apply data to current |
Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame^] | 64 | bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError = NULL) const; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 65 | // Ensure validity for configurable element area configuration |
| 66 | void validate(const CConfigurableElement* pConfigurableElement, const CParameterBlackboard* pMainBlackboard); |
| 67 | // Ensure validity of all area configurations |
| 68 | void validate(const CParameterBlackboard* pMainBlackboard); |
| 69 | // Return configuration validity for given configurable element |
| 70 | bool isValid(const CConfigurableElement* pConfigurableElement) const; |
| 71 | // Ensure validity of configurable element's area configuration by copying in from a valid one |
| 72 | void validateAgainst(const CDomainConfiguration* pValidDomainConfiguration, const CConfigurableElement* pConfigurableElement); |
| 73 | // Ensure validity of all configurable element's area configuration by copying in from a valid ones |
| 74 | void validateAgainst(const CDomainConfiguration* pValidDomainConfiguration); |
| 75 | // Applicability checking |
| 76 | bool isApplicable() const; |
| 77 | // Merge existing configurations to given configurable element ones |
| 78 | void merge(CConfigurableElement* pToConfigurableElement, CConfigurableElement* pFromConfigurableElement); |
| 79 | // Domain splitting |
| 80 | void split(CConfigurableElement* pFromConfigurableElement); |
| 81 | |
| 82 | // XML configuration settings parsing/composing |
Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 83 | bool parseSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext); |
| 84 | void composeSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext) const; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 85 | |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 86 | // Serialization |
| 87 | virtual void binarySerialize(CBinaryStream& binaryStream); |
| 88 | |
| 89 | // Data size |
| 90 | virtual uint32_t getDataSize() const; |
| 91 | |
| 92 | // Class kind |
| 93 | virtual string getKind() const; |
| 94 | private: |
| 95 | // Returns true if children dynamic creation is to be dealt with (here, will allow child deletion upon clean) |
| 96 | virtual bool childrenAreDynamic() const; |
Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 97 | // XML configuration settings serializing |
| 98 | bool serializeConfigurableElementSettings(CAreaConfiguration* pAreaConfiguration, CXmlElement& xmlConfigurableElementSettingsElement, CXmlSerializingContext& serializingContext, bool bSerializeOut); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 99 | // AreaConfiguration retrieval from configurable element |
| 100 | CAreaConfiguration* getAreaConfiguration(const CConfigurableElement* pConfigurableElement) const; |
Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 101 | // AreaConfiguration retrieval from present area configurations |
| 102 | CAreaConfiguration* findAreaConfiguration(const string& strConfigurableElementPath) const; |
| 103 | // AreaConfiguration retrieval from given area configuration list |
| 104 | CAreaConfiguration* findAreaConfiguration(const string& strConfigurableElementPath, const list<CAreaConfiguration*>& areaConfigurationList) const; |
| 105 | // Area configuration ordering |
| 106 | void reorderAreaConfigurations(const list<CAreaConfiguration*>& areaConfigurationList); |
| 107 | // Find area configuration rank from regular list: for ordered list maintainance |
| 108 | uint32_t getAreaConfigurationRank(const CAreaConfiguration* pAreaConfiguration) const; |
| 109 | // Find area configuration from regular list based on rank: for ordered list maintainance |
| 110 | CAreaConfiguration* getAreaConfiguration(uint32_t uiAreaConfigurationRank) const; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 111 | |
| 112 | // Rule |
| 113 | const CCompoundRule* getRule() const; |
Patrick Benavoli | 0bd5054 | 2011-11-29 11:10:27 +0100 | [diff] [blame] | 114 | CCompoundRule* getRule(); |
| 115 | void setRule(CCompoundRule* pRule); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 116 | |
| 117 | // AreaConfigurations |
| 118 | list<CAreaConfiguration*> _areaConfigurationList; |
Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 119 | list<CAreaConfiguration*> _orderedAreaConfigurationList; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 120 | }; |