os/persistentdata/persistentstorage/dbms/pcdbms/tdbms/src/t_fail.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 1998-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 //
    15 
    16 #ifndef __T_FAIL_H__
    17 #define __T_FAIL_H__
    18 
    19 GLREF_D RTest test;
    20 GLREF_D RDbs TheDbs;
    21 GLREF_D RDbNamedDatabase TheDatabase;
    22 
    23 GLREF_C void Connect();
    24 GLREF_C void Disconnect();
    25 GLREF_C void PrepareDbFmtString();
    26 GLREF_C void TestOpen2();
    27 GLREF_C void Origins2();
    28 
    29 class THeapFail
    30 	{
    31 public:
    32 	virtual void Mark() const =0;
    33 	virtual void Fail(TInt aCount) const =0;
    34 	virtual void Reset() const =0;
    35 	virtual void Check() const =0;
    36 	};
    37 
    38 class TContext
    39 	{
    40 public:
    41 	virtual void OpenDbL() const =0;
    42 	};
    43 
    44 class TFail
    45 	{
    46 private:
    47 	void Test(const THeapFail& aHeap,const TContext* aContext);
    48 	virtual void RunL() 
    49 		{
    50 		}
    51 	virtual void End() 
    52 		{
    53 		}
    54 
    55 public:
    56 	inline void Test(const THeapFail& aHeap,const TContext& aContext)
    57 		{
    58 		Test(aHeap,&aContext);
    59 		}
    60 	inline void Test(const THeapFail& aHeap)
    61 		{
    62 		Test(aHeap,0);
    63 		}
    64 	};
    65 
    66 class TClientHeap : public THeapFail
    67 	{
    68 public:
    69 	TClientHeap() 
    70 		{
    71 		}
    72 		
    73 private:
    74 	void Mark() const
    75 		{
    76 		}
    77 	void Fail(TInt aCount) const
    78 		{
    79 		// To avoid warnings
    80 		aCount = aCount;
    81 		}
    82 	void Reset() const
    83 		{
    84 		}
    85 	void Check() const
    86 		{
    87 		}
    88 		
    89 	};
    90 
    91 class TServerHeap : public THeapFail
    92 	{
    93 public:
    94 	TServerHeap() 
    95 		{
    96 		}
    97 		
    98 private:
    99 	void Mark() const
   100 		{
   101 		}
   102 	void Fail(TInt aCount) const
   103 		{
   104 		// To avoid warnings
   105 		aCount = aCount;
   106 		}
   107 	void Reset() const
   108 		{
   109 		}
   110 	void Check() const
   111 		{
   112 		}
   113 		
   114 	};
   115 
   116 GLREF_D TClientHeap KClientHeap;
   117 GLREF_D TServerHeap KServerHeap;
   118 
   119 #endif//__T_FAIL_H__