os/kernelhwsrv/kerneltest/e32test/system/t_multin.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.
sl@0
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32test\system\t_multin.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
// #define __TRACE__
sl@0
    19
sl@0
    20
#include <e32test.h>
sl@0
    21
sl@0
    22
class MProducer
sl@0
    23
	{
sl@0
    24
public:
sl@0
    25
	virtual TPtrC Produce()=0;
sl@0
    26
	};
sl@0
    27
sl@0
    28
class MConsumer
sl@0
    29
	{
sl@0
    30
public:
sl@0
    31
	virtual void Consume(const TDesC& aStr)=0;
sl@0
    32
	virtual void Consume(const TDesC& aStr1,const TDesC& aStr2);
sl@0
    33
	virtual void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3);
sl@0
    34
	virtual void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4);
sl@0
    35
	};
sl@0
    36
sl@0
    37
class MPipe : public MProducer,public MConsumer
sl@0
    38
	{
sl@0
    39
public:
sl@0
    40
	TPtrC Produce();
sl@0
    41
	void Consume(const TDesC& aStr);
sl@0
    42
	void Consume(const TDesC& aStr1,const TDesC& aStr2);
sl@0
    43
	void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3);
sl@0
    44
	void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4);
sl@0
    45
private:
sl@0
    46
	TBuf<0x100> iBuf;
sl@0
    47
	};
sl@0
    48
sl@0
    49
sl@0
    50
enum TSpecies {EProducer,EConsumer,EPipe,EVirtual};
sl@0
    51
sl@0
    52
class TBase
sl@0
    53
	{
sl@0
    54
public:
sl@0
    55
	virtual ~TBase() {}
sl@0
    56
	virtual TSpecies Species() const=0;
sl@0
    57
	virtual MProducer* Producer();
sl@0
    58
	virtual MConsumer* Consumer();
sl@0
    59
	};
sl@0
    60
sl@0
    61
class TProducer : public TBase,public MProducer
sl@0
    62
	{
sl@0
    63
public:
sl@0
    64
	TSpecies Species() const;
sl@0
    65
	TPtrC Produce();
sl@0
    66
	};
sl@0
    67
sl@0
    68
class TConsumer : public TBase,public MConsumer
sl@0
    69
	{
sl@0
    70
public:
sl@0
    71
	TSpecies Species() const;
sl@0
    72
	void Consume(const TDesC& aStr);
sl@0
    73
	};
sl@0
    74
sl@0
    75
class TPipe : public TBase,public MPipe
sl@0
    76
	{
sl@0
    77
public:
sl@0
    78
	TSpecies Species() const;
sl@0
    79
	};
sl@0
    80
sl@0
    81
class TVirProducer : public virtual TBase,public MProducer
sl@0
    82
	{
sl@0
    83
public:
sl@0
    84
	~TVirProducer() {} // gcc workaround
sl@0
    85
	TSpecies Species() const;
sl@0
    86
	MProducer* Producer();
sl@0
    87
	TPtrC Produce();
sl@0
    88
	};
sl@0
    89
sl@0
    90
class TVirConsumer : public virtual TBase,public MConsumer
sl@0
    91
	{
sl@0
    92
public:
sl@0
    93
	~TVirConsumer() {} // gcc workaround
sl@0
    94
	TSpecies Species() const;
sl@0
    95
	MConsumer* Consumer();
sl@0
    96
	void Consume(const TDesC& aStr);
sl@0
    97
	};
sl@0
    98
sl@0
    99
class TVirPipe : public TVirProducer,public TVirConsumer
sl@0
   100
	{
sl@0
   101
public:
sl@0
   102
	~TVirPipe() {} // gcc workaround
sl@0
   103
	TSpecies Species() const;
sl@0
   104
	MProducer* Producer();
sl@0
   105
	MConsumer* Consumer();
sl@0
   106
	TPtrC Produce();
sl@0
   107
	void Consume(const TDesC& aStr);
sl@0
   108
	void Consume(const TDesC& aStr1,const TDesC& aStr2);
sl@0
   109
	void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3);
sl@0
   110
	void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4);
sl@0
   111
private:
sl@0
   112
	TBuf<0x100> iBuf;
sl@0
   113
	};
sl@0
   114