telephonyserver/etelpacketdata/cetel/pckt_hold.cpp
changeset 0 3553901f7fa8
equal deleted inserted replaced
-1:000000000000 0:3553901f7fa8
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Packet_HOLD.CPP
       
    15 // ETel Multimode Packet Data API 
       
    16 // GPRS Rel97/98, CDMAOne, CDMA2000, Rel99 and Rel4.
       
    17 // 
       
    18 //
       
    19 
       
    20 #include <etelext.h>
       
    21 
       
    22 // ETel Packet data header files
       
    23 #include "pcktptr.h"
       
    24 
       
    25 CEtelPacketPtrHolder::CEtelPacketPtrHolder()
       
    26 	{}
       
    27 
       
    28 CEtelPacketPtrHolder::~CEtelPacketPtrHolder()
       
    29 /**
       
    30  * Destructor
       
    31  */
       
    32 	{
       
    33 	iPtrArray.Close();
       
    34 	iPtrCArray.Close();
       
    35 	}
       
    36 
       
    37 void CEtelPacketPtrHolder::ConstructL(const TInt aSizeOfPtrArray,TInt aSizeOfPtrCArray)
       
    38 /**
       
    39  * ConstructL() method - Initializes the array of pointers.
       
    40  */
       
    41 	{
       
    42 	TPtr8 ptr(NULL,0);
       
    43 	TInt i;
       
    44 	for (i=0;i<aSizeOfPtrArray;i++)
       
    45 		User::LeaveIfError(iPtrArray.Append(ptr));
       
    46 
       
    47 	TPtrC8 ptrC(NULL,0);
       
    48 	for (i = 0; i < aSizeOfPtrCArray; i++)
       
    49 		{
       
    50 		User::LeaveIfError(iPtrCArray.Append(ptrC));
       
    51 		}		
       
    52 	}
       
    53 
       
    54 TPtr8& CEtelPacketPtrHolder::Ptr(const TInt aIndex)
       
    55 /**
       
    56  * This method checks that the array index is valid (i.e. within range). 
       
    57  * If the index is invalid, the client is panic'ed, otherwise the location of the array
       
    58  * element is returned.
       
    59  */
       
    60 	{
       
    61 	__ASSERT_ALWAYS(aIndex<iPtrArray.Count(),PanicClient(EEtelPanicIndexOutOfRange));
       
    62 	return iPtrArray[aIndex];
       
    63 	}
       
    64 	
       
    65 TPtrC8& CEtelPacketPtrHolder::PtrC(TInt aIndex)
       
    66 /**
       
    67  * This method returns a reference to the TPtrC8 at aIndex within the array
       
    68  *
       
    69  * @param aIndex The array location of the desired TPtrC8
       
    70  * @return TPtrC8&
       
    71  */
       
    72 	{
       
    73 	__ASSERT_ALWAYS(aIndex<iPtrCArray.Count(),PanicClient(EEtelPanicIndexOutOfRange));
       
    74 	return iPtrCArray[aIndex];
       
    75 	}
       
    76 
       
    77 CPacketPtrHolder* CPacketPtrHolder::NewL(const TInt aSizeOfPtrArray, TInt aSizeOfPtrCArray)
       
    78 /**
       
    79  * Two phase constructor.
       
    80  *
       
    81  * @param aSizeOfPtrArray Size of the array containing the pointers.
       
    82  */
       
    83 	{
       
    84 	CPacketPtrHolder* p = new (ELeave) CPacketPtrHolder();
       
    85 	CleanupStack::PushL(p);
       
    86 	p->ConstructL(aSizeOfPtrArray,aSizeOfPtrCArray);
       
    87 	CleanupStack::Pop();
       
    88 	return p;
       
    89 	}
       
    90 
       
    91 CPacketPtrHolder::CPacketPtrHolder()
       
    92 	:CEtelPacketPtrHolder(),
       
    93 	iStoreMbmsPtr(NULL,0,0)
       
    94 	{}
       
    95 
       
    96 CPacketPtrHolder::~CPacketPtrHolder()
       
    97 	{
       
    98 	delete iStoreMbmsBuf;
       
    99 	}
       
   100 
       
   101 CPacketContextPtrHolder* CPacketContextPtrHolder::NewL(const TInt aSizeOfPtrArray,TInt aSizeOfPtrCArray)
       
   102 /**
       
   103  * Two phase constructor.
       
   104  *
       
   105  * @param aSizeOfPtrArray Size of the array containing the pointers.
       
   106  */
       
   107 	{
       
   108 	CPacketContextPtrHolder* p = new (ELeave) CPacketContextPtrHolder();
       
   109 	CleanupStack::PushL(p);
       
   110 	p->ConstructL(aSizeOfPtrArray,aSizeOfPtrCArray);
       
   111 	CleanupStack::Pop();
       
   112 	return p;
       
   113 	}
       
   114 
       
   115 CPacketContextPtrHolder::CPacketContextPtrHolder()
       
   116 	:CEtelPacketPtrHolder(),
       
   117 	iStoreNetworkPtr(NULL,0,0)
       
   118 	{}
       
   119 
       
   120 CPacketContextPtrHolder::~CPacketContextPtrHolder()
       
   121 	{
       
   122 	delete iStoreNetworkBuf;
       
   123 	}
       
   124 
       
   125 CPacketQoSPtrHolder* CPacketQoSPtrHolder::NewL(const TInt aSizeOfPtrArray, TInt aSizeOfPtrCArray)
       
   126 /**
       
   127  * Two phase constructor.
       
   128  *
       
   129  * @param aSizeOfPtrArray Size of the array containing the pointers.
       
   130  */
       
   131 	{
       
   132 	CPacketQoSPtrHolder* p = new (ELeave) CPacketQoSPtrHolder();
       
   133 	CleanupStack::PushL(p);
       
   134 	p->ConstructL(aSizeOfPtrArray,aSizeOfPtrCArray);
       
   135 	CleanupStack::Pop();
       
   136 	return p;
       
   137 	}
       
   138 
       
   139 CPacketQoSPtrHolder::CPacketQoSPtrHolder()
       
   140 	:CEtelPacketPtrHolder()
       
   141 	{}
       
   142 
       
   143 CPacketQoSPtrHolder::~CPacketQoSPtrHolder()
       
   144 	{}
       
   145 
       
   146