blob: bcf2229e23c9812a5b979aff4aa62cc3789a85db [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 "ParameterBlackboard.h"
28#include "BinaryStream.h"
Patrick Benavoli63499d42011-10-24 18:50:03 +020029#include "SyncerSet.h"
Patrick Benavoli68a91282011-08-31 11:23:23 +020030
31using namespace std;
32
33class CConfigurableElement;
34class CXmlElement;
35class CConfigurationAccessContext;
36
37class CAreaConfiguration
38{
39public:
Patrick Benavoli63499d42011-10-24 18:50:03 +020040 CAreaConfiguration(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet);
Patrick Benavoli68a91282011-08-31 11:23:23 +020041
42 // Save data from current
43 void save(const CParameterBlackboard* pMainBlackboard);
44
45 // Apply data to current
Kevin Rocardace81f82012-12-11 16:19:17 +010046 bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020047
48 // Ensure validity
49 void validate(const CParameterBlackboard* pMainBlackboard);
50
51 // Return validity
52 bool isValid() const;
53
54 // Ensure validity against given valid area configuration
55 void validateAgainst(const CAreaConfiguration* pValidAreaConfiguration);
56
57 // Compound handling
58 const CConfigurableElement* getConfigurableElement() const;
59
60 // Configuration merging
Frédéric Boisnard9620e442012-05-30 16:15:02 +020061 virtual void copyToOuter(CAreaConfiguration* pToAreaConfiguration) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020062
63 // Configuration splitting
Frédéric Boisnard9620e442012-05-30 16:15:02 +020064 virtual void copyFromOuter(const CAreaConfiguration* pFromAreaConfiguration);
Patrick Benavoli68a91282011-08-31 11:23:23 +020065
66 // XML configuration settings parsing/composing
Patrick Benavoli63499d42011-10-24 18:50:03 +020067 bool serializeXmlSettings(CXmlElement& xmlConfigurableElementSettingsElementContent, CConfigurationAccessContext& configurationAccessContext);
Patrick Benavoli68a91282011-08-31 11:23:23 +020068
69 // Serialization
70 void serialize(CBinaryStream& binaryStream);
71
72 // Data size
73 uint32_t getSize() const;
Frédéric Boisnard9620e442012-05-30 16:15:02 +020074
Frédéric Boisnarde42dacd2013-02-25 15:56:56 +010075 // Fetch the Configuration Blackboard
76 CParameterBlackboard& getBlackboard();
77 const CParameterBlackboard& getBlackboard() const;
78
Frédéric Boisnard9620e442012-05-30 16:15:02 +020079protected:
80 CAreaConfiguration(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet, uint32_t uiSize);
81
Patrick Benavoli68a91282011-08-31 11:23:23 +020082private:
Frédéric Boisnard9620e442012-05-30 16:15:02 +020083 // Blackboard copies
84 virtual void copyTo(CParameterBlackboard* pToBlackboard, uint32_t uiOffset) const;
85 virtual void copyFrom(const CParameterBlackboard* pFromBlackboard, uint32_t uiOffset);
86
Patrick Benavoli68a91282011-08-31 11:23:23 +020087 // Store validity
88 void setValid(bool bValid);
89
Frédéric Boisnard9620e442012-05-30 16:15:02 +020090protected:
Patrick Benavoli63499d42011-10-24 18:50:03 +020091 // Associated configurable element
92 const CConfigurableElement* _pConfigurableElement;
93
Patrick Benavoli68a91282011-08-31 11:23:23 +020094 // Configurable element settings
95 CParameterBlackboard _blackboard;
Patrick Benavoli63499d42011-10-24 18:50:03 +020096
Frédéric Boisnard9620e442012-05-30 16:15:02 +020097private:
98 // Syncer set (required for immediate synchronization)
99 const CSyncerSet* _pSyncerSet;
100
Patrick Benavoli68a91282011-08-31 11:23:23 +0200101 // Area configuration validity (invalid area configurations can't be restored)
102 bool _bValid;
103};
104