![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 2005 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: ssInsertionFunctor.h,v $ $Revision: 1.3 $ $State: Exp $ 00007 *********************************************************************/ 00008 #ifndef ssInsertionFunctor_H_ 00009 #define ssInsertionFunctor_H_ 00010 00011 #include <vlutil/vlConfig.h> 00012 #include "geometry/spatialSubdivision.h" 00013 #include "geometry/ssFunctor.h" 00014 00015 // 00016 // A functor intended for use with the spatial subdivision set of classes. It's 00017 // primary usage is to insert the first parameter into the second. 00018 // 00019 // Expected usage: 00020 // When passed to the intersection objects intersection functions, this fucntor 00021 // inserts the first item into the second one. Used primarily for inserting the 00022 // different spatial sorted elements into their appropriate spatial subdivisions. 00023 // For an example, see the gdbNode inserter class. 00024 // 00025 template <typename TypeToContain, typename Container> 00026 class DtSsInsertionFunctor : public DtSsFunctor<TypeToContain, Container> 00027 { 00028 public: 00029 // Constructor 00030 DtSsInsertionFunctor(); 00031 00032 // Destructor 00033 virtual ~DtSsInsertionFunctor(); 00034 00035 private: 00036 // not implemented 00037 DtSsInsertionFunctor(const DtSsInsertionFunctor& original); 00038 DtSsInsertionFunctor& operator=(const DtSsInsertionFunctor& original); 00039 00040 public: 00041 // Function operator - when applied inserts the first element into the 00042 // second element. 00043 // @param itemToInsert The item to insert into the second parameter. 00044 // @param container The container of elements into which to insert the first 00045 // parameter. 00046 // 00047 // @returns Always returns false as it is never done processing - it can 00048 // always continue inserting elements. 00049 virtual bool operator()(TypeToContain& itemToInsert, Container& container); 00050 }; 00051 00052 00053 //------------------------------------------------------ 00054 // INLINE METHODS 00055 //------------------------------------------------------ 00056 template <typename TypeToContain, typename Container> 00057 DtSsInsertionFunctor<TypeToContain, Container>::DtSsInsertionFunctor() 00058 : DtSsFunctor<TypeToContain, Container>() 00059 { 00060 } 00061 00062 00063 template <typename TypeToContain, typename Container> 00064 DtSsInsertionFunctor<TypeToContain, Container>::~DtSsInsertionFunctor() 00065 { 00066 } 00067 00068 template <typename TypeToContain, typename Container> 00069 bool DtSsInsertionFunctor<TypeToContain, Container>::operator()(TypeToContain& itemToInsert, Container& container) 00070 { 00071 container.insert(container.end(), itemToInsert); 00072 return false; 00073 } 00074 00075 #endif 00076 00077