00001 00009 /************************************************************************** 00010 00011 begin : Sun Aug 22 2004 00012 copyright : (C) 2002-2010 by Ewald Arnold 00013 email : mockpp at ewald-arnold dot de 00014 00015 This program is free software; you can redistribute it and/or modify 00016 it under the terms of the GNU Lesser General Public License as 00017 published by the Free Software Foundation; either version 2 of the License, 00018 or (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU Lesser General Public License 00026 along with this program; if not, write to the Free Software 00027 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00028 00029 * 00030 * Original Java Sources: Copyright (c) 2000-2004, jMock.org 00031 * 00032 00033 **/ 00034 00035 #ifndef MOCKPP_INVOCATIONDISPATCHER_H 00036 #define MOCKPP_INVOCATIONDISPATCHER_H 00037 00038 00039 #include <mockpp/mockpp.h> // always first 00040 00041 #include <mockpp/Verifiable.h> 00042 #include <mockpp/SelfDescribing.h> 00043 00044 #include <mockpp/stub/StubHolder.h> 00045 00046 #include <mockpp/chaining/Invokable.h> 00047 00048 00049 MOCKPP_NS_START 00050 00051 00055 template <typename R, // Returntype 00056 typename I> // Invocation 00057 class InvocationDispatcher : public Verifiable, 00058 public SelfDescribing 00059 { 00060 public: 00061 00064 InvocationDispatcher() 00065 : Verifiable(MOCKPP_PCHAR("InvocationDispatcher"), 0) 00066 { 00067 } 00068 00069 typedef AutoPointer<InvocationDispatcher<R, I> > AP; 00070 00074 virtual R dispatch( const I &invocation ) = 0; 00075 00079 virtual void setDefaultStub( const MOCKPP_NS::StubHolder<R, I> &newDefaultStub ) = 0; 00080 00084 virtual void add( typename Invokable<R,I>::AP invokable ) = 0; 00085 00089 virtual void reset() = 0; 00090 }; 00091 00092 00093 MOCKPP_NS_END 00094 00095 00096 #endif // MOCKPP_INVOCATIONDISPATCHER_H