searchui/inc/Search_global.h
author Pat Downey <patd@symbian.org>
Wed, 23 Jun 2010 17:22:18 +0100
changeset 8 2f67eb14d003
parent 0 ccd0fd43f247
child 11 773be20e0a25
permissions -rw-r--r--
Merge heads.

/*
* Copyright (c) 2009 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:  The dll header file.
*
*/


#ifndef SEARCH_GLOBAL_H
#define SEARCH_GLOBAL_H

#include <qdebug.h>

#ifdef NFT
#ifdef Q_OS_SYMBIAN
#include <e32hal.h>
#endif
#endif

#ifndef SEARCH_UNITTESTING
    #define SEARCH_CLASS(aClassName)
#else
    #define SEARCH_CLASS(aClassName) class aClassName;
#endif 

#ifndef SEARCH_UNITTESTING
    #define SEARCH_FRIEND_CLASS(aClassName)
#else
    #define SEARCH_FRIEND_CLASS(aClassName) friend class aClassName;
#endif 

#define SEARCHCATCHDEBUG qDebug("Catched in: %s on line: %d",__FILE__,__LINE__);
#define SEARCHDEBUG(a) qDebug("%s in: %s on line: %d", (a),  __FILE__,__LINE__);

#ifdef NFT
    #define SEARCHTEST(aText)                  qDebug() << QString(aText)
#ifdef Q_OS_SYMBIAN
    inline void SEARCHFreeRam(const QString &aFunction)
    {
    TMemoryInfoV1Buf meminfo;
    UserHal::MemoryInfo(meminfo);
    int memSize = meminfo().iTotalRamInBytes >> 10;
    int memFree = meminfo().iFreeRamInBytes >> 10;

    RHeap& ownHeap = User::Heap();
    TInt biggestBlock = 0;
    int heapFree = ownHeap.Available(biggestBlock) >> 10;
    int heapSize = ownHeap.Size() >> 10;
    qDebug()<< aFunction << "memFree" << memFree << "kb memSize" << memSize << "kb heapFree" << heapFree << "kb heapSize" << heapSize;
    }
    
    #define SEARCH_FUNC_ENTRY(aFunction)   SEARCHFreeRam(QString(aFunction)+" entry")
    #define SEARCH_FUNC_EXIT(aFunction)    SEARCHFreeRam(QString(aFunction)+" exit")
#else
    #define SEARCH_FUNC_ENTRY(aFunction)   qDebug()<< aFunction << " entry";
    #define SEARCH_FUNC_EXIT(aFunction)    qDebug()<< aFunction << " exit";
#endif
    
#else
    #define SEARCHTEST(aText)
    #define SEARCH_FUNC_ENTRY(aFunction)
    #define SEARCH_FUNC_EXIT(aFunction)
#endif

#endif // SEARCH_GLOBAL_H