00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 \*---------------------------------------------------------------------------*/ 00029 /*---------------------------------------------------------------------------*\ 00030 * Changes * 00031 * * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 \*---------------------------------------------------------------------------*/ 00038 00039 #ifndef _OSGTYPEDFUNCTORBASE_H_ 00040 #define _OSGTYPEDFUNCTORBASE_H_ 00041 #ifdef __sgi 00042 #pragma once 00043 #endif 00044 00045 //--------------------------------------------------------------------------- 00046 // Includes 00047 //--------------------------------------------------------------------------- 00048 00049 #include <OSGBaseTypes.h> 00050 #include <OSGBaseFunctions.h> 00051 #include <OSGFunctorBase.h> 00052 00053 OSG_BEGIN_NAMESPACE 00054 00055 //--------------------------------------------------------------------------- 00056 // Forward References 00057 //--------------------------------------------------------------------------- 00058 00059 //--------------------------------------------------------------------------- 00060 // Types 00061 //--------------------------------------------------------------------------- 00062 00063 //--------------------------------------------------------------------------- 00064 // Class 00065 //--------------------------------------------------------------------------- 00066 00071 template <class SizeTraitsT = DefaultFunctorSizeTraits> 00072 class TypedFunctorBase : public FunctorBase<SizeTraitsT> 00073 { 00074 /*========================== PUBLIC =================================*/ 00075 00076 public: 00077 00078 /*---------------------------------------------------------------------*/ 00082 TypedFunctorBase(void); 00083 TypedFunctorBase(const TypedFunctorBase &source); 00084 00086 /*---------------------------------------------------------------------*/ 00090 virtual ~TypedFunctorBase(void); 00091 00093 /*---------------------------------------------------------------------*/ 00097 void operator =(const TypedFunctorBase &source); 00098 00100 /*========================= PROTECTED ===============================*/ 00101 00102 protected: 00103 00104 /*---------------------------------------------------------------------*/ 00108 void postCopyConstruct(const TypedFunctorBase &source); 00109 00111 /*========================== PRIVATE ================================*/ 00112 00113 private: 00114 00115 /*---------------------------------------------------------------------*/ 00119 typedef FunctorBase <SizeTraitsT> Inherited; 00120 00121 typedef TypedFunctorBase<SizeTraitsT> Self; 00122 00124 }; 00125 00126 00127 00128 00129 //--------------------------------------------------------------------------- 00130 // Class 00131 //--------------------------------------------------------------------------- 00132 00137 template <class Parent, class Params> 00138 class TypedFunctionFunctorBase : public Parent 00139 { 00140 /*========================== PUBLIC =================================*/ 00141 00142 public: 00143 00144 /*---------------------------------------------------------------------*/ 00148 typedef typename Params::FunctionF FunctionF; 00149 00151 /*---------------------------------------------------------------------*/ 00155 TypedFunctionFunctorBase(void); 00156 TypedFunctionFunctorBase(const TypedFunctionFunctorBase &source); 00157 00159 /*---------------------------------------------------------------------*/ 00163 virtual ~TypedFunctionFunctorBase(void); 00164 00166 /*---------------------------------------------------------------------*/ 00170 void setMethod(FunctionF pFunc); 00171 00173 /*========================= PROTECTED ===============================*/ 00174 00175 protected: 00176 00177 /*---------------------------------------------------------------------*/ 00181 void operator =(const TypedFunctionFunctorBase &source); 00182 00184 /*========================== PRIVATE ================================*/ 00185 00186 private: 00187 00188 /*---------------------------------------------------------------------*/ 00192 typedef Parent Inherited; 00193 00194 typedef TypedFunctionFunctorBase<Parent, Params> Self; 00195 00197 }; 00198 00199 00200 00201 //--------------------------------------------------------------------------- 00202 // Class 00203 //--------------------------------------------------------------------------- 00204 00209 template <class Parent, class Params> 00210 class TypedObjectFunctorBase : public Parent 00211 { 00212 /*========================== PUBLIC =================================*/ 00213 00214 public: 00215 00216 /*---------------------------------------------------------------------*/ 00220 typedef typename Params::ObjMethodF ObjMethodF; 00221 00223 /*---------------------------------------------------------------------*/ 00227 TypedObjectFunctorBase(void); 00228 TypedObjectFunctorBase(const TypedObjectFunctorBase &source); 00229 00231 /*---------------------------------------------------------------------*/ 00235 virtual ~TypedObjectFunctorBase(void); 00236 00238 /*---------------------------------------------------------------------*/ 00242 void setMethod(ObjMethodF pFunc); 00243 00245 /*========================= PROTECTED ===============================*/ 00246 00247 protected: 00248 00249 /*---------------------------------------------------------------------*/ 00253 void operator =(const TypedObjectFunctorBase &source); 00254 00256 /*========================== PRIVATE ================================*/ 00257 00258 private: 00259 00260 /*---------------------------------------------------------------------*/ 00264 typedef Parent Inherited; 00265 00266 typedef TypedObjectFunctorBase<Parent, Params> Self; 00267 00270 }; 00271 00272 00273 00274 00275 //--------------------------------------------------------------------------- 00276 // Class 00277 //--------------------------------------------------------------------------- 00278 00283 template <class Parent, 00284 class Params> 00285 class TypedStoredObjectFunctorBase : public Parent 00286 { 00287 /*========================== PUBLIC =================================*/ 00288 00289 public: 00290 00291 /*---------------------------------------------------------------------*/ 00295 typedef typename Params::ObjMethodF ObjMethodF; 00296 00297 typedef typename Params::SetObjectT SetObjectT; 00298 00300 /*---------------------------------------------------------------------*/ 00304 TypedStoredObjectFunctorBase(void); 00305 TypedStoredObjectFunctorBase(const TypedStoredObjectFunctorBase &source); 00306 00308 /*---------------------------------------------------------------------*/ 00312 virtual ~TypedStoredObjectFunctorBase(void); 00313 00315 /*---------------------------------------------------------------------*/ 00319 void setMethod (ObjMethodF pFunc); 00320 00321 void setCalledObject (SetObjectT pObj); 00322 00323 void setObjectAndMethod(SetObjectT pObj, 00324 ObjMethodF pFunc); 00325 00327 /*========================= PROTECTED ===============================*/ 00328 00329 protected: 00330 00331 /*---------------------------------------------------------------------*/ 00335 void operator =(const TypedStoredObjectFunctorBase &source); 00336 00338 /*========================== PRIVATE ================================*/ 00339 00340 private: 00341 00342 /*---------------------------------------------------------------------*/ 00346 typedef Parent Inherited; 00347 00348 typedef TypedStoredObjectFunctorBase<Parent, Params> Self; 00349 00351 }; 00352 00353 OSG_END_NAMESPACE 00354 00355 #include <OSGTypedFunctorBase.inl> 00356 00357 #endif /* _OSGTYPEDFUNCTORBASE_H_ */ 00358
1.4.3