blob: a4e2aad5d07e6b3c3aa784daf7f704d8b58c864a [file] [log] [blame]
Kevin Rocard93250d12012-07-19 17:48:30 +02001/*
Patrick Benavoli68a91282011-08-31 11:23:23 +02002 * 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 Benavoli68a91282011-08-31 11:23:23 +020022 * CREATED: 2011-06-01
23 * UPDATED: 2011-07-27
Patrick Benavoli68a91282011-08-31 11:23:23 +020024 */
25#pragma once
26
27#include "BinarySerializableElement.h"
28#include <list>
29
30class CConfigurableElement;
31class CAreaConfiguration;
32class CParameterBlackboard;
33class CConfigurationAccessContext;
34class CCompoundRule;
Patrick Benavoli63499d42011-10-24 18:50:03 +020035class CSyncerSet;
Patrick Benavoli0bd50542011-11-29 11:10:27 +010036class CSelectionCriteriaDefinition;
Patrick Benavoli68a91282011-08-31 11:23:23 +020037
38class CDomainConfiguration : public CBinarySerializableElement
39{
40 enum ChildElementType {
41 ECompoundRule
42 };
43 typedef list<CAreaConfiguration*>::const_iterator AreaConfigurationListIterator;
44public:
45 CDomainConfiguration(const string& strName);
46 virtual ~CDomainConfiguration();
47
48 // Configurable Elements association
Patrick Benavoli63499d42011-10-24 18:50:03 +020049 void addConfigurableElement(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet);
Patrick Benavoli68a91282011-08-31 11:23:23 +020050 void removeConfigurableElement(const CConfigurableElement* pConfigurableElement);
51
Patrick Benavoli63499d42011-10-24 18:50:03 +020052 // Sequence management
53 bool setElementSequence(const vector<string>& astrNewElementSequence, string& strError);
54 void getElementSequence(string& strResult) const;
55
Patrick Benavoli0bd50542011-11-29 11:10:27 +010056 // Application rule
57 bool setApplicationRule(const string& strApplicationRule, const CSelectionCriteriaDefinition* pSelectionCriteriaDefinition, string& strError);
58 void clearApplicationRule();
59 void getApplicationRule(string& strResult) const;
60
Patrick Benavoli68a91282011-08-31 11:23:23 +020061 // Save data from current
62 void save(const CParameterBlackboard* pMainBlackboard);
63 // Apply data to current
Kevin Rocardace81f82012-12-11 16:19:17 +010064 bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError = NULL) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020065 // 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 Benavoli63499d42011-10-24 18:50:03 +020083 bool parseSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext);
84 void composeSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020085
Patrick Benavoli68a91282011-08-31 11:23:23 +020086 // 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;
94private:
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 Benavoli63499d42011-10-24 18:50:03 +020097 // XML configuration settings serializing
98 bool serializeConfigurableElementSettings(CAreaConfiguration* pAreaConfiguration, CXmlElement& xmlConfigurableElementSettingsElement, CXmlSerializingContext& serializingContext, bool bSerializeOut);
Patrick Benavoli68a91282011-08-31 11:23:23 +020099 // AreaConfiguration retrieval from configurable element
100 CAreaConfiguration* getAreaConfiguration(const CConfigurableElement* pConfigurableElement) const;
Patrick Benavoli63499d42011-10-24 18:50:03 +0200101 // 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 Benavoli68a91282011-08-31 11:23:23 +0200111
112 // Rule
113 const CCompoundRule* getRule() const;
Patrick Benavoli0bd50542011-11-29 11:10:27 +0100114 CCompoundRule* getRule();
115 void setRule(CCompoundRule* pRule);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200116
117 // AreaConfigurations
118 list<CAreaConfiguration*> _areaConfigurationList;
Patrick Benavoli63499d42011-10-24 18:50:03 +0200119 list<CAreaConfiguration*> _orderedAreaConfigurationList;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200120};