/* * CloneStub.hpp * * Created on: Jan 4, 2011 * Author: heber */ #ifndef CLONESTUB_HPP_ #define CLONESTUB_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/Clone.hpp" struct IPrototype { virtual ~IPrototype() {}; virtual void count()=0; virtual int getcount() const =0; virtual void setcount(int const _counter)=0; }; class CloneTest; class PrototypeFactoryStub; template class Prototype : public IPrototype, public Clone { /** * Prototype Factory is friend because it needs to access protected cstor * to instantiate prototypes. */ friend class PrototypeFactoryStub; /** * Tests are friend such that it can access protected cstor. */ friend class CloneTest; friend class PrototypeFactoryTest; protected: Prototype() { member.setcount(0); } ~Prototype() {}; public: void count() { member.count(); } int getcount() const { return member.getcount(); } void setcount(int const _counter) { member.setcount(_counter); } IPrototype* clone() const; private: T member; }; #endif /* CLONESTUB_HPP_ */