OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimTileCache.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: MIT
4 //
5 // See LICENSE.txt file in the top level directory for more details.
6 // License: See top level LICENSE.txt file.
7 //
8 // Author: Garrett Potts
9 // Description: This file contains the cache algorithm
10 //
11 //***********************************
12 // $Id: ossimTileCache.h 17207 2010-04-25 23:21:14Z dburken $
13 
14 #ifndef DataCache_HEADER
15 #define DataCache_HEADER
16 #include <map>
17 #include <stack>
18 using namespace std;
19 
21 #include <ossim/base/ossimDpt.h>
22 #include <ossim/base/ossimDpt3d.h>
23 #include <ossim/base/ossimRefPtr.h>
26 {
27 public:
28 
29  ossimTileCache(long numberOfBuckets = 10);
30  virtual ~ossimTileCache();
31 
36  virtual ossimDataObject* get(const ossimDpt3d &origin,
37  unsigned long resLevel=0);
38 
43  virtual ossimDataObject* remove(const ossimDpt3d &origin,
44  unsigned long resLevel=0);
49  virtual ossimDataObject* insert(const ossimDpt3d &origin,
50  ossimDataObject* data,
51  unsigned long resLevel=0);
55  void invalidate();
59  virtual void invalidate(const ossimDpt3d &origin,
60  ossim_uint32 resLevel);
61 
62 
63 
64  virtual long numberOfItems()const{return theCache?(long)theCache->size():(long)0;}
65  virtual void display()const;
66 
67  virtual ossim_uint32 sizeInBytes(){return theSizeInBytes;}
68 
69 protected:
70 
72  {
73  public:
74  friend ostream& operator <<(ostream &out,
75  const ossimTileInformation& /* info */)
76  {
77 
78  return out;
79  }
81  const ossimDpt3d &origin = ossimDpt(0,0),
82  unsigned long resLevel = 0)
83  : theCachedTile(aTile),
84  theOrigin(origin),
85  theResLevel(resLevel)
86  {}
89  unsigned long theResLevel;
90  };
91 
92  typedef multimap<ossim_uint32, ossimTileInformation*>::iterator Iterator;
95 
96  void deleteAll();
97  virtual ossim_uint32 bucketHash(const ossimDpt3d &aPt);
98  virtual ossim_uint32 tileId(const ossimDpt3d &aPt);
99 
100  multimap<ossim_uint32, ossimTileInformation*> *theCache;
103 };
104 
105 #endif
ossimTileInformation * CacheDataPtr
ossimTileInformation CacheData
multimap< ossim_uint32, ossimTileInformation * > * theCache
virtual ossim_uint32 sizeInBytes()
ossim_uint32 theSizeInBytes
ossimRefPtr< ossimDataObject > theCachedTile
multimap< ossim_uint32, ossimTileInformation * >::iterator Iterator
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
unsigned int ossim_uint32
virtual long numberOfItems() const
#define OSSIM_DLL
ossimTileInformation(ossimDataObject *aTile, const ossimDpt3d &origin=ossimDpt(0, 0), unsigned long resLevel=0)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23