summaryrefslogtreecommitdiff
path: root/XMPCommon/source/IConfigurable_I.cpp
blob: 8ce7e691d2f661de5f040ac63d9d783a045211ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// =================================================================================================
// ADOBE SYSTEMS INCORPORATED
// Copyright 2014 Adobe Systems Incorporated
// All Rights Reserved
//
// NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the terms
// of the Adobe license agreement accompanying it.
// =================================================================================================

#include "XMPCommon/Interfaces/BaseInterfaces/IConfigurable_I.h"
#include "XMPCommon/Utilities/TWrapperFunctions_I.h"

namespace XMP_COMPONENT_INT_NAMESPACE {

	void APICALL IConfigurable_I::SetParameter( const uint64 & key, bool value ) {
		CombinedDataValue uValue;
		uValue.boolValue = value;
		SetParameter( key, kDTBool, uValue );
	}

	void APICALL IConfigurable_I::SetParameter( const uint64 & key, uint64 value ) {
		CombinedDataValue uValue;
		uValue.uint64Value = value;
		SetParameter( key, kDTUint64, uValue );
	}

	void APICALL IConfigurable_I::SetParameter( const uint64 & key, int64 value ) {
		CombinedDataValue uValue;
		uValue.int64Value = value;
		SetParameter( key, kDTInt64, uValue );
	}

	void APICALL IConfigurable_I::SetParameter( const uint64 & key, double value ) {
		CombinedDataValue uValue;
		uValue.doubleValue = value;
		SetParameter( key, kDTDouble, uValue );
	}

	void APICALL IConfigurable_I::SetParameter( const uint64 & key, char value ) {
		CombinedDataValue uValue;
		uValue.charValue = value;
		SetParameter( key, kDTChar, uValue );
	}

	void APICALL IConfigurable_I::SetParameter( const uint64 & key, const char * value ) {
		CombinedDataValue uValue;
		uValue.constCharPtrValue = value;
		SetParameter( key, kDTConstCharBuffer, uValue );
	}

	void APICALL IConfigurable_I::SetParameter( const uint64 & key, const void * value ) {
		CombinedDataValue uValue;
		uValue.constVoidPtrValue = value;
		SetParameter( key, kDTConstVoidPtr, uValue );
	}

	void APICALL IConfigurable_I::setParameter( const uint64 & key, uint32 dataType, const CombinedDataValue & dataValue, pcIError_base & error ) __NOTHROW__ {
		if ( dataType == IConfigurable::kDTBool ) {
			CombinedDataValue & temp = const_cast< CombinedDataValue & >( dataValue );
			temp.boolValue = dataValue.uint32Value != 0 ? true : false;
		}
		CallUnSafeFunctionReturningVoid< IConfigurable_I, const uint64 &, eDataType, const CombinedDataValue & >(
			error, this, &IConfigurable_I::SetParameter, __FILE__, __LINE__, key, static_cast< eDataType >( dataType ), dataValue );
	}

	bool APICALL IConfigurable_I::GetParameter( const uint64 & key, bool & value ) const {
		CombinedDataValue uValue;
		auto a = GetParameter( key, kDTBool, uValue );
		value = uValue.boolValue;
		return a;
	}

	bool APICALL IConfigurable_I::GetParameter( const uint64 & key, uint64 & value ) const {
		CombinedDataValue uValue;
		auto a = GetParameter( key, kDTUint64, uValue );
		value = uValue.uint64Value;
		return a;
	}

	bool APICALL IConfigurable_I::GetParameter( const uint64 & key, int64 & value ) const {
		CombinedDataValue uValue;
		auto a = GetParameter( key, kDTInt64, uValue );
		value = uValue.int64Value;
		return a;
	}

	bool APICALL IConfigurable_I::GetParameter( const uint64 & key, double & value ) const {
		CombinedDataValue uValue;
		auto a = GetParameter( key, kDTDouble, uValue );
		value = uValue.doubleValue;
		return a;
	}

	bool APICALL IConfigurable_I::GetParameter( const uint64 & key, char & value ) const {
		CombinedDataValue uValue;
		auto a = GetParameter( key, kDTChar, uValue );
		value = uValue.charValue;
		return a;
	}

	bool APICALL IConfigurable_I::GetParameter( const uint64 & key, const char * & value ) const {
		CombinedDataValue uValue;
		auto a = GetParameter( key, kDTConstCharBuffer, uValue );
		value = uValue.constCharPtrValue;
		return a;
	}

	bool APICALL IConfigurable_I::GetParameter( const uint64 & key, const void * & value ) const {
		CombinedDataValue uValue;
		auto a = GetParameter( key, kDTConstVoidPtr, uValue );
		value = uValue.constVoidPtrValue;
		return a;
	}

	uint32 APICALL IConfigurable_I::getParameter( const uint64 & key, uint32 dataType, CombinedDataValue & value, pcIError_base & error ) const __NOTHROW__ {
		uint32 retValue = CallConstUnSafeFunction< IConfigurable_I, uint32, bool, const uint64 &, eDataType, CombinedDataValue & >(
			error, this, false, &IConfigurable_I::GetParameter, __FILE__, __LINE__, key, static_cast< eDataType >( dataType ), value );
		if ( dataType == kDTBool )
			value.boolValue = value.uint32Value != 0;
		return retValue;
	}

	uint32 APICALL IConfigurable_I::removeParameter( const uint64 & key, pcIError_base & error ) __NOTHROW__ {
		return CallUnSafeFunction< IConfigurable, uint32, bool, const uint64 & >(
			error, this, false, &IConfigurable::RemoveParameter, __FILE__, __LINE__, key );
	}

	void APICALL IConfigurable_I::getAllParameters( uint64 * array, sizet count ) const __NOTHROW__ {
		sizet innerCount = Size();
		std::vector< uint64 > vec = GetAllParameters();
		for ( sizet i = 0; i < innerCount; i++ ) {
			array[i] = vec[i];
		}
	}

	uint32 APICALL IConfigurable_I::getDataType( const uint64 & key, pcIError_base & error ) const __NOTHROW__ {
		return CallConstUnSafeFunction< IConfigurable, uint32, eDataType, const uint64 & >(
			error, this, kDTNone, &IConfigurable::GetDataType, __FILE__, __LINE__, key );
	}

}