blob: bb1cc92e33bc9a513956c94422c6606540f3cf1f [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
Sebastien Gonzalved7e48442013-03-12 14:30:27 +010042 /* FIXME this was missing and probably buggy*/
43 virtual ~CAreaConfiguration() {}
44
Patrick Benavoli68a91282011-08-31 11:23:23 +020045 // Save data from current
46 void save(const CParameterBlackboard* pMainBlackboard);
47
48 // Apply data to current
Kevin Rocardace81f82012-12-11 16:19:17 +010049 bool restore(CParameterBlackboard* pMainBlackboard, bool bSync, list<string>* plstrError) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020050
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 Boisnard9620e442012-05-30 16:15:02 +020064 virtual void copyToOuter(CAreaConfiguration* pToAreaConfiguration) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +020065
66 // Configuration splitting
Frédéric Boisnard9620e442012-05-30 16:15:02 +020067 virtual void copyFromOuter(const CAreaConfiguration* pFromAreaConfiguration);
Patrick Benavoli68a91282011-08-31 11:23:23 +020068
69 // XML configuration settings parsing/composing
Patrick Benavoli63499d42011-10-24 18:50:03 +020070 bool serializeXmlSettings(CXmlElement& xmlConfigurableElementSettingsElementContent, CConfigurationAccessContext& configurationAccessContext);
Patrick Benavoli68a91282011-08-31 11:23:23 +020071
72 // Serialization
73 void serialize(CBinaryStream& binaryStream);
74
75 // Data size
76 uint32_t getSize() const;
Frédéric Boisnard9620e442012-05-30 16:15:02 +020077
Frédéric Boisnarde42dacd2013-02-25 15:56:56 +010078 // Fetch the Configuration Blackboard
79 CParameterBlackboard& getBlackboard();
80 const CParameterBlackboard& getBlackboard() const;
81
Frédéric Boisnard9620e442012-05-30 16:15:02 +020082protected:
83 CAreaConfiguration(const CConfigurableElement* pConfigurableElement, const CSyncerSet* pSyncerSet, uint32_t uiSize);
84
Patrick Benavoli68a91282011-08-31 11:23:23 +020085private:
Frédéric Boisnard9620e442012-05-30 16:15:02 +020086 // Blackboard copies
87 virtual void copyTo(CParameterBlackboard* pToBlackboard, uint32_t uiOffset) const;
88 virtual void copyFrom(const CParameterBlackboard* pFromBlackboard, uint32_t uiOffset);
89
Patrick Benavoli68a91282011-08-31 11:23:23 +020090 // Store validity
91 void setValid(bool bValid);
92
Frédéric Boisnard9620e442012-05-30 16:15:02 +020093protected:
Patrick Benavoli63499d42011-10-24 18:50:03 +020094 // Associated configurable element
95 const CConfigurableElement* _pConfigurableElement;
96
Patrick Benavoli68a91282011-08-31 11:23:23 +020097 // Configurable element settings
98 CParameterBlackboard _blackboard;
Patrick Benavoli63499d42011-10-24 18:50:03 +020099
Frédéric Boisnard9620e442012-05-30 16:15:02 +0200100private:
101 // Syncer set (required for immediate synchronization)
102 const CSyncerSet* _pSyncerSet;
103
Patrick Benavoli68a91282011-08-31 11:23:23 +0200104 // Area configuration validity (invalid area configurations can't be restored)
105 bool _bValid;
106};
107