| 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 "ParameterBlackboard.h" |
| 28 | #include "BinaryStream.h" |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 29 | #include "SyncerSet.h" |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 30 | |
| 31 | using namespace std; |
| 32 | |
| 33 | class CConfigurableElement; |
| 34 | class CXmlElement; |
| 35 | class CConfigurationAccessContext; |
| 36 | |
| 37 | class CAreaConfiguration |
| 38 | { |
| 39 | public: |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 40 | CAreaConfiguration(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 41 | |
| Sebastien Gonzalve | d7e4844 | 2013-03-12 14:30:27 +0100 | [diff] [blame^] | 42 | /* FIXME this was missing and probably buggy*/ |
| 43 | virtual ~CAreaConfiguration() {} |
| 44 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 45 | // Save data from current |
| 46 | void save(const CParameterBlackboard* pMainBlackboard); |
| 47 | |
| 48 | // Apply data to current |
| Kevin Rocard | ace81f8 | 2012-12-11 16:19:17 +0100 | [diff] [blame] | 49 | bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError) const; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 50 | |
| 51 | // Ensure validity |
| 52 | void validate(const CParameterBlackboard* pMainBlackboard); |
| 53 | |
| 54 | // Return validity |
| 55 | bool isValid() const; |
| 56 | |
| 57 | // Ensure validity against given valid area configuration |
| 58 | void validateAgainst(const CAreaConfiguration* pValidAreaConfiguration); |
| 59 | |
| 60 | // Compound handling |
| 61 | const CConfigurableElement* getConfigurableElement() const; |
| 62 | |
| 63 | // Configuration merging |
| Frédéric Boisnard | 9620e44 | 2012-05-30 16:15:02 +0200 | [diff] [blame] | 64 | virtual void copyToOuter(CAreaConfiguration* pToAreaConfiguration) const; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 65 | |
| 66 | // Configuration splitting |
| Frédéric Boisnard | 9620e44 | 2012-05-30 16:15:02 +0200 | [diff] [blame] | 67 | virtual void copyFromOuter(const CAreaConfiguration* pFromAreaConfiguration); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 68 | |
| 69 | // XML configuration settings parsing/composing |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 70 | bool serializeXmlSettings(CXmlElement& xmlConfigurableElementSettingsElementContent, CConfigurationAccessContext& configurationAccessContext); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 71 | |
| 72 | // Serialization |
| 73 | void serialize(CBinaryStream& binaryStream); |
| 74 | |
| 75 | // Data size |
| 76 | uint32_t getSize() const; |
| Frédéric Boisnard | 9620e44 | 2012-05-30 16:15:02 +0200 | [diff] [blame] | 77 | |
| Frédéric Boisnard | e42dacd | 2013-02-25 15:56:56 +0100 | [diff] [blame] | 78 | // Fetch the Configuration Blackboard |
| 79 | CParameterBlackboard& getBlackboard(); |
| 80 | const CParameterBlackboard& getBlackboard() const; |
| 81 | |
| Frédéric Boisnard | 9620e44 | 2012-05-30 16:15:02 +0200 | [diff] [blame] | 82 | protected: |
| 83 | CAreaConfiguration(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet, uint32_t uiSize); |
| 84 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 85 | private: |
| Frédéric Boisnard | 9620e44 | 2012-05-30 16:15:02 +0200 | [diff] [blame] | 86 | // Blackboard copies |
| 87 | virtual void copyTo(CParameterBlackboard* pToBlackboard, uint32_t uiOffset) const; |
| 88 | virtual void copyFrom(const CParameterBlackboard* pFromBlackboard, uint32_t uiOffset); |
| 89 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 90 | // Store validity |
| 91 | void setValid(bool bValid); |
| 92 | |
| Frédéric Boisnard | 9620e44 | 2012-05-30 16:15:02 +0200 | [diff] [blame] | 93 | protected: |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 94 | // Associated configurable element |
| 95 | const CConfigurableElement* _pConfigurableElement; |
| 96 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 97 | // Configurable element settings |
| 98 | CParameterBlackboard _blackboard; |
| Patrick Benavoli | 63499d4 | 2011-10-24 18:50:03 +0200 | [diff] [blame] | 99 | |
| Frédéric Boisnard | 9620e44 | 2012-05-30 16:15:02 +0200 | [diff] [blame] | 100 | private: |
| 101 | // Syncer set (required for immediate synchronization) |
| 102 | const CSyncerSet* _pSyncerSet; |
| 103 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 104 | // Area configuration validity (invalid area configurations can't be restored) |
| 105 | bool _bValid; |
| 106 | }; |
| 107 | |