blob: b5e7e4c4b4839db0688b47714e965ad04a2b01a1 [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
67 void copyFromInner(const CAreaConfiguration* pFromAreaConfiguration);
68
69 // Configuration splitting
70 void copyToInner(CAreaConfiguration* pToAreaConfiguration) const;
71
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;
80private:
Patrick Benavoli68a91282011-08-31 11:23:23 +020081 // Store validity
82 void setValid(bool bValid);
83
Patrick Benavoli63499d42011-10-24 18:50:03 +020084 // Associated configurable element
85 const CConfigurableElement* _pConfigurableElement;
86
87 // Syncer set (required for immediate synchronization)
88 const CSyncerSet* _pSyncerSet;
89
Patrick Benavoli68a91282011-08-31 11:23:23 +020090 // Configurable element settings
91 CParameterBlackboard _blackboard;
Patrick Benavoli63499d42011-10-24 18:50:03 +020092
Patrick Benavoli68a91282011-08-31 11:23:23 +020093 // Area configuration validity (invalid area configurations can't be restored)
94 bool _bValid;
95};
96