OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimImageChainMtAdaptor.h
Go to the documentation of this file.
1 //*************************************************************************************************
2 // OSSIM
3 //
4 // License: MIT -- See LICENSE.txt file in the top level directory for more details.
5 //
6 // Author: Oscar Kramer
7 //
8 //*************************************************************************************************
9 // $Id$
10 #ifndef ossimImageChainMtAdaptor_HEADER
11 #define ossimImageChainMtAdaptor_HEADER
12 
13 #include <vector>
16 #include <ossim/base/ossimId.h>
18 
19 //*************************************************************************************************
24 //*************************************************************************************************
26 {
27  friend class ossimMultiThreadSequencer; //### FOR DEBUG ONLY
28 
29 public:
31 
35  ossimImageChainMtAdaptor(ossimImageChain* original, ossim_uint32 num_threads=0, bool use_shared_handlers=false, bool use_cache=false, ossim_uint32 cache_tile_size=64);
37 
41  void setNumberOfThreads(ossim_uint32 num_threads);
42  void setUseSharedHandlers(bool use_shared_handlers);
43  void setCacheTileSize(ossim_uint32 cache_tile_size);
44  void setUseCache(bool use_cache);
45 
48  void setOriginalChain(ossimImageChain* original);
49 
52  virtual ossimRefPtr<ossimImageData> getTile(const ossimIrect& tileRect,
53  ossim_uint32 resLevel=0);
54 
56  virtual void initialize();
57 
59  virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=NULL);
60 
62  virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=NULL)const;
63 
66  virtual void processEvent(ossimEvent& event);
67 
70  ossimImageSource* getClone(ossim_uint32 index);
71 
73  ossim_uint32 getNumberOfClones() const { return (ossim_uint32) m_clones.size(); }
74 
80 
84  bool makeInputConnection=true,
85  bool createEventFlag=true);
86 
87 protected:
89  void deleteReplicas();
90 
92  bool replicate();
93 
96  bool connectSharedHandlers(ossim_uint32 index);
97 
100 
104  std::vector< ossimRefPtr<ossimImageSource> > m_clones;
105 
112  std::vector< ossimRefPtr<ossimConnectableContainer> > m_chainContainers;
113 
116  typedef std::vector<ossimRefPtr<ossimImageHandlerMtAdaptor> > SharedHandlerList;
118 
120 
125 
126 };
127 #endif /* #ifndef ossimImageChain_HEADER */
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=NULL)
Will load the state.
ossimRefPtr< ossimImageChain > m_adaptedChain
This is the adaptee image chain.
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
Within the image chain will pass the head of the list.
virtual void processEvent(ossimEvent &event)
ProcessEvent.
ossim_uint32 getNumberOfClones() const
Returns the number of clones available. The original chain always counts as the first clone...
void setNumberOfThreads(ossim_uint32 num_threads)
Specifies number of thread to support.
#define OSSIMDLLEXPORT
void setUseSharedHandlers(bool use_shared_handlers)
Represents serializable keyword/value map.
std::vector< ossimRefPtr< ossimImageSource > > m_clones
List of replicated child chains&#39; first source (the one receiving the getTile call).
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=NULL) const
Will save the state of the chain.
virtual void initialize()
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
virtual ossimConnectableObject::ConnectableObjectList & imageChainList()
These access methods greatly facilitate the implementation of an image chain adaptor class...
unsigned int ossim_uint32
This class supports multi-threading of image chain getTile() requests and associated chain updating...
virtual ossim_int32 connectMyOutputTo(ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
Will try to connect this objects output to the passed in object.
This class manages the sequencing of tile requests across multiple threads.
std::vector< ossimRefPtr< ossimImageHandlerMtAdaptor > > SharedHandlerList
List of handlers that are being shared among all clones (if requested).
std::vector< ossimRefPtr< ossimConnectableContainer > > m_chainContainers
The container objects must be kept alive in this vector while their child chains in m_clones are used...
void setCacheTileSize(ossim_uint32 cache_tile_size)
int ossim_int32