os/persistentdata/loggingservices/eventlogger/LogCli/src/logpackage.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2002-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 // LogPackage.h
    15 // 
    16 //
    17 
    18 #include "logpackage.h"
    19 
    20 // Constants
    21 const TInt KLogPackageGranuality = 0x200;
    22 
    23 
    24 CLogPackage::CLogPackage()
    25 : iPtr(NULL, 0)
    26 	{
    27 	}
    28 
    29 EXPORT_C CLogPackage::~CLogPackage()
    30 	{
    31 	delete iBuffer;
    32 	}
    33 
    34 void CLogPackage::ConstructL()
    35 	{
    36 	iBuffer = CBufFlat::NewL(KLogPackageGranuality);
    37 	}
    38 
    39 EXPORT_C CLogPackage* CLogPackage::NewL()
    40 	{
    41 	CLogPackage* self = new(ELeave)CLogPackage;
    42 	CleanupStack::PushL(self);
    43 	self->ConstructL();
    44 	CleanupStack::Pop(self);
    45 	return self;
    46 	}
    47 
    48 EXPORT_C void CLogPackage::SetLogEventL(const CLogEvent& aEvent)
    49 	{
    50 	RBufWriteStream stream(*iBuffer);
    51 	stream << aEvent;
    52 	stream.CommitL();
    53 	}
    54 
    55 EXPORT_C void CLogPackage::GetLogEventL(CLogEvent& aEvent) const
    56 	{
    57 	RBufReadStream stream(*iBuffer);
    58 	stream >> aEvent;
    59 	}
    60 
    61 EXPORT_C void CLogPackage::SetLogEventTypeL(const CLogEventType& aType)
    62 	{
    63 	RBufWriteStream stream(*iBuffer);
    64 	stream << aType;
    65 	stream.CommitL();
    66 	}
    67 
    68 EXPORT_C void CLogPackage::GetLogEventTypeL(CLogEventType& aType) const
    69 	{
    70 	RBufReadStream stream(*iBuffer);
    71 	stream >> aType;
    72 	}
    73 
    74 EXPORT_C void CLogPackage::SetLogConfigL(const TLogConfig& aConfig)
    75 	{
    76 	RBufWriteStream stream(*iBuffer);
    77 	stream << aConfig;
    78 	stream.CommitL();
    79 	}
    80 
    81 EXPORT_C void CLogPackage::GetLogConfigL(TLogConfig& aConfig) const
    82 	{
    83 	RBufReadStream stream(*iBuffer);
    84 	stream >> aConfig;
    85 	}
    86 
    87 EXPORT_C void CLogPackage::SetLogFilterListL(const CLogFilterList& aFilterList)
    88 	{
    89 	RBufWriteStream stream(*iBuffer);
    90 	aFilterList.ExternalizeL(stream);
    91 	stream.CommitL();
    92 	}
    93 
    94 EXPORT_C void CLogPackage::GetLogFilterListL(CLogFilterList& aFilterList) const
    95 	{
    96 	RBufReadStream stream(*iBuffer);
    97 	aFilterList.InternalizeL(stream);
    98 	}