Kevin Rocard | 93250d1 | 2012-07-19 17:48:30 +0200 | [diff] [blame^] | 1 | /* |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 2 | * 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 Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 22 | * CREATED: 2011-06-01 |
| 23 | * UPDATED: 2011-07-27 |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 24 | */ |
| 25 | #pragma once |
| 26 | |
| 27 | #include "ConfigurableElement.h" |
| 28 | #include "Mapper.h" |
| 29 | #include "MappingContext.h" |
| 30 | #include <stack> |
| 31 | #include <vector> |
| 32 | |
| 33 | class CInstanceDefinition; |
| 34 | class CComponentLibrary; |
| 35 | class CSubsystemObject; |
| 36 | class CSubsystemObjectCreator; |
| 37 | |
| 38 | class CSubsystem : public CConfigurableElement, private IMapper |
| 39 | { |
| 40 | // Subsystem objects iterator |
| 41 | typedef list<CSubsystemObject*>::const_iterator SubsystemObjectListIterator; |
| 42 | public: |
| 43 | CSubsystem(const string& strName); |
| 44 | virtual ~CSubsystem(); |
| 45 | |
| 46 | // From IXmlSink |
| 47 | virtual bool fromXml(const CXmlElement& xmlElement, CXmlSerializingContext& serializingContext); |
| 48 | |
| 49 | // Susbsystem Endianness |
| 50 | bool isBigEndian() const; |
| 51 | |
| 52 | // XML configuration settings parsing |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 53 | virtual bool serializeXmlSettings(CXmlElement& xmlConfigurationSettingsElementContent, CConfigurationAccessContext& configurationAccessContext) const; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 54 | |
| 55 | // from CElement |
| 56 | virtual string getKind() const; |
| 57 | protected: |
| 58 | // Parameter access |
Patrick Benavoli | 065264a | 2011-11-20 15:46:41 +0100 | [diff] [blame] | 59 | virtual bool accessValue(CPathNavigator& pathNavigator, string& strValue, bool bSet, CParameterAccessContext& parameterAccessContext) const; |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 60 | virtual void logValue(string& strValue, CErrorContext& errorContext) const; |
Patrick Benavoli | 6ccab9d | 2011-11-10 23:21:01 +0100 | [diff] [blame] | 61 | // Used for simulation and virtual subsystems |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 62 | virtual void setDefaultValues(CParameterAccessContext& parameterAccessContext) const; |
| 63 | |
| 64 | /// Functionality intendedn for derived Subsystems |
| 65 | // Subsystem context mapping keys publication |
| 66 | void addContextMappingKey(const string& strMappingKey); |
| 67 | // Subsystem object creator publication (strong reference) |
Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 68 | void addSubsystemObjectFactory(CSubsystemObjectCreator* pSubsystemObjectCreator); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 69 | private: |
| 70 | // Belonging subsystem |
| 71 | virtual const CSubsystem* getBelongingSubsystem() const; |
| 72 | |
| 73 | // Mapping execution |
| 74 | bool mapSubsystemElements(string& strError); |
| 75 | |
| 76 | // Generic subsystem mapping error handling |
| 77 | void getMappingError(string& strError, const string& strKey, const string& strMessage, const CInstanceConfigurableElement* pInstanceConfigurableElement); |
| 78 | |
| 79 | // From IMapper |
Patrick Benavoli | d3a86bf | 2011-11-07 19:33:30 +0100 | [diff] [blame] | 80 | virtual bool mapBegin(CInstanceConfigurableElement* pInstanceConfigurableElement, bool& bKeepDiving, string& strError); |
Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 81 | virtual void mapEnd(); |
| 82 | |
| 83 | // Mapping generic context handling |
| 84 | bool handleMappingContext(const CInstanceConfigurableElement* pInstanceConfigurableElement, CMappingContext& context, string& strError); |
| 85 | // Subsystem object creation handling |
| 86 | bool handleSubsystemObjectCreation(CInstanceConfigurableElement* pInstanceConfigurableElement, CMappingContext& context, string& strError); |
| 87 | |
| 88 | // Subsystem context mapping keys |
| 89 | vector<string> _contextMappingKeyArray; |
| 90 | |
| 91 | // Subsystem object creator map |
| 92 | vector<CSubsystemObjectCreator*> _subsystemObjectCreatorArray; |
| 93 | |
| 94 | // Subsystem sync objects (house keeping) |
| 95 | list<CSubsystemObject*> _subsystemObjectList; |
| 96 | |
| 97 | // Mapping Context stack |
| 98 | stack<CMappingContext> _contextStack; |
| 99 | |
| 100 | // Subelements |
| 101 | CComponentLibrary* _pComponentLibrary; |
| 102 | CInstanceDefinition* _pInstanceDefinition; |
| 103 | |
| 104 | // Endianness |
| 105 | bool _bBigEndian; |
| 106 | }; |