| 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 <stdint.h> |
| 28 | #include <string> |
| 29 | |
| 30 | using namespace std; |
| 31 | |
| 32 | class CMappingContext |
| 33 | { |
| 34 | // Item structure |
| 35 | struct SItem { |
| Renaud de Chivre | 46966e0 | 2013-09-02 10:48:36 +0200 | [diff] [blame] | 36 | const string* strKey; |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 37 | const string* strItem; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 38 | bool bSet; |
| 39 | }; |
| 40 | |
| 41 | public: |
| 42 | // Regular Constructor |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 43 | CMappingContext(uint32_t uiNbItemTypes); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 44 | ~CMappingContext(); |
| 45 | |
| 46 | // Copy constructor |
| 47 | CMappingContext(const CMappingContext& from); |
| 48 | |
| 49 | // Affectation |
| Kevin Rocard | b2ffa5a | 2013-04-04 19:21:46 +0200 | [diff] [blame] | 50 | CMappingContext& operator=(const CMappingContext& right); |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 51 | |
| 52 | // Item access |
| Renaud de Chivre | 46966e0 | 2013-09-02 10:48:36 +0200 | [diff] [blame] | 53 | /** |
| 54 | * Set context mapping item key and value. |
| 55 | * |
| 56 | * @param[in] uiItemType Mapping item index. |
| 57 | * @param[in] pStrKey Mapping item key name. |
| 58 | * @param[in] pStrItem Mapping item value. |
| 59 | * |
| 60 | * @return False if already set, true else. |
| 61 | */ |
| 62 | bool setItem(uint32_t uiItemType, const string* pStrKey, const string* pStrItem); |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 63 | const string& getItem(uint32_t uiItemType) const; |
| 64 | uint32_t getItemAsInteger(uint32_t uiItemType) const; |
| Renaud de Chivre | 46966e0 | 2013-09-02 10:48:36 +0200 | [diff] [blame] | 65 | /** |
| 66 | * Get mapping item value from its key name. |
| 67 | * |
| 68 | * @param[in] strKey Mapping item key name. |
| 69 | * |
| 70 | * @return Mapping item value pointer if found, NULL else. |
| 71 | */ |
| 72 | const string* getItem(const string& strKey) const; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 73 | bool iSet(uint32_t uiItemType) const; |
| Renaud de Chivre | 46966e0 | 2013-09-02 10:48:36 +0200 | [diff] [blame] | 74 | |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 75 | private: |
| 76 | // Item array |
| 77 | SItem* _pstItemArray; |
| 78 | // Items array size |
| Patrick Benavoli | 6ba361d | 2011-08-31 11:23:24 +0200 | [diff] [blame] | 79 | uint32_t _uiNbItemTypes; |
| Patrick Benavoli | 68a9128 | 2011-08-31 11:23:23 +0200 | [diff] [blame] | 80 | }; |
| 81 | |