blob: 6afed7123b99bae0c195ef80e63ebd2e5b28cac3 [file] [log] [blame]
Patrick Benavoli68a91282011-08-31 11:23:23 +02001/* <auto_header>
2 * <FILENAME>
3 *
4 * INTEL CONFIDENTIAL
5 * Copyright © 2011 Intel
6 * Corporation All Rights Reserved.
7 *
8 * The source code contained or described herein and all documents related to
9 * the source code ("Material") are owned by Intel Corporation or its suppliers
10 * or licensors. Title to the Material remains with Intel Corporation or its
11 * suppliers and licensors. The Material contains trade secrets and proprietary
12 * and confidential information of Intel or its suppliers and licensors. The
13 * Material is protected by worldwide copyright and trade secret laws and
14 * treaty provisions. No part of the Material may be used, copied, reproduced,
15 * modified, published, uploaded, posted, transmitted, distributed, or
16 * disclosed in any way without Intel’s prior express written permission.
17 *
18 * No license under any patent, copyright, trade secret or other intellectual
19 * property right is granted to or conferred upon you by disclosure or delivery
20 * of the Materials, either expressly, by implication, inducement, estoppel or
21 * otherwise. Any license under such intellectual property rights must be
22 * express and approved by Intel in writing.
23 *
24 * AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com)
25 * CREATED: 2011-06-01
26 * UPDATED: 2011-07-27
27 *
28 *
29 * </auto_header>
30 */
31#pragma once
32
33#include "ParameterBlackboard.h"
34#include "BinaryStream.h"
Patrick Benavoli63499d42011-10-24 18:50:03 +020035#include "SyncerSet.h"
Patrick Benavoli68a91282011-08-31 11:23:23 +020036
37using namespace std;
38
39class CConfigurableElement;
40class CXmlElement;
41class CConfigurationAccessContext;
42
43class CAreaConfiguration
44{
45public:
Patrick Benavoli63499d42011-10-24 18:50:03 +020046 CAreaConfiguration(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet);
Patrick Benavoli68a91282011-08-31 11:23:23 +020047
48 // Save data from current
49 void save(const CParameterBlackboard* pMainBlackboard);
50
51 // Apply data to current
Patrick Benavoli63499d42011-10-24 18:50:03 +020052 bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, string& strError) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020053
54 // Ensure validity
55 void validate(const CParameterBlackboard* pMainBlackboard);
56
57 // Return validity
58 bool isValid() const;
59
60 // Ensure validity against given valid area configuration
61 void validateAgainst(const CAreaConfiguration* pValidAreaConfiguration);
62
63 // Compound handling
64 const CConfigurableElement* getConfigurableElement() const;
65
66 // Configuration merging
Frédéric Boisnard9620e442012-05-30 16:15:02 +020067 virtual void copyToOuter(CAreaConfiguration* pToAreaConfiguration) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020068
69 // Configuration splitting
Frédéric Boisnard9620e442012-05-30 16:15:02 +020070 virtual void copyFromOuter(const CAreaConfiguration* pFromAreaConfiguration);
Patrick Benavoli68a91282011-08-31 11:23:23 +020071
72 // XML configuration settings parsing/composing
Patrick Benavoli63499d42011-10-24 18:50:03 +020073 bool serializeXmlSettings(CXmlElement& xmlConfigurableElementSettingsElementContent, CConfigurationAccessContext& configurationAccessContext);
Patrick Benavoli68a91282011-08-31 11:23:23 +020074
75 // Serialization
76 void serialize(CBinaryStream& binaryStream);
77
78 // Data size
79 uint32_t getSize() const;
Frédéric Boisnard9620e442012-05-30 16:15:02 +020080
81protected:
82 CAreaConfiguration(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet, uint32_t uiSize);
83
Patrick Benavoli68a91282011-08-31 11:23:23 +020084private:
Frédéric Boisnard9620e442012-05-30 16:15:02 +020085 // Blackboard copies
86 virtual void copyTo(CParameterBlackboard* pToBlackboard, uint32_t uiOffset) const;
87 virtual void copyFrom(const CParameterBlackboard* pFromBlackboard, uint32_t uiOffset);
88
Patrick Benavoli68a91282011-08-31 11:23:23 +020089 // Store validity
90 void setValid(bool bValid);
91
Frédéric Boisnard9620e442012-05-30 16:15:02 +020092protected:
Patrick Benavoli63499d42011-10-24 18:50:03 +020093 // Associated configurable element
94 const CConfigurableElement* _pConfigurableElement;
95
Patrick Benavoli68a91282011-08-31 11:23:23 +020096 // Configurable element settings
97 CParameterBlackboard _blackboard;
Patrick Benavoli63499d42011-10-24 18:50:03 +020098
Frédéric Boisnard9620e442012-05-30 16:15:02 +020099private:
100 // Syncer set (required for immediate synchronization)
101 const CSyncerSet* _pSyncerSet;
102
Patrick Benavoli68a91282011-08-31 11:23:23 +0200103 // Area configuration validity (invalid area configurations can't be restored)
104 bool _bValid;
105};
106