sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* Defines inline functions which provide constant data to both the
|
sl@0
|
16 |
* client and server implementations.
|
sl@0
|
17 |
*
|
sl@0
|
18 |
*/
|
sl@0
|
19 |
|
sl@0
|
20 |
|
sl@0
|
21 |
/**
|
sl@0
|
22 |
@internalComponent
|
sl@0
|
23 |
@test
|
sl@0
|
24 |
@file
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
#ifndef SCSTESTCOMMON_INL
|
sl@0
|
29 |
#define SCSTESTCOMMON_INL
|
sl@0
|
30 |
|
sl@0
|
31 |
#include <e32uid.h>
|
sl@0
|
32 |
|
sl@0
|
33 |
#include "scstestcommon.h"
|
sl@0
|
34 |
|
sl@0
|
35 |
|
sl@0
|
36 |
namespace ScsTestImpl
|
sl@0
|
37 |
{
|
sl@0
|
38 |
inline TVersion Version()
|
sl@0
|
39 |
/**
|
sl@0
|
40 |
This function is defined because there is no literal constructor for TVersion.
|
sl@0
|
41 |
|
sl@0
|
42 |
@return Defines a version number which the client
|
sl@0
|
43 |
can use to open the server. If the client
|
sl@0
|
44 |
was built with a higher version number, then
|
sl@0
|
45 |
it cannot open the server. This ensures that
|
sl@0
|
46 |
a client only talks to a server whose version
|
sl@0
|
47 |
is at least as high as its own.
|
sl@0
|
48 |
*/
|
sl@0
|
49 |
{
|
sl@0
|
50 |
TVersion v(KScsTestVerMajor, KScsTestVerMinor, KScsTestVerBuild);
|
sl@0
|
51 |
return v;
|
sl@0
|
52 |
}
|
sl@0
|
53 |
|
sl@0
|
54 |
inline TUidType ServerImageFullUid()
|
sl@0
|
55 |
/**
|
sl@0
|
56 |
This function is defined because there is no literal constructor
|
sl@0
|
57 |
for TUidType. It returns the server executable's UID, which is used
|
sl@0
|
58 |
to ensure the client launches the correct server process, as opposed
|
sl@0
|
59 |
to another application which uses the same executable name.
|
sl@0
|
60 |
|
sl@0
|
61 |
@return TUidType The server executable's full UID.
|
sl@0
|
62 |
*/
|
sl@0
|
63 |
{
|
sl@0
|
64 |
TUidType uidType(KExecutableImageUid, KNullUid, KScsTestServerUid);
|
sl@0
|
65 |
return uidType;
|
sl@0
|
66 |
}
|
sl@0
|
67 |
}
|
sl@0
|
68 |
|
sl@0
|
69 |
template <class T>
|
sl@0
|
70 |
inline T TAnyPtrToFuncPtr(TAny* aPtr)
|
sl@0
|
71 |
/**
|
sl@0
|
72 |
ISO C++ doesn't allow converting directly between object and
|
sl@0
|
73 |
function pointers, so this function goes via an integer.
|
sl@0
|
74 |
|
sl@0
|
75 |
@param aPtr Object pointer to convert to a (static) function pointer.
|
sl@0
|
76 |
@return Function pointer, where the exact type of the function is
|
sl@0
|
77 |
described by the T template parameter.
|
sl@0
|
78 |
*/
|
sl@0
|
79 |
{
|
sl@0
|
80 |
TUint32 funcAsInt = reinterpret_cast<TUint32>(aPtr);
|
sl@0
|
81 |
return reinterpret_cast<T>(funcAsInt);
|
sl@0
|
82 |
}
|
sl@0
|
83 |
|
sl@0
|
84 |
#endif // #ifndef SCSTESTCOMMON_INL
|
sl@0
|
85 |
|
sl@0
|
86 |
|