blob: 9a550d51dd684656faa5e970fa0b37fcbc189fa3 [file] [log] [blame]
David Wagnerb76c9d62014-02-05 18:30:24 +01001/*
2 * Copyright (c) 2011-2014, Intel Corporation
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation and/or
13 * other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software without
17 * specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Patrick Benavoli68a91282011-08-31 11:23:23 +020029 */
30#include "Subsystem.h"
31#include "ComponentLibrary.h"
32#include "InstanceDefinition.h"
33#include "XmlParameterSerializingContext.h"
34#include "ParameterAccessContext.h"
35#include "ConfigurationAccessContext.h"
36#include "SubsystemObjectCreator.h"
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +020037#include "MappingData.h"
Patrick Benavoli68a91282011-08-31 11:23:23 +020038#include <assert.h>
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +020039#include <sstream>
Patrick Benavoli68a91282011-08-31 11:23:23 +020040
David Wagner01c74952014-03-05 10:55:15 +010041#define base CConfigurableElementWithMapping
Patrick Benavoli68a91282011-08-31 11:23:23 +020042
David Wagner01c74952014-03-05 10:55:15 +010043CSubsystem::CSubsystem(const string& strName) : base(strName), _pComponentLibrary(new CComponentLibrary), _pInstanceDefinition(new CInstanceDefinition), _bBigEndian(false), _pMappingData(NULL)
Patrick Benavoli68a91282011-08-31 11:23:23 +020044{
45 // Note: A subsystem contains instance components
46 // InstanceDefintion and ComponentLibrary objects are then not chosen to be children
47 // They'll be delt with locally
48}
49
50CSubsystem::~CSubsystem()
51{
52 // Remove subsystem objects
53 SubsystemObjectListIterator subsystemObjectIt;
54
55 for (subsystemObjectIt = _subsystemObjectList.begin(); subsystemObjectIt != _subsystemObjectList.end(); ++subsystemObjectIt) {
56
57 delete *subsystemObjectIt;
58 }
59
60 // Remove susbsystem creators
61 uint32_t uiIndex;
62
63 for (uiIndex = 0; uiIndex < _subsystemObjectCreatorArray.size(); uiIndex++) {
64
65 delete _subsystemObjectCreatorArray[uiIndex];
66 }
67
68 // Order matters!
69 delete _pInstanceDefinition;
70 delete _pComponentLibrary;
David Wagner01c74952014-03-05 10:55:15 +010071
72 delete _pMappingData;
Patrick Benavoli68a91282011-08-31 11:23:23 +020073}
74
75string CSubsystem::getKind() const
76{
77 return "Subsystem";
78}
79
80// Susbsystem Endianness
81bool CSubsystem::isBigEndian() const
82{
83 return _bBigEndian;
84}
85
Guillaume Denneulinf2fd15a2012-12-20 17:53:29 +010086// Susbsystem sanity
87bool CSubsystem::isAlive() const
88{
89 return true;
90}
91
92// Resynchronization after subsystem restart needed
93bool CSubsystem::needResync(bool bClear)
94{
95 (void)bClear;
96
97 return false;
98}
99
Patrick Benavoli68a91282011-08-31 11:23:23 +0200100// From IXmlSink
101bool CSubsystem::fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext)
102{
103 // Context
104 CXmlParameterSerializingContext& parameterBuildContext = static_cast<CXmlParameterSerializingContext&>(serializingContext);
105
106 // Install temporary component library for further component creation
107 parameterBuildContext.setComponentLibrary(_pComponentLibrary);
108
109 CXmlElement childElement;
110
David Wagner01c74952014-03-05 10:55:15 +0100111 // Manage mapping attribute
112 if (xmlElement.hasAttribute("Mapping")) {
113
114 _pMappingData = new CMappingData;
115 if (!_pMappingData->fromXml(xmlElement, serializingContext)) {
116
117 return false;
118 }
119 }
120
Patrick Benavoli68a91282011-08-31 11:23:23 +0200121 // XML populate ComponentLibrary
122 xmlElement.getChildElement("ComponentLibrary", childElement);
123
124 if (!_pComponentLibrary->fromXml(childElement, serializingContext)) {
125
126 return false;
127 }
128
129 // XML populate InstanceDefintion
130 xmlElement.getChildElement("InstanceDefintion", childElement);
131 if (!_pInstanceDefinition->fromXml(childElement, serializingContext)) {
132
133 return false;
134 }
135
136 // Create components
137 _pInstanceDefinition->createInstances(this);
138
139 // Execute mapping to create subsystem mapping entities
140 string strError;
141 if (!mapSubsystemElements(strError)) {
142
143 serializingContext.setError(strError);
144
145 return false;
146 }
147
148 // Endianness
149 _bBigEndian = xmlElement.getAttributeBoolean("Endianness", "Big");
150
151 return true;
152}
153
154// XML configuration settings parsing
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200155bool CSubsystem::serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const
Patrick Benavoli68a91282011-08-31 11:23:23 +0200156{
157 // Fix Endianness
158 configurationAccessContext.setBigEndianSubsystem(_bBigEndian);
159
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200160 return base::serializeXmlSettings(xmlConfigurationSettingsElementContent, configurationAccessContext);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200161}
162
163
164bool CSubsystem::mapSubsystemElements(string& strError)
165{
166 // Default mapping context
David Wagner01c74952014-03-05 10:55:15 +0100167 CMappingContext context(_contextMappingKeyArray.size());
168 // Add Subsystem-level mapping data, which will be propagated to all children
169 handleMappingContext(this, context, strError);
170
171 _contextStack.push(context);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200172
173 // Map all instantiated subelements in subsystem
174 uint32_t uiNbChildren = getNbChildren();
175 uint32_t uiChild;
176
177 for (uiChild = 0; uiChild < uiNbChildren; uiChild++) {
178
179 CInstanceConfigurableElement* pInstanceConfigurableChildElement = static_cast<CInstanceConfigurableElement*>(getChild(uiChild));
180
181 if (!pInstanceConfigurableChildElement->map(*this, strError)) {
182
183 return false;
184 }
185 }
186 return true;
187}
188
189// Parameter access
Patrick Benavoli065264a2011-11-20 15:46:41 +0100190bool CSubsystem::accessValue(CPathNavigator& pathNavigator, string& strValue, bool bSet, CParameterAccessContext& parameterAccessContext) const
Patrick Benavoli68a91282011-08-31 11:23:23 +0200191{
Patrick Benavoli68a91282011-08-31 11:23:23 +0200192 // Deal with Endianness
Patrick Benavoli065264a2011-11-20 15:46:41 +0100193 parameterAccessContext.setBigEndianSubsystem(_bBigEndian);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200194
Patrick Benavoli065264a2011-11-20 15:46:41 +0100195 return base::accessValue(pathNavigator, strValue, bSet, parameterAccessContext);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200196}
197
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200198// Formats the mapping of the ConfigurableElements
199string CSubsystem::formatMappingDataList(
200 const list<const CConfigurableElement*>& configurableElementPath) const
201{
202 // The list is parsed in reverse order because it has been filled from the leaf to the trunk
203 // of the tree. When formatting the mapping, we want to start from the subsystem level
204 ostringstream ossStream;
205 list<const CConfigurableElement*>::const_reverse_iterator it;
206 for (it = configurableElementPath.rbegin(); it != configurableElementPath.rend(); ++it) {
207
208 const CInstanceConfigurableElement* pInstanceConfigurableElement =
209 static_cast<const CInstanceConfigurableElement*>(*it);
210
211 ossStream << pInstanceConfigurableElement->getFormattedMapping() << ", ";
212 }
213 return ossStream.str();
214}
215
216// Find the CSubystemObject containing a specific CInstanceConfigurableElement
217const CSubsystemObject* CSubsystem::findSubsystemObjectFromConfigurableElement(
218 const CInstanceConfigurableElement* pInstanceConfigurableElement) const {
219
220 const CSubsystemObject* pSubsystemObject = NULL;
221
222 list<CSubsystemObject*>::const_iterator it;
223 for (it = _subsystemObjectList.begin(); it != _subsystemObjectList.end(); ++it) {
224
225 // Check if one of the SubsystemObjects is associated with a ConfigurableElement
226 // corresponding to the expected one
227 pSubsystemObject = *it;
228 if (pSubsystemObject->getConfigurableElement() == pInstanceConfigurableElement) {
229
230 break;
231 }
232 }
233
234 return pSubsystemObject;
235}
236
Frédéric Boisnard487ce852013-07-19 17:17:52 +0200237void CSubsystem::findSubsystemLevelMappingKeyValue(
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200238 const CInstanceConfigurableElement* pInstanceConfigurableElement,
239 string& strMappingKey,
240 string& strMappingValue) const
241{
242 // Find creator to get key name
243 vector<CSubsystemObjectCreator*>::const_iterator it;
244 for (it = _subsystemObjectCreatorArray.begin();
245 it != _subsystemObjectCreatorArray.end(); ++it) {
246
247 const CSubsystemObjectCreator* pSubsystemObjectCreator = *it;
248
249 strMappingKey = pSubsystemObjectCreator->getMappingKey();
250
251 // Check if the ObjectCreator MappingKey corresponds to the element mapping data
252 const string* pStrValue;
253 if (pInstanceConfigurableElement->getMappingData(strMappingKey, pStrValue)) {
254
255 strMappingValue = *pStrValue;
256 return;
257 }
258 }
259 assert(0);
260}
261
262// Formats the mapping data as a comma separated list of key value pairs
263string CSubsystem::getFormattedSubsystemMappingData(
264 const CInstanceConfigurableElement* pInstanceConfigurableElement) const
265{
266 // Find the SubsystemObject related to pInstanceConfigurableElement
267 const CSubsystemObject* pSubsystemObject = findSubsystemObjectFromConfigurableElement(
268 pInstanceConfigurableElement);
269
270 // Exit if node does not correspond to a SubsystemObject
271 if (pSubsystemObject == NULL) {
272
273 return "";
274 }
275
276 // Find SubsystemCreator mapping key
277 string strMappingKey;
278 string strMappingValue; // mapping value where amends are not replaced by their value
Frédéric Boisnard487ce852013-07-19 17:17:52 +0200279 findSubsystemLevelMappingKeyValue(pInstanceConfigurableElement, strMappingKey, strMappingValue);
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200280
281 // Find SubSystemObject mapping value (with amends replaced by their value)
282 return strMappingKey + ":" + pSubsystemObject->getFormattedMappingValue();
283}
284
285string CSubsystem::getMapping(list<const CConfigurableElement*>& configurableElementPath) const
286{
287 if (configurableElementPath.empty()) {
288
289 return "";
290 }
291
292 // Get the first element, which is the element containing the amended mapping
293 const CInstanceConfigurableElement* pInstanceConfigurableElement =
294 static_cast<const CInstanceConfigurableElement*>(configurableElementPath.front());
295 configurableElementPath.pop_front();
296 // Now the list only contains elements whose mapping are related to the context
297
298 // Format context mapping data
299 string strValue = formatMappingDataList(configurableElementPath);
300
301 // Print the mapping of the first node, which corresponds to a SubsystemObject
302 strValue += getFormattedSubsystemMappingData(pInstanceConfigurableElement);
303
304 return strValue;
305}
306
Patrick Benavoli68a91282011-08-31 11:23:23 +0200307void CSubsystem::logValue(string& strValue, CErrorContext& errorContext) const
308{
Patrick Benavoli065264a2011-11-20 15:46:41 +0100309 CParameterAccessContext& parameterAccessContext = static_cast<CParameterAccessContext&>(errorContext);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200310
311 // Deal with Endianness
Patrick Benavoli065264a2011-11-20 15:46:41 +0100312 parameterAccessContext.setBigEndianSubsystem(_bBigEndian);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200313
314 return base::logValue(strValue, errorContext);
315}
316
Patrick Benavoli6ccab9d2011-11-10 23:21:01 +0100317// Used for simulation and virtual subsystems
Patrick Benavoli68a91282011-08-31 11:23:23 +0200318void CSubsystem::setDefaultValues(CParameterAccessContext& parameterAccessContext) const
319{
320 // Deal with Endianness
321 parameterAccessContext.setBigEndianSubsystem(_bBigEndian);
322
323 base::setDefaultValues(parameterAccessContext);
324}
325
326// Belonging subsystem
327const CSubsystem* CSubsystem::getBelongingSubsystem() const
328{
329 return this;
330}
331
332// Subsystem context mapping keys publication
333void CSubsystem::addContextMappingKey(const string& strMappingKey)
334{
335 _contextMappingKeyArray.push_back(strMappingKey);
336}
337
338// Subsystem object creator publication (strong reference)
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200339void CSubsystem::addSubsystemObjectFactory(CSubsystemObjectCreator* pSubsystemObjectCreator)
Patrick Benavoli68a91282011-08-31 11:23:23 +0200340{
341 _subsystemObjectCreatorArray.push_back(pSubsystemObjectCreator);
342}
343
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200344// Generic error handling from derived subsystem classes
David Wagner01c74952014-03-05 10:55:15 +0100345string CSubsystem::getMappingError(
346 const string& strKey,
347 const string& strMessage,
348 const CConfigurableElementWithMapping* pConfigurableElementWithMapping) const
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200349{
350 return getName() + " " + getKind() + " " +
351 "mapping:\n" + strKey + " " +
352 "error: \"" + strMessage + "\" " +
David Wagner01c74952014-03-05 10:55:15 +0100353 "for element " + pConfigurableElementWithMapping->getPath();
354}
355
356
357bool CSubsystem::getMappingData(const std::string& strKey, const std::string*& pStrValue) const
358{
359 if (_pMappingData) {
360
361 return _pMappingData->getValue(strKey, pStrValue);
362 }
363 return false;
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200364}
365
Patrick Benavoli68a91282011-08-31 11:23:23 +0200366// Mapping generic context handling
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200367bool CSubsystem::handleMappingContext(
David Wagner01c74952014-03-05 10:55:15 +0100368 const CConfigurableElementWithMapping* pConfigurableElementWithMapping,
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200369 CMappingContext& context,
370 string& strError) const
Patrick Benavoli68a91282011-08-31 11:23:23 +0200371{
372 // Feed context with found mapping data
373 uint32_t uiItem;
374
Renaud de Chivre46966e02013-09-02 10:48:36 +0200375 for (uiItem = 0; uiItem < _contextMappingKeyArray.size(); uiItem++) {
Patrick Benavoli68a91282011-08-31 11:23:23 +0200376
Renaud de Chivre46966e02013-09-02 10:48:36 +0200377 const string& strKey = _contextMappingKeyArray[uiItem];
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200378 const string* pStrValue;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200379
David Wagner01c74952014-03-05 10:55:15 +0100380 if (pConfigurableElementWithMapping->getMappingData(strKey, pStrValue)) {
Patrick Benavoli68a91282011-08-31 11:23:23 +0200381 // Assign item to context
Renaud de Chivre46966e02013-09-02 10:48:36 +0200382 if (!context.setItem(uiItem, &strKey, pStrValue)) {
Patrick Benavoli68a91282011-08-31 11:23:23 +0200383
David Wagner01c74952014-03-05 10:55:15 +0100384 strError = getMappingError(strKey, "Already set", pConfigurableElementWithMapping);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200385
386 return false;
387 }
388 }
389 }
390 return true;
391}
392
Kevin Rocard084cafb2013-01-28 17:02:08 +0100393// Subsystem object creation handling
394bool CSubsystem::handleSubsystemObjectCreation(
395 CInstanceConfigurableElement* pInstanceConfigurableElement,
396 CMappingContext& context, bool& bHasCreatedSubsystemObject, string& strError)
Patrick Benavoli68a91282011-08-31 11:23:23 +0200397{
398 uint32_t uiItem;
Kevin Rocard084cafb2013-01-28 17:02:08 +0100399 bHasCreatedSubsystemObject = false;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200400
401 for (uiItem = 0; uiItem < _subsystemObjectCreatorArray.size(); uiItem++) {
402
Kevin Rocard3414f992013-04-02 19:49:40 +0200403 const CSubsystemObjectCreator* pSubsystemObjectCreator =
404 _subsystemObjectCreatorArray[uiItem];
Patrick Benavoli68a91282011-08-31 11:23:23 +0200405
406 // Mapping key
407 string strKey = pSubsystemObjectCreator->getMappingKey();
408 // Object id
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200409 const string* pStrValue;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200410
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200411 if (pInstanceConfigurableElement->getMappingData(strKey, pStrValue)) {
Patrick Benavoli68a91282011-08-31 11:23:23 +0200412
Kevin Rocard3414f992013-04-02 19:49:40 +0200413 // First check context consistency
414 // (required ancestors must have been set prior to object creation)
Patrick Benavoli68a91282011-08-31 11:23:23 +0200415 uint32_t uiAncestorKey;
416 uint32_t uiAncestorMask = pSubsystemObjectCreator->getAncestorMask();
417
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200418 for (uiAncestorKey = 0; uiAncestorKey < _contextMappingKeyArray.size(); uiAncestorKey++) {
Patrick Benavoli68a91282011-08-31 11:23:23 +0200419
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200420 if (!((1 << uiAncestorKey) & uiAncestorMask)) {
421 // Ancestor not required
422 continue;
423 }
424 // Check ancestor was provided
Patrick Benavoli68a91282011-08-31 11:23:23 +0200425 if (!context.iSet(uiAncestorKey)) {
426
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200427 strError = getMappingError(strKey, _contextMappingKeyArray[uiAncestorKey] +
428 " not set", pInstanceConfigurableElement);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200429
430 return false;
431 }
432 }
433
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200434 // Then check configurable element size is correct
Kevin Rocard3414f992013-04-02 19:49:40 +0200435 if (pInstanceConfigurableElement->getFootPrint() >
436 pSubsystemObjectCreator->getMaxConfigurableElementSize()) {
Patrick Benavoli68a91282011-08-31 11:23:23 +0200437
Kevin Rocard3414f992013-04-02 19:49:40 +0200438 string strSizeError = "Size should not exceed " +
439 pSubsystemObjectCreator->getMaxConfigurableElementSize();
Patrick Benavoli68a91282011-08-31 11:23:23 +0200440
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200441 strError = getMappingError(strKey, strSizeError, pInstanceConfigurableElement);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200442
443 return false;
444 }
Patrick Benavoli6ba361d2011-08-31 11:23:24 +0200445
446 // Do create object and keep its track
Kevin Rocard3414f992013-04-02 19:49:40 +0200447 _subsystemObjectList.push_back(pSubsystemObjectCreator->objectCreate(
448 *pStrValue, pInstanceConfigurableElement, context));
Patrick Benavoli68a91282011-08-31 11:23:23 +0200449
Kevin Rocard084cafb2013-01-28 17:02:08 +0100450 // Indicate subsytem creation to caller
451 bHasCreatedSubsystemObject = true;
452
453 // The subsystem Object has been instantiated, no need to continue looking for an
454 // instantiation mapping
455 break;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200456 }
457 }
Patrick Benavoli68a91282011-08-31 11:23:23 +0200458
Kevin Rocard084cafb2013-01-28 17:02:08 +0100459 return true;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200460}
461
Patrick Benavoli68a91282011-08-31 11:23:23 +0200462// From IMapper
Kevin Rocard084cafb2013-01-28 17:02:08 +0100463// Handle a configurable element mapping
464bool CSubsystem::mapBegin(CInstanceConfigurableElement* pInstanceConfigurableElement,
465 bool& bKeepDiving, string& strError)
Patrick Benavoli68a91282011-08-31 11:23:23 +0200466{
467 // Get current context
468 CMappingContext context = _contextStack.top();
469
Kevin Rocard084cafb2013-01-28 17:02:08 +0100470 // Add mapping in context
Renaud de Chivre46966e02013-09-02 10:48:36 +0200471 if (!handleMappingContext(pInstanceConfigurableElement, context,
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200472 strError)) {
Kevin Rocard084cafb2013-01-28 17:02:08 +0100473
474 return false;
475 }
476
477 // Push context
478 _contextStack.push(context);
479
480 // Assume diving by default
481 bKeepDiving = true;
482
483 // Deal with ambiguous usage of parameter blocks
484 bool bShouldCreateSubsystemObject = true;
485
Patrick Benavoli68a91282011-08-31 11:23:23 +0200486 switch(pInstanceConfigurableElement->getType()) {
487
Kevin Rocard084cafb2013-01-28 17:02:08 +0100488 case CInstanceConfigurableElement::EComponent:
Kevin Rocard084cafb2013-01-28 17:02:08 +0100489 case CInstanceConfigurableElement::EParameterBlock:
490 // Subsystem object creation is optional in parameter blocks
491 bShouldCreateSubsystemObject = false;
492 // No break
493 case CInstanceConfigurableElement::EBitParameterBlock:
494 case CInstanceConfigurableElement::EParameter:
495 case CInstanceConfigurableElement::EStringParameter:
Patrick Benavoli68a91282011-08-31 11:23:23 +0200496
Kevin Rocard084cafb2013-01-28 17:02:08 +0100497 bool bHasCreatedSubsystemObject;
498
499 if (!handleSubsystemObjectCreation(pInstanceConfigurableElement, context,
500 bHasCreatedSubsystemObject, strError)) {
501
502 return false;
503 }
504 // Check for creation error
505 if (bShouldCreateSubsystemObject && !bHasCreatedSubsystemObject) {
506
Frederic Boisnard6cae0ec2013-05-23 18:48:58 +0200507 strError = getMappingError("Not found",
508 "Subsystem object mapping key is missing",
509 pInstanceConfigurableElement);
Kevin Rocard084cafb2013-01-28 17:02:08 +0100510 return false;
511 }
512 // Not created and no error, keep diving
513 bKeepDiving = !bHasCreatedSubsystemObject;
514
515 return true;
516
517 default:
518 assert(0);
Patrick Benavoli68a91282011-08-31 11:23:23 +0200519 return false;
Patrick Benavoli68a91282011-08-31 11:23:23 +0200520 }
Patrick Benavoli68a91282011-08-31 11:23:23 +0200521}
522
523void CSubsystem::mapEnd()
524{
525 // Unstack context
526 _contextStack.pop();
527}