1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/system/t_multin.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,114 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test\system\t_multin.h
1.18 +//
1.19 +//
1.20 +
1.21 +// #define __TRACE__
1.22 +
1.23 +#include <e32test.h>
1.24 +
1.25 +class MProducer
1.26 + {
1.27 +public:
1.28 + virtual TPtrC Produce()=0;
1.29 + };
1.30 +
1.31 +class MConsumer
1.32 + {
1.33 +public:
1.34 + virtual void Consume(const TDesC& aStr)=0;
1.35 + virtual void Consume(const TDesC& aStr1,const TDesC& aStr2);
1.36 + virtual void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3);
1.37 + virtual void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4);
1.38 + };
1.39 +
1.40 +class MPipe : public MProducer,public MConsumer
1.41 + {
1.42 +public:
1.43 + TPtrC Produce();
1.44 + void Consume(const TDesC& aStr);
1.45 + void Consume(const TDesC& aStr1,const TDesC& aStr2);
1.46 + void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3);
1.47 + void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4);
1.48 +private:
1.49 + TBuf<0x100> iBuf;
1.50 + };
1.51 +
1.52 +
1.53 +enum TSpecies {EProducer,EConsumer,EPipe,EVirtual};
1.54 +
1.55 +class TBase
1.56 + {
1.57 +public:
1.58 + virtual ~TBase() {}
1.59 + virtual TSpecies Species() const=0;
1.60 + virtual MProducer* Producer();
1.61 + virtual MConsumer* Consumer();
1.62 + };
1.63 +
1.64 +class TProducer : public TBase,public MProducer
1.65 + {
1.66 +public:
1.67 + TSpecies Species() const;
1.68 + TPtrC Produce();
1.69 + };
1.70 +
1.71 +class TConsumer : public TBase,public MConsumer
1.72 + {
1.73 +public:
1.74 + TSpecies Species() const;
1.75 + void Consume(const TDesC& aStr);
1.76 + };
1.77 +
1.78 +class TPipe : public TBase,public MPipe
1.79 + {
1.80 +public:
1.81 + TSpecies Species() const;
1.82 + };
1.83 +
1.84 +class TVirProducer : public virtual TBase,public MProducer
1.85 + {
1.86 +public:
1.87 + ~TVirProducer() {} // gcc workaround
1.88 + TSpecies Species() const;
1.89 + MProducer* Producer();
1.90 + TPtrC Produce();
1.91 + };
1.92 +
1.93 +class TVirConsumer : public virtual TBase,public MConsumer
1.94 + {
1.95 +public:
1.96 + ~TVirConsumer() {} // gcc workaround
1.97 + TSpecies Species() const;
1.98 + MConsumer* Consumer();
1.99 + void Consume(const TDesC& aStr);
1.100 + };
1.101 +
1.102 +class TVirPipe : public TVirProducer,public TVirConsumer
1.103 + {
1.104 +public:
1.105 + ~TVirPipe() {} // gcc workaround
1.106 + TSpecies Species() const;
1.107 + MProducer* Producer();
1.108 + MConsumer* Consumer();
1.109 + TPtrC Produce();
1.110 + void Consume(const TDesC& aStr);
1.111 + void Consume(const TDesC& aStr1,const TDesC& aStr2);
1.112 + void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3);
1.113 + void Consume(const TDesC& aStr1,const TDesC& aStr2,const TDesC& aStr3,const TDesC& aStr4);
1.114 +private:
1.115 + TBuf<0x100> iBuf;
1.116 + };
1.117 +