memspy/Engine/Source/ThreadAndProcess/MemSpyEngineObject.cpp
changeset 0 a03f92240627
equal deleted inserted replaced
-1:000000000000 0:a03f92240627
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <memspy/engine/memspyengineobject.h>
       
    20 
       
    21 
       
    22 EXPORT_C CMemSpyEngineObject::CMemSpyEngineObject()
       
    23     {
       
    24     Open();
       
    25     }
       
    26 
       
    27 
       
    28 EXPORT_C CMemSpyEngineObject::CMemSpyEngineObject( CMemSpyEngineObject& aParent )
       
    29 :   iParent( &aParent )
       
    30     {
       
    31     Open();
       
    32     }
       
    33 
       
    34 
       
    35 CMemSpyEngineObject::~CMemSpyEngineObject()
       
    36     {
       
    37     }
       
    38 
       
    39 
       
    40 EXPORT_C TInt CMemSpyEngineObject::AccessCount() const
       
    41     {
       
    42     __ASSERT_ALWAYS( iAccessCount >= 0, User::Invariant() );
       
    43     return iAccessCount;
       
    44     }
       
    45 
       
    46 
       
    47 EXPORT_C void CMemSpyEngineObject::Close()
       
    48     {
       
    49     __ASSERT_ALWAYS( iAccessCount >= 0, User::Invariant() );
       
    50     if  ( --iAccessCount <= 0 )
       
    51         {
       
    52         delete this;
       
    53         }
       
    54     }
       
    55 
       
    56 
       
    57 EXPORT_C void CMemSpyEngineObject::Open()
       
    58     {
       
    59     __ASSERT_ALWAYS( iAccessCount >= 0, User::Invariant() );
       
    60     ++iAccessCount;
       
    61     }
       
    62 
       
    63 
       
    64 EXPORT_C CMemSpyEngineObject* CMemSpyEngineObject::Parent() const
       
    65     {
       
    66     return iParent;
       
    67     }
       
    68 
       
    69 
       
    70 EXPORT_C void CMemSpyEngineObject::SetParent( CMemSpyEngineObject* aParent )
       
    71     {
       
    72     iParent = aParent;
       
    73     }