qtms/src/qtmsbufferimpl.cpp
author hgs
Fri, 25 Jun 2010 17:07:52 -0500
changeset 40 4a1905d205a2
child 47 f3d2589f22d6
child 50 762d760dcfdf
permissions -rw-r--r--
201025
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40
hgs
parents:
diff changeset
     1
/*
hgs
parents:
diff changeset
     2
 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     3
 * All rights reserved.
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     8
 *
hgs
parents:
diff changeset
     9
 * Initial Contributors:
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    11
 *
hgs
parents:
diff changeset
    12
 * Contributors:
hgs
parents:
diff changeset
    13
 *
hgs
parents:
diff changeset
    14
 * Description: Telephony Multimedia Service
hgs
parents:
diff changeset
    15
 *
hgs
parents:
diff changeset
    16
 */
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
#include <qtms.h>
hgs
parents:
diff changeset
    19
#include "tmsutility.h"
hgs
parents:
diff changeset
    20
#include "qtmsmembuffer.h"
hgs
parents:
diff changeset
    21
#include "qtmsbufferimpl.h"
hgs
parents:
diff changeset
    22
hgs
parents:
diff changeset
    23
using namespace QTMS;
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
gint QTMSBufferImpl::Create(QTMSBufferType buffertype, QTMSBuffer*& buffer,
hgs
parents:
diff changeset
    26
        TMS::TMSBuffer*& tmsbuffer)
hgs
parents:
diff changeset
    27
    {
hgs
parents:
diff changeset
    28
    gint ret(QTMS_RESULT_INSUFFICIENT_MEMORY);
hgs
parents:
diff changeset
    29
    TRACE_PRN_FN_ENT;
hgs
parents:
diff changeset
    30
    switch (buffertype)
hgs
parents:
diff changeset
    31
        {
hgs
parents:
diff changeset
    32
        case QTMS_BUFFER_MEMORY:
hgs
parents:
diff changeset
    33
            ret = QTMSMemBuffer::Create(buffer, tmsbuffer);
hgs
parents:
diff changeset
    34
            break;
hgs
parents:
diff changeset
    35
        default:
hgs
parents:
diff changeset
    36
            ret = QTMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED;
hgs
parents:
diff changeset
    37
            break;
hgs
parents:
diff changeset
    38
        }
hgs
parents:
diff changeset
    39
hgs
parents:
diff changeset
    40
    TRACE_PRN_FN_EXT;
hgs
parents:
diff changeset
    41
    return ret;
hgs
parents:
diff changeset
    42
    }
hgs
parents:
diff changeset
    43
hgs
parents:
diff changeset
    44
gint QTMSBufferImpl::Delete(QTMSBuffer*& buffer)
hgs
parents:
diff changeset
    45
    {
hgs
parents:
diff changeset
    46
    gint ret(QTMS_RESULT_INVALID_ARGUMENT);
hgs
parents:
diff changeset
    47
    TRACE_PRN_FN_ENT;
hgs
parents:
diff changeset
    48
    QTMSBufferType buffertype;
hgs
parents:
diff changeset
    49
    ret = buffer->GetType(buffertype);
hgs
parents:
diff changeset
    50
    switch (buffertype)
hgs
parents:
diff changeset
    51
        {
hgs
parents:
diff changeset
    52
        case QTMS_BUFFER_MEMORY:
hgs
parents:
diff changeset
    53
            delete (static_cast<QTMSMemBuffer*> (buffer));
hgs
parents:
diff changeset
    54
            buffer = NULL;
hgs
parents:
diff changeset
    55
            ret = QTMS_RESULT_SUCCESS;
hgs
parents:
diff changeset
    56
            break;
hgs
parents:
diff changeset
    57
        default:
hgs
parents:
diff changeset
    58
            ret = QTMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED;
hgs
parents:
diff changeset
    59
            break;
hgs
parents:
diff changeset
    60
        }
hgs
parents:
diff changeset
    61
hgs
parents:
diff changeset
    62
    TRACE_PRN_FN_EXT;
hgs
parents:
diff changeset
    63
    return ret;
hgs
parents:
diff changeset
    64
    }
hgs
parents:
diff changeset
    65
hgs
parents:
diff changeset
    66
// End of file