baseapitest/basesvs/performance/f32/t_perf/src/F32PerformanceServer.cpp
author John Imhofe
Mon, 19 Oct 2009 15:55:17 +0100
changeset 0 a41df078684a
child 15 4122176ea935
permissions -rw-r--r--
Convert Kernelhwsrv package from SFL to EPL kernel\eka\compsupp is subject to the ARM EABI LICENSE userlibandfileserver\fatfilenameconversionplugins\unicodeTables is subject to the Unicode license kernel\eka\kernel\zlib is subject to the zlib license

/*
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "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:
*
*/

#include "F32PerformanceServer.h"
#include "EntryStep.h"
#include "ReadFileStep.h"
#include "SeekFileStep.h"
#include "WriteFileStep.h"
#include "UtilsCleanupStep.h"
#include "UtilsSetupStep.h"



// Function : CT_F32PerformanceServer
// Description :CT_F32PerformanceServer class constructor			 
// @return :CT_F32PerformanceServer		
CT_F32PerformanceServer::CT_F32PerformanceServer()
:CTestServer ()
	{
	
	}


// Function : NewL
// @return	:An instance of test server 
// Description: Same code for Secure and non-secure variants
// Called inside the MainL() function to create and start the
// CTestServer derived server.

CT_F32PerformanceServer* 	CT_F32PerformanceServer::NewL()
	{
	CT_F32PerformanceServer* performServer=new(ELeave) 	CT_F32PerformanceServer();
	CleanupStack::PushL(performServer);
	performServer->ConstructL(KT_PerformServ);
	CleanupStack::Pop(performServer);
	return performServer;
	}

// Function : ~CT_F32PerformanceServer
// Description :CT_F32PerformanceServer class destructor	
CT_F32PerformanceServer::~CT_F32PerformanceServer()
	{
	
	}


// Function : MainL
// Description:	Secure variant
// 				Much simpler, uses the new Rendezvous() 
//				call to sync with the client	
LOCAL_C void MainL()
	{
	// Leave the hooks in for platform security
	#if (defined __DATA_CAGING__)
		RProcess().DataCaging(RProcess::EDataCagingOn);
		RProcess().SecureApi(RProcess::ESecureApiOn);
	#endif

	CActiveScheduler*		performScheduler=NULL;
	performScheduler=new(ELeave) CActiveScheduler;
	//Install me as current ActiveScheduler
	CActiveScheduler::Install(performScheduler);
	CT_F32PerformanceServer*	server = NULL;
	
	// Create CT_ F32PerformanceServer(the CTestServer derived server)
	TRAPD(err,server = CT_F32PerformanceServer::NewL());
	if(!err)
		{
		// Sync with the client and enter this active scheduler
		RProcess::Rendezvous(KErrNone);
		performScheduler->Start();
		}
		
	delete server;
	delete 	performScheduler;
	
	}
//End MainL
	

// Function : E32Main
// @return  Standard Epoc error code on exit
GLDEF_C TInt E32Main()
	{
	CTrapCleanup* cleanup = CTrapCleanup::New();
	if(cleanup == NULL)
		{
		return KErrNoMemory;
		}
		
	#if (defined TRAP_IGNORE)
		TRAP_IGNORE(MainL());
	#else
		TRAPD(err,MainL());
	#endif
	
	delete cleanup;
	return KErrNone;
	
    }
	

// @return - A CTestStep derived instance
// Description : Implementation of CTestServer pure virtual
//  (i.e Creates the test steps) 
//  @param :	aStepName	The name of the test step to be created
CTestStep* CT_F32PerformanceServer::CreateTestStep(const TDesC& aStepName)
	{
	CTestStep*	testStep = NULL;
	if (aStepName == KT_EntryStep)
		{
		testStep = new CT_EntryStep();
		}
	else if (aStepName ==KT_ReadFileStep)
		{
		testStep = new CT_ReadFileStep ();
		}	
	else if (aStepName==KT_SeekFileStep)
		{
		testStep= new  CT_SeekFileStep ();
		}			
	else if (aStepName==KT_WriteFileStep)
		{
		testStep= new CT_WriteFileStep ();
		}
	else if(aStepName==KT_CleanupStep)
		{
		testStep=new CT_CleanupStep();
		}
	else if (aStepName==KT_SetupStep)
		{
		testStep=new CT_SetupStep();
		}	
	return testStep;	
	}