|
1 // Copyright (c) 2008-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 // Wrappers for the RParameterFamilyBundle class for use inside the |
|
15 // messaging infrastructure. |
|
16 // CCFParameterFamilyBundle implements reference counting for the owned (by inheritance) |
|
17 // RParameterFamilyBundle. It also inherits from MCFNodeIdBase so it can be addressed from |
|
18 // anywhere in the messaging infrastructure. |
|
19 // RCFParameterFamilyBundle is a handle to CCFParameterFamilyBundle which points to it |
|
20 // by use of its TCommsId. This potentially allows it to safely access it even if it refers to |
|
21 // a CCFParameterFamilyBundle residing in a different thread or process. |
|
22 // It is a facade class to RParameterFamilyBundle so client code using a RCFParameterFamilyBundle |
|
23 // can look very much like it would if it were using a RParameterFamilyBundle directly. |
|
24 // Reference to an underlying bundle should be done by passing RCFParameterFamilyBundle by value. |
|
25 // Anyone interested in keeping the bundle for its own purposes should create a new instance |
|
26 // of RCFParameterFamilyBundle and Open it, passing the existing handle as an argument. |
|
27 // |
|
28 // |
|
29 // Note: Every effort should be made to ensure that the classes forming this API be kept consistent with each other |
|
30 // When making changes to these classes also see the files es_parameterbundle.h, es_parameterfamily.h, |
|
31 // ss_parameterfamilybundle.h |
|
32 // |
|
33 |
|
34 /** |
|
35 @file |
|
36 @publishedPartner |
|
37 @released |
|
38 */ |
|
39 |
|
40 |
|
41 #ifndef __SS_PARAMETERFAMILYBUNDLE_H_ |
|
42 #define __SS_PARAMETERFAMILYBUNDLE_H_ |
|
43 |
|
44 |
|
45 #include <elements/nm_node.h> |
|
46 #include <comms-infras/es_parameterfamily.h> |
|
47 |
|
48 namespace ESock |
|
49 { |
|
50 |
|
51 class CCFParameterFamilyBundle; |
|
52 |
|
53 |
|
54 class RCFParameterFamilyBundleC |
|
55 /** |
|
56 @publishedPartner |
|
57 @released |
|
58 */ |
|
59 { |
|
60 friend class RCFParameterFamilyBundle; |
|
61 public: |
|
62 // point to nothing by default. |
|
63 RCFParameterFamilyBundleC(): |
|
64 iBundleId(Messages::TNodeId::NullId()) |
|
65 { |
|
66 } |
|
67 |
|
68 TBool operator==(const RCFParameterFamilyBundleC& aRhs) const |
|
69 { |
|
70 return iBundleId==aRhs.iBundleId; |
|
71 } |
|
72 |
|
73 TBool operator!=(const RCFParameterFamilyBundleC& aRhs) const |
|
74 { |
|
75 return !(*this==aRhs); |
|
76 } |
|
77 |
|
78 // facade to CCFParameterFamilyBundle: |
|
79 |
|
80 // refcounting |
|
81 IMPORT_C void Open(); |
|
82 IMPORT_C void Open(const RCFParameterFamilyBundleC& aExistingHandle); |
|
83 IMPORT_C void Close(); |
|
84 |
|
85 // creation & deserialising |
|
86 IMPORT_C void CreateL(); |
|
87 IMPORT_C void LoadL(TDesC8& aDes); |
|
88 |
|
89 // serialising |
|
90 IMPORT_C TUint Length() const; |
|
91 IMPORT_C TInt Store(TDes8& aDes) const; |
|
92 |
|
93 // get/find families |
|
94 IMPORT_C const RParameterFamily GetFamilyAtIndex(TUint aIndex) const; |
|
95 IMPORT_C const RParameterFamily FindFamily(TUint32 aFamilyId) const; |
|
96 IMPORT_C TUint CountParameterSets() const; |
|
97 |
|
98 public: |
|
99 TBool IsNull() const |
|
100 { |
|
101 return const_cast<RCFParameterFamilyBundleC&>(*this).TargetBundle()?EFalse:ETrue; |
|
102 } |
|
103 void CheckOpenL() const |
|
104 { |
|
105 (void)const_cast<RCFParameterFamilyBundleC&>(*this).TargetBundleL(); |
|
106 } |
|
107 |
|
108 protected: |
|
109 IMPORT_C CCFParameterFamilyBundle* TargetBundle(); |
|
110 |
|
111 CCFParameterFamilyBundle& TargetBundleL() |
|
112 { |
|
113 CCFParameterFamilyBundle* tBundle = TargetBundle(); |
|
114 if(tBundle==NULL) |
|
115 { |
|
116 User::Leave(KErrNotReady); |
|
117 } |
|
118 return *tBundle; |
|
119 } |
|
120 |
|
121 private: |
|
122 RCFParameterFamilyBundleC& operator = (const RCFParameterFamilyBundleC& aSrc); |
|
123 |
|
124 |
|
125 private: |
|
126 Messages::TNodeId iBundleId; |
|
127 }; |
|
128 |
|
129 /** |
|
130 RCFParameterFamilyBundle_const defined for compatibility, use RCFParameterFamilyBundleC instead |
|
131 @publishedPartner |
|
132 @deprecated |
|
133 */ |
|
134 typedef RCFParameterFamilyBundleC RCFParameterFamilyBundle_const; |
|
135 |
|
136 |
|
137 class RCFParameterFamilyBundle : public RCFParameterFamilyBundleC |
|
138 /** |
|
139 @internalTechnology |
|
140 */ |
|
141 { |
|
142 friend class RCFParameterFamilyBundleC; |
|
143 public: |
|
144 // point to nothing by default. |
|
145 RCFParameterFamilyBundle(): |
|
146 RCFParameterFamilyBundleC() |
|
147 { |
|
148 } |
|
149 |
|
150 // adding/creating families |
|
151 IMPORT_C RParameterFamily CreateFamilyL(TUint32 aFamilyId); |
|
152 |
|
153 // get/find families |
|
154 IMPORT_C RParameterFamily GetFamilyAtIndex(TUint aIndex); |
|
155 IMPORT_C RParameterFamily FindFamily(TUint32 aFamilyId); |
|
156 |
|
157 // clear all parameters |
|
158 IMPORT_C void ClearAllParameters(RParameterFamily::TParameterSetType aType); |
|
159 |
|
160 private: |
|
161 RCFParameterFamilyBundle& operator = (const RCFParameterFamilyBundle& aSrc); |
|
162 }; |
|
163 |
|
164 |
|
165 } // namespace ESock |
|
166 |
|
167 #endif // __SS_PARAMETERFAMILYBUNDLE_H_ |
|
168 |