library of assembled shared sources |
http://lass.cocamware.com |
00001 /* 00002 * *** ATTENTION! DO NOT MODIFY THIS FILE DIRECTLY! *** 00003 * 00004 * It has automatically been generated from dispatcher_r_x.tmpl.h 00005 * by param_expander.py on Sun Nov 09 16:55:50 2008. 00006 */ 00007 00008 /** @file 00009 * @author Bram de Greve (bramz@users.sourceforge.net) 00010 * @author Tom De Muer (tomdemuer@users.sourceforge.net) 00011 * 00012 * *** BEGIN LICENSE INFORMATION *** 00013 * 00014 * The contents of this file are subject to the Common Public Attribution License 00015 * Version 1.0 (the "License"); you may not use this file except in compliance with 00016 * the License. You may obtain a copy of the License at 00017 * http://lass.sourceforge.net/cpal-license. The License is based on the 00018 * Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover 00019 * use of software over a computer network and provide for limited attribution for 00020 * the Original Developer. In addition, Exhibit A has been modified to be consistent 00021 * with Exhibit B. 00022 * 00023 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT 00024 * WARRANTY OF ANY KIND, either express or implied. See the License for the specific 00025 * language governing rights and limitations under the License. 00026 * 00027 * The Original Code is LASS - Library of Assembled Shared Sources. 00028 * 00029 * The Initial Developer of the Original Code is Bram de Greve and Tom De Muer. 00030 * The Original Developer is the Initial Developer. 00031 * 00032 * All portions of the code written by the Initial Developer are: 00033 * Copyright (C) 2004-2007 the Initial Developer. 00034 * All Rights Reserved. 00035 * 00036 * Contributor(s): 00037 * 00038 * Alternatively, the contents of this file may be used under the terms of the 00039 * GNU General Public License Version 2 or later (the GPL), in which case the 00040 * provisions of GPL are applicable instead of those above. If you wish to allow use 00041 * of your version of this file only under the terms of the GPL and not to allow 00042 * others to use your version of this file under the CPAL, indicate your decision by 00043 * deleting the provisions above and replace them with the notice and other 00044 * provisions required by the GPL License. If you do not delete the provisions above, 00045 * a recipient may use your version of this file under either the CPAL or the GPL. 00046 * 00047 * *** END LICENSE INFORMATION *** 00048 */ 00049 00050 #ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_R_1_H 00051 #define LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_R_1_H 00052 00053 #include "dispatcher_allocator.h" 00054 00055 // --- NEW INTERFACES ---------------------------------------------------------- 00056 00057 namespace lass 00058 { 00059 namespace util 00060 { 00061 namespace impl 00062 { 00063 00064 /** abstract base class of all dispatchers for lass::util::CallbackR1. 00065 * @internal 00066 * @sa CallbackR1 00067 * @author Bram de Greve [Bramz] 00068 */ 00069 template 00070 < 00071 typename R, typename P1 00072 > 00073 class DispatcherR1: public TDispatcherAllocatorBase 00074 { 00075 public: 00076 00077 DispatcherR1() {} 00078 virtual ~DispatcherR1() {} 00079 00080 R call(typename util::CallTraits<P1>::TParam iP1) const 00081 { 00082 return doCall(iP1); 00083 } 00084 00085 private: 00086 00087 virtual R doCall(typename util::CallTraits<P1>::TParam iP1) const = 0; 00088 00089 DispatcherR1(const DispatcherR1<R, P1>& iOther); 00090 DispatcherR1& operator=(const DispatcherR1<R, P1>& iOther); 00091 }; 00092 00093 00094 00095 /** Dispatcher for lass::util::CallbackR1 to a function or equivalent callable entinty. 00096 * @internal 00097 * @sa CallbackR1 00098 * @author Bram de Greve [Bramz] 00099 */ 00100 template 00101 < 00102 typename R, typename P1, 00103 typename FunctionType 00104 > 00105 class DispatcherR1Function: public DispatcherR1<R, P1> 00106 { 00107 public: 00108 00109 typedef FunctionType TFunction; 00110 00111 DispatcherR1Function(typename CallTraits<TFunction>::TParam iFunction): 00112 function_(iFunction) 00113 { 00114 } 00115 00116 private: 00117 00118 R doCall(typename util::CallTraits<P1>::TParam iP1) const 00119 { 00120 return function_(iP1); 00121 } 00122 00123 TFunction function_; 00124 }; 00125 00126 00127 00128 /** Dispatcher for lass::util::CallbackR1 to an object/method pair. 00129 * @internal 00130 * @sa CallbackR1 00131 * @author Bram de Greve [Bramz] 00132 */ 00133 template 00134 < 00135 typename R, typename P1, 00136 typename ObjectPtr, typename Method 00137 > 00138 class DispatcherR1Method: public DispatcherR1<R, P1> 00139 { 00140 public: 00141 00142 DispatcherR1Method(typename CallTraits<ObjectPtr>::TParam iObject, 00143 typename CallTraits<Method>::TParam iMethod): 00144 object_(iObject), 00145 method_(iMethod) 00146 { 00147 } 00148 00149 private: 00150 00151 R doCall(typename util::CallTraits<P1>::TParam iP1) const 00152 { 00153 return ((*object_).*method_)(iP1); 00154 } 00155 00156 ObjectPtr object_; 00157 Method method_; 00158 }; 00159 00160 00161 00162 } 00163 00164 } 00165 00166 } 00167 00168 #endif // Guardian of Inclusion 00169 00170 00171 // EOF
Generated on Mon Nov 10 14:20:03 2008 for Library of Assembled Shared Sources by 1.5.7.1 |