00001
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef MOCKPP_COREMOCK_H
00036 #define MOCKPP_COREMOCK_H
00037
00038 #include <mockpp/mockpp.h>
00039
00040 #include <mockpp/chaining/AbstractDynamicChainingMock.h>
00041
00042
00043 MOCKPP_NS_START
00044
00045
00049 template <typename R,
00050 typename I>
00051 class CoreMock : public AbstractDynamicChainingMock<R, I>
00052 {
00053 public:
00054
00061 CoreMock( typename InvocationDispatcher<R, I>::AP in_invocationDispatcher,
00062 const String &name,
00063 VerifiableList *parent)
00064 : AbstractDynamicChainingMock<R, I>( in_invocationDispatcher, name, parent )
00065 {}
00066
00072 CoreMock( const String &name, VerifiableList *parent)
00073 : AbstractDynamicChainingMock<R, I>( name, parent )
00074 {}
00075
00080 R invoke( const I &invocation )
00081 {
00082 return mockInvocation( invocation );
00083 }
00084 };
00085
00086
00087 #ifndef MOCKPP_PTI_WEAKNESS // Partial Template Instantiation Weakness
00088
00089
00093 template <typename I>
00094 class CoreMock<void, I> : public AbstractDynamicChainingMock<void, I>
00095 {
00096 public:
00097
00104 CoreMock( typename InvocationDispatcher<void, I>::AP in_invocationDispatcher,
00105 const String &name,
00106 VerifiableList *parent)
00107 : AbstractDynamicChainingMock<void, I>( in_invocationDispatcher, name, parent )
00108 {}
00109
00115 CoreMock( const String &name, VerifiableList *parent)
00116 : AbstractDynamicChainingMock<void, I>( name, parent)
00117 {}
00118
00122 void invoke( const I &invocation )
00123 {
00124 mockInvocation( invocation );
00125 }
00126 };
00127
00128
00129 #define MOCKPP_COREMOCK_PTI_IMPL(I)
00130 #define MOCKPP_COREMOCK_PTI_DECL(I)
00131
00132
00133 #else // MOCKPP_PTI_WEAKNESS Partial Template Instantiation Weakness
00134
00135
00136 #define MOCKPP_COREMOCK_PTI_DECL(I) \
00137 template<> \
00138 void MOCKPP_NS::CoreMock<void, I >;
00139
00140
00141 #define MOCKPP_COREMOCK_PTI_IMPL(I) \
00142 MOCKPP_NS_START \
00143 template<> \
00144 class CoreMock<void, I> : public AbstractDynamicChainingMock<void, I> \
00145 { \
00146 public: \
00147 CoreMock<void, I>( InvocationDispatcher<void, I>::AP in_invocationDispatcher, \
00148 const String &name, \
00149 VerifiableList *parent) \
00150 : AbstractDynamicChainingMock<void, I>( in_invocationDispatcher, name, parent ) \
00151 {} \
00152 \
00153 CoreMock<void, I>( const String &name, VerifiableList *parent) \
00154 : AbstractDynamicChainingMock<void, I>( name, parent) \
00155 {} \
00156 \
00157 void invoke( const I &invocation ) \
00158 { \
00159 mockInvocation( invocation ); \
00160 } \
00161 }; \
00162 MOCKPP_NS_END
00163
00164 #endif
00165
00166
00167 MOCKPP_NS_END
00168
00179 #endif // MOCKPP_COREMOCK_H