blob: 385ed9bc721c40aad0c8ffd7e6dfe5cc74de8708 [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 <stdint.h>
28#include <string>
29
30using namespace std;
31
32class CMappingContext
33{
34 // Item structure
35 struct SItem {
Renaud de Chivre46966e02013-09-02 10:48:36 +020036 const string* strKey;
Patrick Benavoli6ba361d2011-08-31 11:23:24 +020037 const string* strItem;
Patrick Benavoli68a91282011-08-31 11:23:23 +020038 bool bSet;
39 };
40
41public:
42 // Regular Constructor
Patrick Benavoli6ba361d2011-08-31 11:23:24 +020043 CMappingContext(uint32_t uiNbItemTypes);
Patrick Benavoli68a91282011-08-31 11:23:23 +020044 ~CMappingContext();
45
46 // Copy constructor
47 CMappingContext(const CMappingContext& from);
48
49 // Affectation
Kevin Rocardb2ffa5a2013-04-04 19:21:46 +020050 CMappingContext& operator=(const CMappingContext& right);
Patrick Benavoli68a91282011-08-31 11:23:23 +020051
52 // Item access
Renaud de Chivre46966e02013-09-02 10:48:36 +020053 /**
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 Benavoli6ba361d2011-08-31 11:23:24 +020063 const string& getItem(uint32_t uiItemType) const;
64 uint32_t getItemAsInteger(uint32_t uiItemType) const;
Renaud de Chivre46966e02013-09-02 10:48:36 +020065 /**
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 Benavoli68a91282011-08-31 11:23:23 +020073 bool iSet(uint32_t uiItemType) const;
Renaud de Chivre46966e02013-09-02 10:48:36 +020074
Patrick Benavoli68a91282011-08-31 11:23:23 +020075private:
76 // Item array
77 SItem* _pstItemArray;
78 // Items array size
Patrick Benavoli6ba361d2011-08-31 11:23:24 +020079 uint32_t _uiNbItemTypes;
Patrick Benavoli68a91282011-08-31 11:23:23 +020080};
81