diff -r 000000000000 -r e686773b3f54 logsui/EngineInc/CLogsEventArray.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/logsui/EngineInc/CLogsEventArray.h Tue Feb 02 10:12:17 2010 +0200 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "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: +* Implementation of MLogsEventArray +* +*/ + + +#ifndef __CLogsEventArray_H_ +#define __CLogsEventArray_H_ + +// INCLUDES +#include +#include "MLogsEventArray.h" +#include "MLogsModel.h" + +// MACROS + +// DATA TYPES + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class MLogsEvent; +// CLASS DECLARATION + + /** + * Concrete MlogsEventArray of TEventType. + * + * @param TEventType concrete event type. Must be derived from MLogsEvent. + */ +template +class CLogsEventArray : public CBase, public MLogsEventArray + { + public: // Constructors and destructor + + /** + * EPOC constructor. + * + * @param aGranularity Initial granularity of the event array + * @return model object + */ + static CLogsEventArray* NewL( TInt aGranularity ); + + /** + * Destructor + */ + ~CLogsEventArray(); + + private: + /** + * C++ constructor. + * + * @param aGranularity Initial granularity of the event array + */ + CLogsEventArray( TInt aGranularity ); + + public: // New functions + /** + * Append a new event of TEventType to event array + * + * @param aEvent event to be added to this array. + */ + ///// void AppendL(const TEventType& aEvent); //FIXME: remove this + + public: // from MLogsEventArray + TInt Count() const ; + + const MLogsEvent& At(TInt aIndex) const; + + MLogsEvent& At(TInt aIndex); + + /** + * @param aEvent event to add to this array. The concrete event type + * must always be same as TEventType. + */ + void AppendL( const MLogsEvent& aEvent ); + + void Delete( TInt aIndex ); + + void Reset(); + + void Compress(); + + private: // Data + + /// Own: Event array + //CArrayFixSeg iArray; + CArrayPtrSeg iArray; //Fix for EKKJ-6EGAKC. Changed to CArrayPtrSeg + }; + +template +CLogsEventArray::CLogsEventArray( TInt aGranularity ) : + iArray( aGranularity ) + { + } + +template +CLogsEventArray* CLogsEventArray::NewL( TInt aGranularity ) + { + CLogsEventArray* self = + new (ELeave) CLogsEventArray( aGranularity ); + return self; + } + +template +CLogsEventArray::~CLogsEventArray() + { + Reset(); + } + +///// FIXME: remove this +///// template +///// void CLogsEventArray::AppendL(const TEventType& aEvent) +///// { +///// iArray.AppendL( aEvent ); +///// } + +template +void CLogsEventArray::AppendL( const MLogsEvent& aEvent ) + { + iArray.AppendL( &aEvent ); + } + +template +TInt CLogsEventArray::Count() const + { + return iArray.Count(); + } + +template +const MLogsEvent& CLogsEventArray::At(TInt aIndex) const + { + return *(iArray.At( aIndex )); + } + +template +MLogsEvent& CLogsEventArray::At(TInt aIndex) + { + return CONST_CAST(MLogsEvent&, (*(iArray.At( aIndex )))); + } + +template +void CLogsEventArray::Delete( TInt aIndex ) + { + const MLogsEvent* event = iArray[aIndex]; + delete event; //delete the owned object + iArray.Delete( aIndex ); //delete array entry (containing pointer) + } + +template +void CLogsEventArray::Reset() + { +/***** + for( int i=0; i +void CLogsEventArray::Compress() + { + iArray.Compress(); + } + +#endif + +// End of File __CLogsEventArray_H_