blob: 46d9e3d8a99537e9cb906f0328ea450a484b3b3f [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
75protected:
76 CAreaConfiguration(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet, uint32_t uiSize);
77
Patrick Benavoli68a91282011-08-31 11:23:23 +020078private:
Frédéric Boisnard9620e442012-05-30 16:15:02 +020079 // Blackboard copies
80 virtual void copyTo(CParameterBlackboard* pToBlackboard, uint32_t uiOffset) const;
81 virtual void copyFrom(const CParameterBlackboard* pFromBlackboard, uint32_t uiOffset);
82
Patrick Benavoli68a91282011-08-31 11:23:23 +020083 // Store validity
84 void setValid(bool bValid);
85
Frédéric Boisnard9620e442012-05-30 16:15:02 +020086protected:
Patrick Benavoli63499d42011-10-24 18:50:03 +020087 // Associated configurable element
88 const CConfigurableElement* _pConfigurableElement;
89
Patrick Benavoli68a91282011-08-31 11:23:23 +020090 // Configurable element settings
91 CParameterBlackboard _blackboard;
Patrick Benavoli63499d42011-10-24 18:50:03 +020092
Frédéric Boisnard9620e442012-05-30 16:15:02 +020093private:
94 // Syncer set (required for immediate synchronization)
95 const CSyncerSet* _pSyncerSet;
96
Patrick Benavoli68a91282011-08-31 11:23:23 +020097 // Area configuration validity (invalid area configurations can't be restored)
98 bool _bValid;
99};
100