VR-Forces 4.0.4 Class Documentation
include/vrvCore/DtIntersectorCache.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2010 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtIntersectorCache.h,v $ $Revision: 1.9 $ $State: Exp $
00007 ******************************************************************************/
00008 
00015 
00016 #pragma once
00017 
00018 #include <vrvCore/vrvCore.h>
00019 #include <vrvCore/DtIntersector.h>
00020 #include <vrvCore/DtIntersectorCacheKey.h>
00021 #include <boost/unordered_map.hpp>
00022 
00023 #include <matrix/vlVector.h>
00024 #include <map>
00025 
00026 namespace makVrv
00027 {   
00032    class DT_DLL_VRVCORE DtIntersectorCache
00033    {
00034    public:
00036       DtIntersectorCache();
00037 
00039       virtual ~DtIntersectorCache();
00040 
00043       void setCacheLimit(int);
00044       int cacheLimit() const;
00045 
00047       virtual bool cachedPointResult(DtIntersector::IntersectProperties, 
00048          double x, double y, double z,
00049          DtIntersector::DtIntersections&);
00050 
00052       virtual void addCachedPointResult(
00053          const DtIntersector::IntersectProperties&, double x, double y,
00054          double z, const DtIntersector::DtIntersections&);
00055 
00057       virtual bool cachedLineResult(DtIntersector::IntersectProperties, 
00058          double x, double y, double z, double end_x, double end_y, double end_z,
00059          DtIntersector::DtIntersections&);
00060 
00062       virtual void addCachedLineResult(
00063          const DtIntersector::IntersectProperties&, double x, double y,
00064          double z, double end_x, double end_y, double end_z, 
00065          const DtIntersector::DtIntersections&);
00066 
00068       virtual void clear();
00069 
00070    protected:
00073       typedef std::pair<DtIntersector::DtIntersections, int> PointInformation;
00074       typedef boost::unordered_map<std::size_t, PointInformation> PointCache;
00075 
00077       typedef std::vector<std::size_t> KeyVector;
00078       typedef std::map<int, KeyVector> CacheEntries;
00079 
00080       virtual void addToCache(const DtIntersectorCacheKey&);
00081       virtual void updateCache(PointCache::iterator&);
00082 
00084       virtual void removeFromCache();
00085 
00086    protected:
00087       PointCache myPointCache;
00088       CacheEntries myCacheEntries;
00089 
00090       unsigned int myCacheLimit;
00091       unsigned int myTotalCacheSize;
00092    };
00093 }

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)