|
1 /* |
|
2 * Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Attribute library object holder. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CPENGATTRLIBOBJECTHOLDER_H |
|
19 #define CPENGATTRLIBOBJECTHOLDER_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <E32Base.h> |
|
23 |
|
24 |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class MPEngPresenceAttrManager; |
|
28 class MPEngPresenceAttrTransactionEnv; |
|
29 class MPEngTransactionFactory; |
|
30 class CPEngSessionSlotId; |
|
31 class CPEngSessionSlotObjectCon; |
|
32 |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Attribute library reference counted singleton holder. |
|
38 * |
|
39 * @lib PEngAttrLib |
|
40 * @since 3.0 |
|
41 */ |
|
42 NONSHARABLE_CLASS( CPEngAttrLibObjectHolder ) : public CObject |
|
43 { |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Singleton instance retrieve method. |
|
48 * |
|
49 * Gets pointer to attribute library |
|
50 * singleton object holder. Object holder |
|
51 * is reference counted, so returned instance |
|
52 * is pushed on the CleanupStack and freed |
|
53 * automaticly in case of leave or |
|
54 * CleanupStack::PopAndDestroy(). |
|
55 * |
|
56 * @since 3.0 |
|
57 */ |
|
58 static CPEngAttrLibObjectHolder* InstanceLC(); |
|
59 |
|
60 |
|
61 /** |
|
62 * Helper to verify that everything is |
|
63 * cleaned properly when executing |
|
64 * thread is closing. |
|
65 * |
|
66 * @since 3.0 |
|
67 */ |
|
68 static void HandleThreadDetach(); |
|
69 |
|
70 |
|
71 private: |
|
72 |
|
73 /** |
|
74 * Two-phased constructor. |
|
75 * Leaves created object on the CleanupStack. |
|
76 */ |
|
77 static CPEngAttrLibObjectHolder* NewLC(); |
|
78 |
|
79 |
|
80 /** |
|
81 * C++ default constructor. |
|
82 */ |
|
83 CPEngAttrLibObjectHolder(); |
|
84 |
|
85 |
|
86 /** |
|
87 * Private destructor. |
|
88 * |
|
89 * Singleton holder is reference counted. |
|
90 * It is automaticly destroyed when last |
|
91 * holded object or reference is destroyed. |
|
92 */ |
|
93 ~CPEngAttrLibObjectHolder(); |
|
94 |
|
95 |
|
96 |
|
97 /** |
|
98 * Symbian 2nd phase constructor |
|
99 */ |
|
100 void ConstructL(); |
|
101 |
|
102 |
|
103 |
|
104 public: // Singleton access |
|
105 |
|
106 |
|
107 /** |
|
108 * Returns attribute manager instance for requested |
|
109 * NWSessionSlot. |
|
110 * |
|
111 * Method increases returned object reference |
|
112 * count by one before returning it ==> client must |
|
113 * call Close() to object when no more needed. |
|
114 * |
|
115 * @since 3.0 |
|
116 * @return Attribute manager instance. |
|
117 */ |
|
118 MPEngPresenceAttrManager* AttributeManagerInstanceL( |
|
119 const CPEngSessionSlotId& aSlotId ); |
|
120 |
|
121 |
|
122 /** |
|
123 * |
|
124 * @since 3.0 |
|
125 * @return Attribute transaction environment instance. |
|
126 */ |
|
127 MPEngPresenceAttrTransactionEnv* AttributeTransEnvInstanceL( |
|
128 const CPEngSessionSlotId& aSlotId ); |
|
129 |
|
130 |
|
131 /** |
|
132 * |
|
133 * @since 3.0 |
|
134 * @return Attribute transaction factory instance. |
|
135 */ |
|
136 MPEngTransactionFactory* AttributeTransFactInstanceL( |
|
137 const CPEngSessionSlotId& aSlotId ); |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 public: // Debug helpers |
|
143 |
|
144 #ifdef _DEBUG |
|
145 static CPEngAttrLibObjectHolder* __DbgInstanceOrNull(); |
|
146 void __DbgObjectCounts( TInt& aHolder, |
|
147 TInt& aAttrMan, |
|
148 TInt& aTransEnv, |
|
149 TInt& aTransFact ) const; |
|
150 void __DbgAttrManRefCount( const CPEngSessionSlotId& aSlotId, TInt& aRefCount ) const; |
|
151 void __DbgTransEnvRefCount( const CPEngSessionSlotId& aSlotId, TInt& aRefCount ) const; |
|
152 void __DbgTransFactRefCount( const CPEngSessionSlotId& aSlotId, TInt& aRefCount ) const; |
|
153 #endif // _DEBUG |
|
154 |
|
155 |
|
156 |
|
157 private: // Data |
|
158 |
|
159 //OWN: Session Slot attribute managers |
|
160 CPEngSessionSlotObjectCon* iAttributeManagers; |
|
161 |
|
162 |
|
163 //OWN: Session Slot attribute transaction environments |
|
164 CPEngSessionSlotObjectCon* iAttributeTransEnvs; |
|
165 |
|
166 |
|
167 //OWN: Session Slot attribute transaction factories |
|
168 CPEngSessionSlotObjectCon* iAttributeTransFacts; |
|
169 |
|
170 }; |
|
171 |
|
172 #endif // CPENGATTRLIBOBJECTHOLDER_H |
|
173 |
|
174 // End of File |