blob: 0e6660f2acfbeafc41537629e050f95a8a657aed [file] [log] [blame]
Patrick Benavoli065264a2011-11-20 15:46:41 +01001/* ParameterHandle.h
2 **
3 ** Copyright © 2011 Intel
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 **
17 ** AUTHOR: Patrick Benavoli (patrickx.benavoli@intel.com)
18 ** CREATED: 2011-06-01
19 ** UPDATED: 2011-07-27
20 **
21 */
22#pragma once
23
24#include <stdint.h>
25#include <string>
26#include <vector>
27
28class CBaseParameter;
29class CParameterMgr;
30
31class CParameterHandle
32{
33public:
34 CParameterHandle(const CBaseParameter* pParameter, CParameterMgr* pParameterMgr);
35
36 // Parameter features
37 bool isRogue() const;
38 bool isArray() const;
39 // Array Length
40 uint32_t getArrayLength() const; // Returns 0 for scalar
41 // Parameter path
42 std::string getPath() const;
43 // Parameter kind
44 std::string getKind() const;
45
46 // Boolean access
47 bool setAsBoolean(bool bValue, std::string& strError);
48 bool getAsBoolean(bool bValue, std::string& strError) const;
49 bool setAsBooleanArray(const std::vector<bool>& abValues, std::string& strError);
50 bool getAsBooleanArray(std::vector<bool>& abValues, std::string& strError) const;
51
52 // Integer Access
53 bool setAsInteger(uint32_t uiValue, std::string& strError);
54 bool getAsInteger(uint32_t& uiValue, std::string& strError) const;
55 bool setAsIntegerArray(const std::vector<uint32_t>& auiValues, std::string& strError);
56 bool getAsIntegerArray(std::vector<uint32_t>& auiValues, std::string& strError) const;
57
58 // Signed Integer Access
59 bool setAsSignedInteger(int32_t iValue, std::string& strError);
60 bool getAsSignedInteger(int32_t& iValue, std::string& strError) const;
61 bool setAsSignedIntegerArray(const std::vector<int32_t>& aiValues, std::string& strError);
62 bool getAsSignedIntegerArray(std::vector<int32_t>& aiValues, std::string& strError) const;
63
64 // Double Access
65 bool setAsDouble(double dValue, std::string& strError);
66 bool getAsDouble(double& dValue, std::string& strError) const;
67 bool setAsDoubleArray(const std::vector<double>& adValues, std::string& strError);
68 bool getAsDoubleArray(std::vector<double>& adValues, std::string& strError) const;
69
70 // String Access
71 bool setAsString(const std::string& strValue, std::string& strError);
72 bool getAsString(std::string& strValue, std::string& strError) const;
73 bool setAsStringArray(const std::vector<std::string>& astrValues, std::string& strError);
74 bool getAsStringArray(std::vector<std::string>& astrValues, std::string& strError) const;
75
76private:
77 // Access validity
78 bool checkAccessValidity(bool bSet, uint32_t uiArrayLength, std::string& strError) const;
79
80 // Accessed parameter instance
81 const CBaseParameter* _pBaseParameter;
82 // Parameter Mgr
83 CParameterMgr* _pParameterMgr;
84 // Subsystem endianness
85 bool _bBigEndianSubsystem;
86};