|
1 /* |
|
2 * Copyright (c) 2005 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: Registry for subsessions and positioning module instances |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <e32base.h> |
|
22 |
|
23 #include "epos_csuplprotocolmanagerbase.h" |
|
24 #include "epos_csuplsessionmanager.h" |
|
25 #include "epos_csuplsubsessionregistry.h" |
|
26 #include "epos_csuplipcsubsession.h" |
|
27 #include "epos_csuplglobal.h" |
|
28 |
|
29 //#ifdef _DEBUG |
|
30 _LIT(KTraceFileName, "SUPL_GW::epos_csuplsubsessionregistry.cpp"); |
|
31 //#endif |
|
32 |
|
33 // ================= MEMBER FUNCTIONS ======================= |
|
34 |
|
35 // C++ default constructor can NOT contain any code, that |
|
36 // might leave. |
|
37 // |
|
38 CSuplSubsessionRegistry::CSuplSubsessionRegistry() |
|
39 { |
|
40 } |
|
41 |
|
42 // EPOC default constructor |
|
43 void CSuplSubsessionRegistry::ConstructL() |
|
44 { |
|
45 DEBUG_TRACE("ConstructL", __LINE__) |
|
46 iRegistryIndex = CObjectIx::NewL(); |
|
47 iRegistryContainerIndex = CObjectConIx::NewL(); |
|
48 iRegistryContainer = iRegistryContainerIndex->CreateL(); |
|
49 } |
|
50 |
|
51 // Two-phased constructor |
|
52 CSuplSubsessionRegistry* CSuplSubsessionRegistry::NewL() |
|
53 { |
|
54 DEBUG_TRACE("NewL", __LINE__) |
|
55 CSuplSubsessionRegistry* self = new (ELeave) CSuplSubsessionRegistry; |
|
56 CleanupStack::PushL(self); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop(self); |
|
59 return self; |
|
60 } |
|
61 |
|
62 // Destructor |
|
63 CSuplSubsessionRegistry::~CSuplSubsessionRegistry() |
|
64 { |
|
65 DEBUG_TRACE("~CSuplSubsessionRegistry", __LINE__) |
|
66 delete iRegistryIndex; |
|
67 delete iRegistryContainerIndex; |
|
68 iRegistryContainer = NULL; // deleted by index |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------- |
|
72 // CSuplSubsessionRegistry::SubSessionFromHandleL |
|
73 // |
|
74 // (other items were commented in a header). |
|
75 // --------------------------------------------------------- |
|
76 // |
|
77 CSuplIPCSubSession* CSuplSubsessionRegistry::SubSessionFromHandleL(TUint aHandle) |
|
78 { |
|
79 DEBUG_TRACE("SubSessionFromHandleL", __LINE__) |
|
80 return static_cast<CSuplIPCSubSession*> (iRegistryIndex->At(aHandle)); |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------- |
|
84 // CSuplSubsessionRegistry::SubSessionFromIndexL |
|
85 // |
|
86 // (other items were commented in a header). |
|
87 // --------------------------------------------------------- |
|
88 // |
|
89 CSuplIPCSubSession* CSuplSubsessionRegistry::SubSessionFromIndex(TInt aIndex) |
|
90 { |
|
91 DEBUG_TRACE("SubSessionFromIndex", __LINE__) |
|
92 return static_cast<CSuplIPCSubSession*> ((*iRegistryIndex)[aIndex]); |
|
93 } |
|
94 // --------------------------------------------------------- |
|
95 // CSuplSubsessionRegistry::Count |
|
96 // |
|
97 // (other items were commented in a header). |
|
98 // --------------------------------------------------------- |
|
99 // |
|
100 TInt CSuplSubsessionRegistry::Count() |
|
101 { |
|
102 DEBUG_TRACE("Count", __LINE__) |
|
103 return iRegistryIndex->Count(); |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------- |
|
107 // CSuplSubsessionRegistry::CloseSubSession |
|
108 // |
|
109 // (other items were commented in a header). |
|
110 // --------------------------------------------------------- |
|
111 // |
|
112 void CSuplSubsessionRegistry::CloseSubSession(TUint aHandle) |
|
113 { |
|
114 DEBUG_TRACE("CloseSubSession", __LINE__) |
|
115 if (iRegistryIndex->At(aHandle)) |
|
116 { |
|
117 // Remove on a CObjectIx does close on the CObject |
|
118 iRegistryIndex->Remove(aHandle); |
|
119 } |
|
120 } |
|
121 |
|
122 // --------------------------------------------------------- |
|
123 // CSuplSubsessionRegistry::AddInstanceL |
|
124 // (other items were commented in a header). |
|
125 // --------------------------------------------------------- |
|
126 // |
|
127 TInt CSuplSubsessionRegistry::AddInstanceL(CSuplIPCSubSession* aSubSession) |
|
128 { |
|
129 DEBUG_TRACE("AddInstanceL", __LINE__) |
|
130 iRegistryContainer->AddL(aSubSession); |
|
131 return iRegistryIndex->AddL(aSubSession); |
|
132 } |
|
133 |
|
134 // End of File |