homescreensrv_plat/servicemodel_api/servicebase.h
changeset 60 f62f87b200ec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/servicemodel_api/servicebase.h	Fri Mar 19 09:35:23 2010 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2009 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:  HsService base 
+*
+*/
+
+
+#ifndef SERVICEBASE_H
+#define SERVICEBASE_H
+
+struct HsServiceInterfaceId;
+
+/** @ingroup group_hsservicemodel group_service_api_candidates
+ *  The base class for service interfaces
+ *
+ *  @lib 
+ *  @since S60 ?S60_version
+ */
+class IHsServiceBase
+    {
+    
+public:
+    /**
+     * Default virtual destructor.
+     */
+    virtual ~IHsServiceBase() {}
+
+    /**
+     * Interface getter with casting.
+     *
+     * @since S60 ?S60_version
+     * @param aBase HsService base object.
+     * @return The queried interface, or NULL if the interface is not
+     *         supported or available.
+     */
+    template <class T>
+    static T* MakeInterface(IHsServiceBase* aBase)
+        {
+        return (aBase? static_cast<T*>(aBase->resolveService(T::type())): 0);    
+        }
+        
+    
+    /**
+     * Interface getter.
+     * Derived classes should always call the base class method
+     * from the overridden MakeInterface.
+     *
+     * @since S60 ?S60_version
+     * @param aType The type id of the queried interface.
+     * @return The queried interface, or NULL if the interface is not
+     *         supported or available.
+     */
+    virtual IHsServiceBase* resolveService( const HsServiceInterfaceId &aType ) = 0;
+    
+    
+    };
+
+#endif