locationsystemui/locationsysui/posindicator/posindicatorhelperserver/src/posindicatorsubsessionregistry.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/locationsystemui/locationsysui/posindicator/posindicatorhelperserver/src/posindicatorsubsessionregistry.cpp Tue Aug 31 15:37:04 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of subsession registry class.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "posindicatorsubsessionregistry.h"
+#include "posindicatorserversubsession.h"
+#include "posindicatorlogger.h"
+#include <e32base.h>
+
+// ---------------------------------------------------------------------------
+// CPosIndicatorSubSessionRegistry::NewL
+// ---------------------------------------------------------------------------
+CPosIndicatorSubSessionRegistry* CPosIndicatorSubSessionRegistry::NewL()
+ {
+ FUNC("CPosIndicatorSubSessionRegistry::NewL");
+ CPosIndicatorSubSessionRegistry* self = new ( ELeave ) CPosIndicatorSubSessionRegistry;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CPosIndicatorSubSessionRegistry::CPosIndicatorSubSessionRegistry
+// ---------------------------------------------------------------------------
+CPosIndicatorSubSessionRegistry::CPosIndicatorSubSessionRegistry()
+ {
+ FUNC("CPosIndicatorSubSessionRegistry::CPosIndicatorSubSessionRegistry");
+ }
+
+// ---------------------------------------------------------------------------
+// CPosIndicatorSubSessionRegistry::~CPosIndicatorSubSessionRegistry
+// ---------------------------------------------------------------------------
+CPosIndicatorSubSessionRegistry::~CPosIndicatorSubSessionRegistry()
+ {
+ FUNC("CPosIndicatorSubSessionRegistry::~CPosIndicatorSubSessionRegistry");
+ delete iRegistryIndex;
+ delete iRegistryContainerIndex;
+ }
+
+
+// ---------------------------------------------------------------------------
+// CPosIndicatorSubSessionRegistry::ConstructL
+// ---------------------------------------------------------------------------
+void CPosIndicatorSubSessionRegistry::ConstructL()
+ {
+ FUNC("CPosIndicatorSubSessionRegistry::ConstructL");
+ iRegistryIndex = CObjectIx::NewL();
+ iRegistryContainerIndex = CObjectConIx::NewL();
+ iRegistryContainer = iRegistryContainerIndex->CreateL();
+ }
+
+// ---------------------------------------------------------------------------
+// CPosIndicatorSubSessionRegistry::AddSubSessionL
+// ---------------------------------------------------------------------------
+TInt CPosIndicatorSubSessionRegistry::AddSubSessionL(
+ CPosIndicatorServerSubsession* aSubSession)
+ {
+ FUNC("CPosIndicatorSubSessionRegistry::AddSubSessionL");
+ iRegistryContainer->AddL( aSubSession );
+ return iRegistryIndex->AddL( aSubSession );
+ }
+
+// ---------------------------------------------------------------------------
+// CPosIndicatorSubSessionRegistry::CloseSubSession
+// ---------------------------------------------------------------------------
+TInt CPosIndicatorSubSessionRegistry::CloseSubSession( TUint aHandle )
+ {
+ FUNC("CPosIndicatorSubSessionRegistry::CloseSubSession");
+ if ( iRegistryIndex->At( aHandle ) )
+ {
+ // Removes the sub-session object and closes
+ // the handle i,e. destroys the object
+ iRegistryIndex->Remove( aHandle );
+ return KErrNone;
+ }
+ return KErrBadHandle;
+ }
+
+// ---------------------------------------------------------------------------
+// CPosIndicatorSubSessionRegistry::SubSessionFromHandle
+// ---------------------------------------------------------------------------
+CPosIndicatorServerSubsession* CPosIndicatorSubSessionRegistry::
+ SubSessionFromHandle( TUint aHandle )
+ {
+ FUNC("CPosIndicatorSubSessionRegistry::SubSessionFromHandle");
+ return static_cast<CPosIndicatorServerSubsession*> (iRegistryIndex->At(aHandle));
+ }
+
+// end of file