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