OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimAppFixedTileCache.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 //
7 // Author: Garrett Potts
8 //
9 // Description: This file contains the Application cache algorithm
10 //
11 //***********************************
12 // $Id: ossimAppFixedTileCache.h 20127 2011-10-12 11:27:10Z gpotts $
13 #ifndef ossimAppFixedTileCache_HEADER
14 #define ossimAppFixedTileCache_HEADER
15 #include <map>
16 #include <list>
17 #include <iostream>
19 #include <ossim/base/ossimRefPtr.h>
20 #include <ossim/base/ossimIrect.h>
21 #include <mutex>
22 
24 class ossimImageData;
25 
27 {
28 public:
30  const ossimAppFixedTileCache& rhs);
31  static const ossim_uint32 DEFAULT_SIZE;
33  static ossimAppFixedTileCache *instance(ossim_uint32 maxSize = 0);
34  virtual ~ossimAppFixedTileCache();
35 
39  virtual void flush();
40  virtual void flush(ossimAppFixedCacheId cacheId);
41  virtual void deleteCache(ossimAppFixedCacheId cacheId);
47  ossimAppFixedCacheId newTileCache(const ossimIrect& tileBoundaryRect,
48  const ossimIpt& tileSize=ossimIpt(0,0));
49  ossimAppFixedCacheId newTileCache();
50 
51  virtual void setRect(ossimAppFixedCacheId cacheId,
52  const ossimIrect& boundaryTileRect);
53  virtual void setTileSize(ossimAppFixedCacheId cacheId,
54  const ossimIpt& tileSize);
55 
57  const ossimIpt& origin);
60  bool duplicateData=true);
61 
63  const ossimIpt& origin);
64  void deleteTile(ossimAppFixedCacheId cacheId,
65  const ossimIpt& origin);
66 
67  const ossimIpt& getTileSize(ossimAppFixedCacheId cacheId);
68 
69  virtual void setMaxCacheSize(ossim_uint32 cacheSize);
70 
71 protected:
72 // struct ossimAppFixedCacheTileInfo
73 // {
74 // public:
75 // ossimAppFixedCacheTileInfo(ossimAppFixedCacheId appId,
76 // const ossimIpt& origin)
77 // :theAppCacheId(appId),
78 // theOrigin(origin)
79 // {}
80 // ossimAppFixedCacheId theAppCacheId;
81 // ossimIpt theOrigin;
82 
83 // bool operator ==(const ossimAppFixedCacheTileInfo &rhs)const
84 // {
85 // return (theAppCacheId == rhs.theAppCacheId &&
86 // theOrigin == rhs.theOrigin);
87 // }
88 // };
89 
91 
92  ossimFixedTileCache* getCache(ossimAppFixedCacheId cacheId);
93 
94  void shrinkGlobalCacheSize(ossim_int32 byteCount);
95  void shrinkCacheSize(ossimAppFixedCacheId id,
96  ossim_int32 byteCount);
97  void shrinkCacheSize(ossimFixedTileCache* cache,
98  ossim_int32 byteCount);
99  void deleteAll();
100 
102 
111 
112  std::map<ossimAppFixedCacheId, ossimFixedTileCache*> theAppCacheMap;
113 
114  std::mutex theMutex;
115 };
116 
117 #endif
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
unsigned int ossim_uint32
static ossimAppFixedCacheId theUniqueAppIdCounter
std::map< ossimAppFixedCacheId, ossimFixedTileCache * > theAppCacheMap
#define OSSIM_DLL
static ossimAppFixedTileCache * theInstance
static const ossim_uint32 DEFAULT_SIZE
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
int ossim_int32