sl@0
|
1 |
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@publishedPartner
|
sl@0
|
19 |
@released
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
#ifndef MDFPUCONFIG_H
|
sl@0
|
23 |
#define MDFPUCONFIG_H
|
sl@0
|
24 |
|
sl@0
|
25 |
#include <e32base.h>
|
sl@0
|
26 |
#include <mmf/server/taskconfig.h>
|
sl@0
|
27 |
|
sl@0
|
28 |
const TInt KUidTTaskConfig = 0x102737DF;
|
sl@0
|
29 |
const TInt KUidTTaskConfig2 = 0x10273822 ;
|
sl@0
|
30 |
const TInt KUidPCMConfig = 0x102737E0;
|
sl@0
|
31 |
|
sl@0
|
32 |
/**
|
sl@0
|
33 |
Configuration structure base class.
|
sl@0
|
34 |
Represents a configuration structure identified by a base class.
|
sl@0
|
35 |
*/
|
sl@0
|
36 |
class TPuConfig
|
sl@0
|
37 |
{
|
sl@0
|
38 |
public:
|
sl@0
|
39 |
inline TUid Uid() const;
|
sl@0
|
40 |
protected:
|
sl@0
|
41 |
inline TPuConfig();
|
sl@0
|
42 |
TUid iUid;
|
sl@0
|
43 |
};
|
sl@0
|
44 |
|
sl@0
|
45 |
/**
|
sl@0
|
46 |
Template class to create a TPuConfig configuration given a structure and an unique UID to identify it.
|
sl@0
|
47 |
*/
|
sl@0
|
48 |
template<int U , class T>
|
sl@0
|
49 |
class TPuConfigParam : public TPuConfig
|
sl@0
|
50 |
{
|
sl@0
|
51 |
public:
|
sl@0
|
52 |
TPuConfigParam(const T& aParameterStructure);
|
sl@0
|
53 |
TPuConfigParam();
|
sl@0
|
54 |
operator T&();
|
sl@0
|
55 |
static const T* GetStructure(const TPuConfig& aConfig);
|
sl@0
|
56 |
static T* GetStructure(TPuConfig& aConfig);
|
sl@0
|
57 |
private:
|
sl@0
|
58 |
TPckgBuf<T> iBuf;
|
sl@0
|
59 |
};
|
sl@0
|
60 |
|
sl@0
|
61 |
/**
|
sl@0
|
62 |
Constructor
|
sl@0
|
63 |
@param aParameterStructure The structure to store
|
sl@0
|
64 |
*/
|
sl@0
|
65 |
template <int U, class T>
|
sl@0
|
66 |
TPuConfigParam<U,T>::TPuConfigParam(const T& aParameterStructure)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
iUid = TUid::Uid(U);
|
sl@0
|
69 |
iBuf = TPckgBuf<T>(aParameterStructure);
|
sl@0
|
70 |
}
|
sl@0
|
71 |
|
sl@0
|
72 |
template <int U, class T>
|
sl@0
|
73 |
TPuConfigParam<U,T>::TPuConfigParam()
|
sl@0
|
74 |
{
|
sl@0
|
75 |
iUid = TUid::Uid(U);
|
sl@0
|
76 |
}
|
sl@0
|
77 |
|
sl@0
|
78 |
/**
|
sl@0
|
79 |
Operator to return the structure represented by the class.
|
sl@0
|
80 |
@return The structure represented by the class.
|
sl@0
|
81 |
*/
|
sl@0
|
82 |
template <int U, class T>
|
sl@0
|
83 |
TPuConfigParam<U,T>::operator T&()
|
sl@0
|
84 |
{
|
sl@0
|
85 |
return iBuf();
|
sl@0
|
86 |
}
|
sl@0
|
87 |
|
sl@0
|
88 |
/**
|
sl@0
|
89 |
Static method to return the structure represented by TPuConfig.
|
sl@0
|
90 |
@param A const reference to the base structure.
|
sl@0
|
91 |
@return A const pointer to the structure represented by the class.
|
sl@0
|
92 |
*/
|
sl@0
|
93 |
template <int U, class T>
|
sl@0
|
94 |
const T* TPuConfigParam<U,T>::GetStructure(const TPuConfig& aConfig)
|
sl@0
|
95 |
{
|
sl@0
|
96 |
const T* ptr = &((static_cast<const TPuConfigParam<U,T>& >(aConfig)).iBuf());
|
sl@0
|
97 |
return ptr;
|
sl@0
|
98 |
}
|
sl@0
|
99 |
|
sl@0
|
100 |
/**
|
sl@0
|
101 |
Static method to return the structure represented by TPuConfig.
|
sl@0
|
102 |
@param A reference to the base structure.
|
sl@0
|
103 |
@return A pointer to the structure represented by the class.
|
sl@0
|
104 |
*/
|
sl@0
|
105 |
template <int U, class T>
|
sl@0
|
106 |
T* TPuConfigParam<U,T>::GetStructure(TPuConfig& aConfig)
|
sl@0
|
107 |
{
|
sl@0
|
108 |
T* ptr = &((static_cast<TPuConfigParam<U,T>& >(aConfig)).iBuf());
|
sl@0
|
109 |
return ptr;
|
sl@0
|
110 |
}
|
sl@0
|
111 |
|
sl@0
|
112 |
/**
|
sl@0
|
113 |
Numeric data type.
|
sl@0
|
114 |
*/
|
sl@0
|
115 |
enum TDataType
|
sl@0
|
116 |
{
|
sl@0
|
117 |
/**
|
sl@0
|
118 |
Signed data
|
sl@0
|
119 |
*/
|
sl@0
|
120 |
ESigned,
|
sl@0
|
121 |
/**
|
sl@0
|
122 |
Unsigned data
|
sl@0
|
123 |
*/
|
sl@0
|
124 |
EUnsigned
|
sl@0
|
125 |
};
|
sl@0
|
126 |
|
sl@0
|
127 |
/**
|
sl@0
|
128 |
Numeric endian type.
|
sl@0
|
129 |
*/
|
sl@0
|
130 |
enum TEndian
|
sl@0
|
131 |
{
|
sl@0
|
132 |
/**
|
sl@0
|
133 |
Little endian data, (LSB to MSB)
|
sl@0
|
134 |
*/
|
sl@0
|
135 |
ELittleEndian,
|
sl@0
|
136 |
/**
|
sl@0
|
137 |
Big endian data. (MSB to LSB)
|
sl@0
|
138 |
*/
|
sl@0
|
139 |
EBigEndian
|
sl@0
|
140 |
};
|
sl@0
|
141 |
|
sl@0
|
142 |
typedef TPuConfigParam<KUidTTaskConfig, TTaskConfig> TPuTaskConfig;
|
sl@0
|
143 |
typedef TPuConfigParam<KUidTTaskConfig2, TTaskConfig2> TPuTaskConfig2;
|
sl@0
|
144 |
|
sl@0
|
145 |
#include <mdf/mdfpuconfig.inl>
|
sl@0
|
146 |
|
sl@0
|
147 |
#endif // MDFPUCONFIG_H
|