os/kernelhwsrv/kerneltest/e32test/system/t_multin.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1996-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 the License "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 // e32test\system\t_multin.h
    15 // 
    16 //
    17 
    18 // #define __TRACE__
    19 
    20 #include <e32test.h>
    21 
    22 class MProducer
    23 	{
    24 public:
    25 	virtual TPtrC Produce()=0;
    26 	};
    27 
    28 class MConsumer
    29 	{
    30 public:
    31 	virtual void Consume(const TDesC& aStr)=0;
    32 	virtual void Consume(const TDesC& aStr1,const TDesC& aStr2);
    33 	virtual void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3);
    34 	virtual void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4);
    35 	};
    36 
    37 class MPipe : public MProducer,public MConsumer
    38 	{
    39 public:
    40 	TPtrC Produce();
    41 	void Consume(const TDesC& aStr);
    42 	void Consume(const TDesC& aStr1,const TDesC& aStr2);
    43 	void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3);
    44 	void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4);
    45 private:
    46 	TBuf<0x100> iBuf;
    47 	};
    48 
    49 
    50 enum TSpecies {EProducer,EConsumer,EPipe,EVirtual};
    51 
    52 class TBase
    53 	{
    54 public:
    55 	virtual ~TBase() {}
    56 	virtual TSpecies Species() const=0;
    57 	virtual MProducer* Producer();
    58 	virtual MConsumer* Consumer();
    59 	};
    60 
    61 class TProducer : public TBase,public MProducer
    62 	{
    63 public:
    64 	TSpecies Species() const;
    65 	TPtrC Produce();
    66 	};
    67 
    68 class TConsumer : public TBase,public MConsumer
    69 	{
    70 public:
    71 	TSpecies Species() const;
    72 	void Consume(const TDesC& aStr);
    73 	};
    74 
    75 class TPipe : public TBase,public MPipe
    76 	{
    77 public:
    78 	TSpecies Species() const;
    79 	};
    80 
    81 class TVirProducer : public virtual TBase,public MProducer
    82 	{
    83 public:
    84 	~TVirProducer() {} // gcc workaround
    85 	TSpecies Species() const;
    86 	MProducer* Producer();
    87 	TPtrC Produce();
    88 	};
    89 
    90 class TVirConsumer : public virtual TBase,public MConsumer
    91 	{
    92 public:
    93 	~TVirConsumer() {} // gcc workaround
    94 	TSpecies Species() const;
    95 	MConsumer* Consumer();
    96 	void Consume(const TDesC& aStr);
    97 	};
    98 
    99 class TVirPipe : public TVirProducer,public TVirConsumer
   100 	{
   101 public:
   102 	~TVirPipe() {} // gcc workaround
   103 	TSpecies Species() const;
   104 	MProducer* Producer();
   105 	MConsumer* Consumer();
   106 	TPtrC Produce();
   107 	void Consume(const TDesC& aStr);
   108 	void Consume(const TDesC& aStr1,const TDesC& aStr2);
   109 	void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3);
   110 	void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4);
   111 private:
   112 	TBuf<0x100> iBuf;
   113 	};
   114