blob: a87c75c1ad1a96b46ea72a95a8004be967acdb42 [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
Frédéric Boisnarde42dacd2013-02-25 15:56:56 +010061 // Get Blackboard for an element of the domain
62 CParameterBlackboard* getBlackboard(const CConfigurableElement* pConfigurableElement) const;
63
Patrick Benavoli68a91282011-08-31 11:23:23 +020064 // Save data from current
65 void save(const CParameterBlackboard* pMainBlackboard);
66 // Apply data to current
Kevin Rocardace81f82012-12-11 16:19:17 +010067 bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError = NULL) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020068 // Ensure validity for configurable element area configuration
69 void validate(const CConfigurableElement* pConfigurableElement, const CParameterBlackboard* pMainBlackboard);
70 // Ensure validity of all area configurations
71 void validate(const CParameterBlackboard* pMainBlackboard);
72 // Return configuration validity for given configurable element
73 bool isValid(const CConfigurableElement* pConfigurableElement) const;
74 // Ensure validity of configurable element's area configuration by copying in from a valid one
75 void validateAgainst(const CDomainConfiguration* pValidDomainConfiguration, const CConfigurableElement* pConfigurableElement);
76 // Ensure validity of all configurable element's area configuration by copying in from a valid ones
77 void validateAgainst(const CDomainConfiguration* pValidDomainConfiguration);
78 // Applicability checking
79 bool isApplicable() const;
80 // Merge existing configurations to given configurable element ones
81 void merge(CConfigurableElement* pToConfigurableElement, CConfigurableElement* pFromConfigurableElement);
82 // Domain splitting
83 void split(CConfigurableElement* pFromConfigurableElement);
84
85 // XML configuration settings parsing/composing
Patrick Benavoli63499d42011-10-24 18:50:03 +020086 bool parseSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext);
87 void composeSettings(CXmlElement& xmlConfigurationSettingsElement, CXmlSerializingContext& serializingContext) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020088
Patrick Benavoli68a91282011-08-31 11:23:23 +020089 // Serialization
90 virtual void binarySerialize(CBinaryStream& binaryStream);
91
92 // Data size
93 virtual uint32_t getDataSize() const;
94
95 // Class kind
96 virtual string getKind() const;
Frédéric Boisnarde42dacd2013-02-25 15:56:56 +010097
Patrick Benavoli68a91282011-08-31 11:23:23 +020098private:
99 // Returns true if children dynamic creation is to be dealt with (here, will allow child deletion upon clean)
100 virtual bool childrenAreDynamic() const;
Patrick Benavoli63499d42011-10-24 18:50:03 +0200101 // XML configuration settings serializing
102 bool serializeConfigurableElementSettings(CAreaConfiguration* pAreaConfiguration, CXmlElement& xmlConfigurableElementSettingsElement, CXmlSerializingContext& serializingContext, bool bSerializeOut);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200103 // AreaConfiguration retrieval from configurable element
104 CAreaConfiguration* getAreaConfiguration(const CConfigurableElement* pConfigurableElement) const;
Patrick Benavoli63499d42011-10-24 18:50:03 +0200105 // AreaConfiguration retrieval from present area configurations
106 CAreaConfiguration* findAreaConfiguration(const string& strConfigurableElementPath) const;
107 // AreaConfiguration retrieval from given area configuration list
108 CAreaConfiguration* findAreaConfiguration(const string& strConfigurableElementPath, const list<CAreaConfiguration*>& areaConfigurationList) const;
109 // Area configuration ordering
110 void reorderAreaConfigurations(const list<CAreaConfiguration*>& areaConfigurationList);
111 // Find area configuration rank from regular list: for ordered list maintainance
112 uint32_t getAreaConfigurationRank(const CAreaConfiguration* pAreaConfiguration) const;
113 // Find area configuration from regular list based on rank: for ordered list maintainance
114 CAreaConfiguration* getAreaConfiguration(uint32_t uiAreaConfigurationRank) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200115
116 // Rule
117 const CCompoundRule* getRule() const;
Patrick Benavoli0bd50542011-11-29 11:10:27 +0100118 CCompoundRule* getRule();
119 void setRule(CCompoundRule* pRule);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200120
121 // AreaConfigurations
122 list<CAreaConfiguration*> _areaConfigurationList;
Patrick Benavoli63499d42011-10-24 18:50:03 +0200123 list<CAreaConfiguration*> _orderedAreaConfigurationList;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200124};