sl@0: /* sl@0: * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * Defines inline functions which provide constant data to both the sl@0: * client and server implementations. sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @internalComponent sl@0: @test sl@0: @file sl@0: */ sl@0: sl@0: sl@0: #ifndef SCSTESTCOMMON_INL sl@0: #define SCSTESTCOMMON_INL sl@0: sl@0: #include sl@0: sl@0: #include "scstestcommon.h" sl@0: sl@0: sl@0: namespace ScsTestImpl sl@0: { sl@0: inline TVersion Version() sl@0: /** sl@0: This function is defined because there is no literal constructor for TVersion. sl@0: sl@0: @return Defines a version number which the client sl@0: can use to open the server. If the client sl@0: was built with a higher version number, then sl@0: it cannot open the server. This ensures that sl@0: a client only talks to a server whose version sl@0: is at least as high as its own. sl@0: */ sl@0: { sl@0: TVersion v(KScsTestVerMajor, KScsTestVerMinor, KScsTestVerBuild); sl@0: return v; sl@0: } sl@0: sl@0: inline TUidType ServerImageFullUid() sl@0: /** sl@0: This function is defined because there is no literal constructor sl@0: for TUidType. It returns the server executable's UID, which is used sl@0: to ensure the client launches the correct server process, as opposed sl@0: to another application which uses the same executable name. sl@0: sl@0: @return TUidType The server executable's full UID. sl@0: */ sl@0: { sl@0: TUidType uidType(KExecutableImageUid, KNullUid, KScsTestServerUid); sl@0: return uidType; sl@0: } sl@0: } sl@0: sl@0: template sl@0: inline T TAnyPtrToFuncPtr(TAny* aPtr) sl@0: /** sl@0: ISO C++ doesn't allow converting directly between object and sl@0: function pointers, so this function goes via an integer. sl@0: sl@0: @param aPtr Object pointer to convert to a (static) function pointer. sl@0: @return Function pointer, where the exact type of the function is sl@0: described by the T template parameter. sl@0: */ sl@0: { sl@0: TUint32 funcAsInt = reinterpret_cast(aPtr); sl@0: return reinterpret_cast(funcAsInt); sl@0: } sl@0: sl@0: #endif // #ifndef SCSTESTCOMMON_INL sl@0: sl@0: