os/ossrv/lowlevellibsandfws/pluginfw/Framework/LoadManagerTest/LoadManagerStateAccessor.inl
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // The state accessor class implementations for the CLoadManager class
    15 // 
    16 //
    17 
    18 // ______________________________________________________________________________
    19 //
    20 _LIT(KTLoadManager_DumpName,"C:\\System\\Data\\Logs\\TLoadManager_StateDump.bin");
    21 
    22 inline TInt TLoadManager_StateAccessor::InvariantTest(TAny* aTestObject)
    23 	{
    24 	if(aTestObject)
    25 		{
    26 		// Nothing to do
    27 		// CLoadManager* LoadManager = REINTERPRET_CAST(CLoadManager*, aTestObject);
    28 		}
    29 	return KErrNone;
    30 	}
    31 
    32 inline TInt TLoadManager_StateAccessor::Internalize(TAny* aTestObject)
    33 	{
    34 	TInt error = KErrNone;
    35 	if(aTestObject)
    36 		{
    37 		CLoadManager* LoadManager = REINTERPRET_CAST(CLoadManager*, aTestObject);
    38 		TRAP(error,InternalizeL(LoadManager));
    39 		}
    40 	return error;
    41 	}
    42 
    43 inline TInt TLoadManager_StateAccessor::Externalize(TAny* aTestObject)
    44 	{
    45 	TInt error = KErrNone;
    46 	if(aTestObject)
    47 		{
    48 		CLoadManager* LoadManager = REINTERPRET_CAST(CLoadManager*, aTestObject);
    49 		TRAP(error,ExternalizeL(LoadManager));
    50 		}
    51 	return error;
    52 	}
    53 
    54 inline void TLoadManager_StateAccessor::InternalizeL(RFileReadStream& /* aStream */, CLoadManager* /* aLoadManager */)
    55 	{
    56 	// Nothing to do
    57 	}
    58 
    59 inline void TLoadManager_StateAccessor::ExternalizeL(RFileWriteStream& /* aStream */, CLoadManager* /* aLoadManager */)
    60 	{
    61 	// Nothing to do
    62 	}
    63 
    64 // internal helpers
    65 inline void TLoadManager_StateAccessor::InternalizeL(CLoadManager* aLoadManager)
    66 	{
    67 	// Read in the dumped data
    68 	RFs fs;
    69 	User::LeaveIfError(fs.Connect());
    70 	CleanupClosePushL(fs);
    71 	// Read the object dump
    72 	TParse filename;
    73 	filename.Set(KTLoadManager_DumpName(),NULL,NULL);
    74 	RFileReadStream stream;
    75 	User::LeaveIfError(stream.Open(fs,filename.FullName(), EFileRead));
    76 	CleanupClosePushL(stream);
    77 	InternalizeL(stream, aLoadManager);
    78 	CleanupStack::PopAndDestroy();	// stream
    79 	CleanupStack::PopAndDestroy();	// fs
    80 	}
    81 
    82 inline void TLoadManager_StateAccessor::ExternalizeL(CLoadManager* aLoadManager)
    83 	{
    84 	RFs fs;
    85 	User::LeaveIfError(fs.Connect());
    86 	CleanupClosePushL(fs);
    87 	// Write out the object dump
    88 	TParse filename;
    89 	filename.Set(KTLoadManager_DumpName(),NULL,NULL);
    90 	RFileWriteStream stream;
    91 	User::LeaveIfError(stream.Replace(fs,filename.FullName(), EFileWrite));
    92 	CleanupClosePushL(stream);
    93 	ExternalizeL(stream, aLoadManager);
    94 	CleanupStack::PopAndDestroy();	// stream
    95 	CleanupStack::PopAndDestroy();	// fs
    96 	}