qtms/src/qtmsbufferimpl.cpp
changeset 44 d141fc1ad77b
child 47 f3d2589f22d6
child 50 762d760dcfdf
equal deleted inserted replaced
43:7b58e65d61ee 44:d141fc1ad77b
       
     1 /*
       
     2  * Copyright (c) 2010 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: Telephony Multimedia Service
       
    15  *
       
    16  */
       
    17 
       
    18 #include <qtms.h>
       
    19 #include "tmsutility.h"
       
    20 #include "qtmsmembuffer.h"
       
    21 #include "qtmsbufferimpl.h"
       
    22 
       
    23 using namespace QTMS;
       
    24 
       
    25 gint QTMSBufferImpl::Create(QTMSBufferType buffertype, QTMSBuffer*& buffer,
       
    26         TMS::TMSBuffer*& tmsbuffer)
       
    27     {
       
    28     gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
       
    29     TRACE_PRN_FN_ENT;
       
    30     switch (buffertype)
       
    31         {
       
    32         case QTMS_BUFFER_MEMORY:
       
    33             ret = QTMSMemBuffer::Create(buffer, tmsbuffer);
       
    34             break;
       
    35         default:
       
    36             ret = QTMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED;
       
    37             break;
       
    38         }
       
    39 
       
    40     TRACE_PRN_FN_EXT;
       
    41     return ret;
       
    42     }
       
    43 
       
    44 gint QTMSBufferImpl::Delete(QTMSBuffer*& buffer)
       
    45     {
       
    46     gint ret(QTMS_RESULT_INVALID_ARGUMENT);
       
    47     TRACE_PRN_FN_ENT;
       
    48     QTMSBufferType buffertype;
       
    49     ret = buffer->GetType(buffertype);
       
    50     switch (buffertype)
       
    51         {
       
    52         case QTMS_BUFFER_MEMORY:
       
    53             delete (static_cast<QTMSMemBuffer*> (buffer));
       
    54             buffer = NULL;
       
    55             ret = QTMS_RESULT_SUCCESS;
       
    56             break;
       
    57         default:
       
    58             ret = QTMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED;
       
    59             break;
       
    60         }
       
    61 
       
    62     TRACE_PRN_FN_EXT;
       
    63     return ret;
       
    64     }
       
    65 
       
    66 // End of file