applayerprotocols/httptransportfw/Test/T_HttpIntegration/CPile.h
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     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 // $Header$
       
    15 // mjd, mark@mjdss.com, july 2002
       
    16 // During implementation found a 'known' bug in the MSVC++ v6.0 compiler.
       
    17 // The C2955 bug. 
       
    18 // 
       
    19 //
       
    20 
       
    21 #ifndef __CPILE_H__
       
    22 #define __CPILE_H__
       
    23 
       
    24 //-----------------------------------------------------------------------------
       
    25 
       
    26 #include <e32base.h>
       
    27 #include <e32cons.h>
       
    28 
       
    29 //-----------------------------------------------------------------------------
       
    30 
       
    31 #include "CLogFile.h"
       
    32 #include "CCmdFile.h"
       
    33 #include "CIFControl.h"
       
    34 
       
    35 //-----------------------------------------------------------------------------
       
    36 
       
    37 template <class T>
       
    38 class CPile : public CBase
       
    39 {
       
    40 public:     // Constructors and destructors
       
    41 
       
    42 	static CPile *NewL ();		//	these were both static - why???
       
    43 	static CPile *NewL (const TInt &);		//	these were both static - why???
       
    44 	static CPile *NewLC(const TInt & = 16);
       
    45 	~CPile();
       
    46 
       
    47 protected:    
       
    48 
       
    49 	//	this may be required by derived classes...
       
    50 	virtual void ConstructL(const TInt &);
       
    51 
       
    52 private:
       
    53 
       
    54 	//	this remains private
       
    55 	CPile() {};
       
    56 
       
    57 public:     // New functions
       
    58 
       
    59 	// Push to pile.
       
    60 	virtual void PushL(T *);
       
    61 
       
    62 	// Pop from pile. Returns NULL is none.
       
    63 	virtual T *Pop();
       
    64 
       
    65 	// Pop from pile (skim) and delete (empty).
       
    66 	virtual void Skim();		//	skim off top
       
    67 	virtual void Empty();		//	Empty the stack completely
       
    68 	virtual T *Peek();			//	Peek at the current (top) item
       
    69 
       
    70 	// Get count and the it'h T, legal i assumed.
       
    71 	virtual TInt Count() const;
       
    72 	virtual T *At(const TInt &) const;
       
    73 	virtual T *operator[](const TInt &) const;
       
    74 
       
    75 private:    // Data
       
    76 
       
    77 	// Pile (stack) of T.
       
    78 	CArrayPtrSeg<T> *iPile;
       
    79 	//RPointerArray<T> *iPile;
       
    80 };
       
    81 
       
    82 //-----------------------------------------------------------------------------
       
    83 //-----------------------------------------------------------------------------
       
    84 //	For the specializations
       
    85 
       
    86 class CLogFile;
       
    87 
       
    88 //-----------------------------------------------------------------------------
       
    89 //-----------------------------------------------------------------------------
       
    90 
       
    91 TEMPLATE_SPECIALIZATION class CPile<CLogFile> : public CBase
       
    92 {
       
    93 public:     // New functions
       
    94 
       
    95 	static CPile *NewL ();
       
    96 	static CPile *NewLC(const TInt & = 16);
       
    97 	~CPile();
       
    98 
       
    99 protected:    
       
   100 
       
   101 	//	this may be required by derived classes...
       
   102 	virtual void ConstructL(const TInt &);
       
   103 
       
   104 public:     // New functions
       
   105 
       
   106 	// Push to pile.
       
   107 	void PushL(CLogFile *);
       
   108 
       
   109 	// Pop from pile. Returns NULL is none.
       
   110 	CLogFile *Pop();
       
   111 
       
   112 	// Get count and the it'h T, legal i assumed.
       
   113 	TInt Count() const;
       
   114 
       
   115 	CLogFile *At(const TInt &) const;
       
   116 
       
   117 private:    // Data
       
   118 
       
   119 	CArrayPtrSeg<CLogFile> *iPile;
       
   120 };
       
   121 
       
   122 //-----------------------------------------------------------------------------
       
   123 //-----------------------------------------------------------------------------
       
   124 //	For the specializations
       
   125 
       
   126 TEMPLATE_SPECIALIZATION class CPile<CCmdFile> : public CBase
       
   127 {
       
   128 public:     // New functions
       
   129 
       
   130 	static CPile *NewL ();
       
   131 	static CPile *NewLC(const TInt & = 16);
       
   132 	~CPile();
       
   133 
       
   134 protected:    
       
   135 
       
   136 	//	this may be required by derived classes...
       
   137 	virtual void ConstructL(const TInt &);
       
   138 
       
   139 public:     // New functions
       
   140 
       
   141 	// Push to pile.
       
   142 	void PushL(CCmdFile *);
       
   143 
       
   144 	// Pop from pile. Returns NULL is none.
       
   145 	CCmdFile *Pop();
       
   146 
       
   147 	// Get count and the it'h T, legal i assumed.
       
   148 	TInt Count() const;
       
   149 
       
   150 	void Skim();		//	skim off top
       
   151 	void Empty();		//	Empty the stack completely
       
   152 
       
   153 	CCmdFile *At(const TInt &) const;
       
   154 
       
   155 private:    // Data
       
   156 
       
   157 	CArrayPtrSeg<CCmdFile> *iPile;
       
   158 };
       
   159 
       
   160 //-----------------------------------------------------------------------------
       
   161 //-----------------------------------------------------------------------------
       
   162 //	For the specializations
       
   163 
       
   164 TEMPLATE_SPECIALIZATION class CPile<CIFControl> : public CBase
       
   165 {
       
   166 public:     // New functions
       
   167 
       
   168 	static CPile *NewL ();
       
   169 	static CPile *NewLC(const TInt & = 16);
       
   170 	~CPile();
       
   171 
       
   172 protected:    
       
   173 
       
   174 	//	this may be required by derived classes...
       
   175 	virtual void ConstructL(const TInt &);
       
   176 
       
   177 public:     // New functions
       
   178 
       
   179 	// Push to pile.
       
   180 	void PushL(CIFControl *);
       
   181 
       
   182 	// Pop from pile. Returns NULL is none.
       
   183 	CIFControl *Pop();
       
   184 	void Skim();		//	skim off top
       
   185 
       
   186 	// Get count and the it'h T, legal i assumed.
       
   187 	TInt Count() const;
       
   188 
       
   189 	//	return the items At(x)
       
   190 	CIFControl *At(const TInt &) const;
       
   191 
       
   192 	//	Peek at the current (top) item
       
   193 	CIFControl *Peek();	
       
   194 
       
   195 private:    // Data
       
   196 
       
   197 	CArrayPtrSeg<CIFControl> *iPile;
       
   198 };
       
   199 
       
   200 //-----------------------------------------------------------------------------
       
   201 
       
   202 #endif	//	__CPILE_H__
       
   203 
       
   204 //-----------------------------------------------------------------------------
       
   205 // End of File
       
   206 //-----------------------------------------------------------------------------
       
   207