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