blob: 796715a58f7585c09d7ec046e7764330132d6ee5 [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 "Element.h"
28
29#include <list>
30
31class CConfigurableDomain;
32class CSyncerSet;
33class ISyncer;
34class CSubsystem;
35class CConfigurationAccessContext;
36class CParameterAccessContext;
Frédéric Boisnard9620e442012-05-30 16:15:02 +020037class CAreaConfiguration;
Patrick Benavoli68a91282011-08-31 11:23:23 +020038
39class CConfigurableElement : public CElement
40{
41 friend class CConfigurableDomain;
Patrick Benavoli63499d42011-10-24 18:50:03 +020042 friend class CDomainConfiguration;
Patrick Benavoli68a91282011-08-31 11:23:23 +020043 typedef list<const CConfigurableDomain*>::const_iterator ConfigurableDomainListConstIterator;
44public:
Patrick Benavoli95ac0342011-11-07 20:32:51 +010045 CConfigurableElement(const string& strName = "");
Patrick Benavoli68a91282011-08-31 11:23:23 +020046 virtual ~CConfigurableElement();
47
48 // Offset in main blackboard
49 void setOffset(uint32_t uiOffset);
50 uint32_t getOffset() const;
51
52 // Allocation
53 virtual uint32_t getFootPrint() const;
54
55 // Syncer set (me, ascendant or descendant ones)
56 void fillSyncerSet(CSyncerSet& syncerSet) const;
57
58 // Belonging domain
59 bool belongsTo(const CConfigurableDomain* pConfigurableDomain) const;
60
61 // Belonging domains
62 void listBelongingDomains(string& strResult, bool bVertical = true) const;
63
64 // Matching check for domain association
65 bool hasNoDomainAssociated() const;
66
67 // Matching check for no valid associated domains
68 bool hasNoValidDomainAssociated() const;
69
70 // Owning domains
71 void listAssociatedDomains(string& strResult, bool bVertical = true) const;
72 uint32_t getBelongingDomainCount() const;
73
74 // Elements with no domains
75 void listRogueElements(string& strResult) const;
76
Patrick Benavoli4bed9212011-10-27 14:18:00 +020077 // Belonging to no domains
78 bool isRogue() const;
79
Patrick Benavoli6ba361d2011-08-31 11:23:24 +020080 // Footprint as string
81 string getFootprintAsString() const;
82
Patrick Benavoli065264a2011-11-20 15:46:41 +010083 // Belonging subsystem
84 virtual const CSubsystem* getBelongingSubsystem() const;
85
86 // Check element is a parameter
87 virtual bool isParameter() const;
88
Frédéric Boisnard9620e442012-05-30 16:15:02 +020089 // AreaConfiguration creation
90 virtual CAreaConfiguration* createAreaConfiguration(const CSyncerSet* pSyncerSet) const;
91
Patrick Benavoli68a91282011-08-31 11:23:23 +020092 // Parameter access
Patrick Benavoli065264a2011-11-20 15:46:41 +010093 virtual bool accessValue(CPathNavigator& pathNavigator, string& strValue, bool bSet, CParameterAccessContext& parameterAccessContext) const;
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +020094
95 /**
96 * Get the list of all the ancestors that have a mapping.
97 *
98 * The mapping is represented as a string of all the mapping data (key:value) defined in the
99 * context of the element.
100 * In this class, the method is generic and calls its parent getListOfElementsWithMappings(...)
101 * method.
102 *
103 * @param[in:out] configurableElementPath List of all the ConfigurableElements found
104 * that have a mapping. Elements are added at the end of the list, so the root Element will be
105 * the last one.
106 *
107 */
108 virtual void getListOfElementsWithMapping(list<const CConfigurableElement*>&
109 configurableElementPath) const;
110
Patrick Benavoli6ccab9d2011-11-10 23:21:01 +0100111 // Used for simulation and virtual subsystems
Patrick Benavoli68a91282011-08-31 11:23:23 +0200112 virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const;
113
Patrick Benavoli2ecf9002011-08-31 11:23:24 +0200114 // Element properties
115 virtual void showProperties(string& strResult) const;
116
Patrick Benavoli68a91282011-08-31 11:23:23 +0200117 // XML configuration settings parsing
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200118 virtual bool serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200119protected:
120 // Syncer (me or ascendant)
121 virtual ISyncer* getSyncer() const;
122 // Syncer set (descendant)
123 virtual void fillSyncerSetFromDescendant(CSyncerSet& syncerSet) const;
124 // Configuration Domain local search
125 bool containsConfigurableDomain(const CConfigurableDomain* pConfigurableDomain) const;
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200126
Patrick Benavoli68a91282011-08-31 11:23:23 +0200127private:
128 // Configurable domain association
129 void addAttachedConfigurableDomain(const CConfigurableDomain* pConfigurableDomain);
130 void removeAttachedConfigurableDomain(const CConfigurableDomain* pConfigurableDomain);
131
132 // Belonging domain ascending search
133 bool belongsToDomainAscending(const CConfigurableDomain* pConfigurableDomain) const;
134
135 // Belonging domains
136 void getBelongingDomains(list<const CConfigurableDomain*>& configurableDomainList) const;
137 void listDomains(const list<const CConfigurableDomain*>& configurableDomainList, string& strResult, bool bVertical) const;
138
Patrick Benavoli68a91282011-08-31 11:23:23 +0200139 // Check parent is still of current type (by structure knowledge)
140 bool isOfConfigurableElementType(const CElement* pParent) const;
141
142 // Offset in main blackboard
143 uint32_t _uiOffset;
144
145 // Associated configurable domains
146 list<const CConfigurableDomain*> _configurableDomainList;
147};
148