camerauis/cameraapp/generic/inc/cameracontroller/cambuffershare.h
changeset 19 d9aefe59d544
parent 3 8b2d6d0384b0
child 21 fa6d9f75d6a6
child 28 3075d9b614e6
equal deleted inserted replaced
3:8b2d6d0384b0 19:d9aefe59d544
     1 /*
       
     2 * Copyright (c) 2007 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:  Reference counting wrapper for MCameraBuffer.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAM_BUFFERSHARE_H
       
    20 #define CAM_BUFFERSHARE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 
       
    25 class MCameraBuffer;
       
    26 
       
    27 class CCamBufferShare : public CBase
       
    28   {
       
    29   // =======================================================
       
    30   // Methods
       
    31 
       
    32   // -------------------------------------------------------
       
    33   // Constructor and destructor
       
    34   public:
       
    35 
       
    36     /**
       
    37     * This is just a wrapper class => c++ constructor
       
    38     */
       
    39     CCamBufferShare( MCameraBuffer* aSharedBuffer );
       
    40 
       
    41   private:    
       
    42 
       
    43     /**
       
    44     * Reference counting used, so destructor is private.
       
    45     */
       
    46     ~CCamBufferShare();
       
    47     
       
    48   // -------------------------------------------------------
       
    49   // Other methods
       
    50   public:
       
    51 
       
    52     /**
       
    53     * Get the shared buffer. Ownership not given to caller.
       
    54     */
       
    55     MCameraBuffer* SharedBuffer();
       
    56 
       
    57     /**
       
    58     * Reserve a reference to this share.
       
    59     */  
       
    60     void Reserve();
       
    61 
       
    62     /**
       
    63     * Release a reference to this share.
       
    64     */
       
    65     void Release();
       
    66 
       
    67 #ifdef _DEBUG
       
    68     /**
       
    69     * Get the amount of used buffers in total.
       
    70     */
       
    71     static TInt TotalBufferShareCount();
       
    72 #endif
       
    73  
       
    74   // =======================================================
       
    75   // Data 
       
    76   protected:
       
    77 
       
    78 #ifdef _DEBUG
       
    79     static TInt    isTotalBufferCount;
       
    80 #endif
       
    81 
       
    82   private:
       
    83 
       
    84     MCameraBuffer* iSharedBuffer;
       
    85     TInt           iReferenceCount;
       
    86     
       
    87   // =======================================================
       
    88   };
       
    89 
       
    90 #endif
       
    91 
       
    92 // end of file
       
    93