OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
ossimImageHandlerMtAdaptor Class Reference

Intended mainly to provide a mechanism for mutex-locking access to a shared resource during a getTile operation on an ossimImageHandler. More...

#include <ossimImageHandlerMtAdaptor.h>

Inheritance diagram for ossimImageHandlerMtAdaptor:
ossimImageHandler ossimImageSource ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimImageHandlerMtAdaptor (ossimImageHandler *adaptee=0, bool use_cache=false, ossim_uint32 cache_tile_size=64)
 
void setAdaptee (ossimImageHandler *handler)
 Sets the handler being adapted. More...
 
virtual bool canConnectMyInputTo (ossim_int32 i, const ossimConnectableObject *obj) const
 Only an ossimImageHandler is allowed as input here. More...
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIpt &origin, ossim_uint32 resLevel=0)
 Intercepts the getTile call intended for the adaptee and sets a mutex lock around the adaptee's getTile call. More...
 
virtual ossimRefPtr< ossimImageDatagetTile (const ossimIrect &rect, ossim_uint32 resLevel=0)
 Intercepts the getTile call intended for the adaptee and sets a mutex lock around the adaptee's getTile call. More...
 
virtual bool getTile (ossimImageData *result, ossim_uint32 resLevel=0)
 Intercepts the getTile call intended for the adaptee and sets a mutex lock around the adaptee's getTile call. More...
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 Method to save the state of an object to a keyword list. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
virtual ossim_uint32 getNumberOfInputBands () const
 
virtual bool isOpen () const
 Derived classes must implement this method to be concrete. More...
 
virtual bool open ()
 Pure virtual open. More...
 
virtual ossim_uint32 getNumberOfLines (ossim_uint32 resLevel=0) const
 Pure virtual, derived classes must implement. More...
 
virtual ossim_uint32 getNumberOfSamples (ossim_uint32 resLevel=0) const
 Pure virtual, derived classes must implement. More...
 
virtual ossim_uint32 getImageTileWidth () const
 Returns the tile width of the image or 0 if the image is not tiled. More...
 
virtual ossim_uint32 getImageTileHeight () const
 Returns the tile width of the image or 0 if the image is not tiled. More...
 
virtual ossimString getLongName () const
 
virtual ossimString getShortName () const
 
virtual void close ()
 Deletes the overview and clears the valid image vertices. More...
 
virtual ossim_uint32 getNumberOfOutputBands () const
 Returns the number of bands in a tile returned from this TileSource. More...
 
virtual ossim_uint32 getNumberOfDecimationLevels () const
 This returns the total number of decimation levels. More...
 
virtual ossimScalarType getOutputScalarType () const
 This will be used to query the output pixel type of the tile source. More...
 
virtual ossim_uint32 getTileWidth () const
 Returns the default processing tile width. More...
 
virtual ossim_uint32 getTileHeight () const
 Returns the default processing tile height. More...
 
virtual ossim_float64 getMinPixelValue (ossim_uint32 band=0) const
 Retuns the min pixel value. More...
 
virtual ossim_float64 getMaxPixelValue (ossim_uint32 band=0) const
 Returns the max pixel of the band. More...
 
virtual ossim_float64 getNullPixelValue (ossim_uint32 band=0) const
 Each band has a null pixel associated with it. More...
 
void setCacheTileSize (ossim_uint32 cache_tile_size)
 
void setUseCache (bool use_cache)
 
void writeTime () const
 
- Public Member Functions inherited from ossimImageHandler
 ossimImageHandler ()
 Constructor (default): More...
 
virtual ~ossimImageHandler ()
 Destructor: Derived classes should implement. More...
 
virtual void initialize ()
 initialize Does nothing in this class. More...
 
virtual bool openOverview ()
 Searches for an overview. More...
 
virtual bool openOverview (const ossimFilename &overview_file)
 Calls closeOverview(), then attempts to open the overview_file. More...
 
virtual void closeOverview ()
 If theOverview is initialized it will be deleted and set to NULL. More...
 
virtual const ossimImageHandlergetOverview () const
 
virtual bool hasOverviews () const
 
virtual ossimFilename createDefaultOverviewFilename () const
 
virtual ossimFilename createDefaultGeometryFilename () const
 
virtual ossimFilename createDefaultMetadataFilename () const
 
virtual ossimFilename createDefaultHistogramFilename () const
 
virtual ossimFilename createDefaultValidVerticesFilename () const
 
virtual bool writeValidImageVertices (const std::vector< ossimIpt > &vertices, const ossimFilename &file=ossimFilename(""))
 Outputs vertices to file and updates the internal vertex array variable "theValidImageVertices". More...
 
virtual bool openValidVertices (const ossimFilename &vertices_file)
 Opens the valid image vertices file and sets theValidImageVerticesFile variable. More...
 
virtual bool openValidVertices ()
 Creates vertices file name based on image, then tries to open. More...
 
virtual bool open (const ossimFilename &imageFile, ossim_uint32 entryIndex)
 Opens the image file. More...
 
virtual bool open (const ossimFilename &imageFile)
 
virtual bool open (std::shared_ptr< ossim::ImageHandlerState > state)
 
virtual bool buildHistogram (int numberOfRLevels=0, ossimHistogramMode mode=OSSIM_HISTO_MODE_NORMAL)
 Build a histogram for image file. More...
 
virtual bool buildAllHistograms (int numberOfRLevels=0, ossimHistogramMode mode=OSSIM_HISTO_MODE_NORMAL)
 Build a histograms for all image entries. More...
 
virtual bool buildOverview (ossimImageHandlerOverviewCompressionType compressionType=OSSIM_OVERVIEW_COMPRESSION_NONE, ossim_uint32 quality=75, ossimFilterResampler::ossimFilterResamplerType resampleType=ossimFilterResampler::ossimFilterResampler_BOX, bool includeFullResFlag=false)
 Will build over file for theImageFile. More...
 
virtual bool buildAllOverviews (ossimImageHandlerOverviewCompressionType compressionType=OSSIM_OVERVIEW_COMPRESSION_NONE, ossim_uint32 quality=75, ossimFilterResampler::ossimFilterResamplerType resampleType=ossimFilterResampler::ossimFilterResampler_BOX, bool includeFullResFlag=false)
 Will build over file for all image entries. More...
 
virtual bool buildOverview (const ossimFilename &filename, ossimImageHandlerOverviewCompressionType compressionType=OSSIM_OVERVIEW_COMPRESSION_NONE, ossim_uint32 quality=75, ossimFilterResampler::ossimFilterResamplerType resampleType=ossimFilterResampler::ossimFilterResampler_BOX, bool includeFullResFlag=false)
 Will build an over file for filename. More...
 
ossimRefPtr< ossimMultiResLevelHistogramgetImageHistogram () const
 Fetches the current entry image's histogram. More...
 
virtual ossimRefPtr< ossimImageGeometrygetImageGeometry ()
 Returns the image geometry object associated with this tile source or NULL if non defined. More...
 
virtual void setImageGeometry (ossimImageGeometry *geom)
 Sets the image geometry object. More...
 
virtual void saveImageGeometry () const
 Saves the image geometry to a file that will be made based on the image file name. More...
 
virtual void saveImageGeometry (const ossimFilename &geometry_file) const
 Saves the image geometry to a file that will be made based on the image file name. More...
 
virtual ossimIrect getImageRectangle (ossim_uint32 resLevel=0) const
 Returns zero-based bounding rectangle of the image. More...
 
virtual ossimIrect getBoundingRect (ossim_uint32 resLevel=0) const
 Returns zero-based bounding rectangle of the image. More...
 
virtual void getDecimationFactor (ossim_uint32 resLevel, ossimDpt &result) const
 
virtual void getDecimationFactors (vector< ossimDpt > &decimations) const
 This returns all decimation for all levels. More...
 
virtual ossim_uint32 getNumberOfReducedResSets () const
 This method is obsolete. More...
 
virtual void setFilename (const ossimFilename &filename)
 Sets the filename. More...
 
virtual const ossimFilenamegetFilename () const
 Returns the filename. More...
 
virtual bool isValidRLevel (ossim_uint32 resLevel) const
 Determines if the passed in reslution level is valid. More...
 
virtual void getValidImageVertices (vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual bool isBandSelector () const
 Indicates whether or not the image handler can control output band selection via the setOutputBandList method. More...
 
virtual bool setOutputBandList (const std::vector< ossim_uint32 > &band_list)
 If the image handler "isBandSeletor()" then the band selection of the output chip can be controlled. More...
 
virtual bool setOutputToInputBandList ()
 If the image handler "isBandSeletor()" then the band selection of the output are set to input or identity. More...
 
virtual bool isIdentityBandList (const std::vector< ossim_uint32 > &bandList) const
 Convenience method to see if band list is identity. More...
 
virtual bool isImageTiled () const
 Indicates whether or not the image is tiled internally. More...
 
virtual bool hasMetaData () const
 
virtual ossimRefPtr< ossimNBandLutDataObjectgetLut () const
 
virtual bool hasLut () const
 
virtual void loadMetaData ()
 There is an external file with an omd extension. More...
 
virtual void setMinPixelValue (ossim_uint32 band, const ossim_float64 &pix)
 convenience method to set min pixel value. More...
 
virtual void setMaxPixelValue (ossim_uint32 band, const ossim_float64 &pix)
 convenience method to set max pixel value. More...
 
virtual void setNullPixelValue (ossim_uint32 band, const ossim_float64 &pix)
 convenience method to set null pixel value. More...
 
virtual ossim_uint32 getCurrentEntry () const
 
virtual ossim_uint32 getNumberOfEntries () const
 
virtual void getEntryName (ossim_uint32 entryIdx, std::string &name) const
 Get the name of entry as a string. More...
 
virtual void getEntryList (std::vector< ossim_uint32 > &entryList) const
 
virtual void getEntryNames (std::vector< ossimString > &entryNames) const
 
bool useEntryIndex () const
 Convenience method to determine if entry index should be used for support files, e.g. More...
 
ossimFilename getOverviewFile () const
 
virtual bool setCurrentEntry (ossim_uint32 entryIdx)
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 
ossimFilename getFilenameWithThisExtension (const ossimString &ext, bool set_e0_prefix=false) const
 Returns the image file with extension set using supplentary directory for dirname if set. More...
 
void getFilenameWithThisExt (const ossimString &ext, ossimFilename &f) const
 Returns the image file with extension set using supplentary directory for dirname if set. More...
 
ossim_uint32 getStartingResLevel () const
 
void setStartingResLevel (ossim_uint32 level)
 
bool getOpenOverviewFlag () const
 
void setOpenOverviewFlag (bool flag)
 Sets theOpenOverviewFlag. More...
 
virtual void setSupplementaryDirectory (const ossimFilename &dir)
 Sets the supplementary directory. More...
 
virtual const ossimFilenamegetSupplementaryDirectory () const
 Returns the supplementary directory. More...
 
const ossimStringgetImageID () const
 Fetches the image ID. More...
 
void setImageID (const ossimString &id)
 Sets the image ID in case it is externally generated. More...
 
ossimPixelType getPixelType () const
 Returns the raster pixel alignment type. More...
 
virtual bool getRgbBandList (std::vector< ossim_uint32 > &bandList) const
 Convenience method to get the zero based rgb output band list. More...
 
template<class T >
std::shared_ptr< T > getStateAs ()
 
template<class T >
std::shared_ptr< const T > getStateAs () const
 
std::shared_ptr< ossim::ImageHandlerState > getState ()
 
std::shared_ptr< const ossim::ImageHandlerState > getState () const
 
void setState (std::shared_ptr< ossim::ImageHandlerState > state)
 
- Public Member Functions inherited from ossimImageSource
 ossimImageSource (ossimObject *owner=0)
 
 ossimImageSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimImageSource ()
 
virtual ossimObjectgetObject ()
 For RTTI support. More...
 
virtual const ossimObjectgetObject () const
 For RTTI support. More...
 
virtual void getDecimationFactors (std::vector< ossimDpt > &decimations) const
 Will return an array of all decimations for each resolution level. More...
 
virtual void getOutputBandList (std::vector< ossim_uint32 > &bandList) const
 Initializes bandList. More...
 
virtual void getBoundingRect (ossimIrect &rect, ossim_uint32 resLevel=0) const
 Gets the bounding rectangle of the source. More...
 
virtual void getValidImageVertices (std::vector< ossimIpt > &validVertices, ossimVertexOrdering ordering=OSSIM_CLOCKWISE_ORDER, ossim_uint32 resLevel=0) const
 ordering specifies how the vertices should be arranged. More...
 
virtual void setImageGeometry (const ossimImageGeometry *geom)
 Default implementation sets geometry of the first input to the geometry specified. More...
 
virtual bool isIndexedData () const
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual ossimString getClassName () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool addListener (ossimListener *listener)
 
virtual bool removeListener (ossimListener *listener)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 

Public Attributes

double d_getTileT
 
ossim_uint32 d_cacheTileSize
 

Static Public Attributes

static const char * ADAPTEE_ID_KW = "adaptee_id"
 

Protected Member Functions

virtual ~ossimImageHandlerMtAdaptor ()
 Protected destructor forces using reference pointer for instantiation. More...
 
- Protected Member Functions inherited from ossimImageHandler
virtual ossimRefPtr< ossimImageGeometrygetExternalImageGeometry () const
 Returns the image geometry object associated with this tile source or NULL if non defined. More...
 
virtual ossimRefPtr< ossimImageGeometrygetInternalImageGeometry () const
 
virtual bool getOverviewTile (ossim_uint32 resLevel, ossimImageData *result)
 Method to get an overview tile. More...
 
bool initVertices (const char *file)
 Opens file and attempts to initialize the valid image vertices. More...
 
virtual void completeOpen ()
 Will complete the opening process. More...
 
void initImageParameters (ossimImageGeometry *geom) const
 Convenience method to set things needed in the image geometry from the image handler. More...
 
virtual void establishDecimationFactors ()
 Virtual method determines the decimation factors at each resolution level. More...
 
virtual bool setOutputBandList (const std::vector< ossim_uint32 > &inBandList, std::vector< ossim_uint32 > &outBandList)
 Convenience method to set output band list. More...
 
void getFilenameWithNoExtension (ossimFilename &f) const
 Get filename with no extension, using supplentary directory for dirname if set. More...
 
- Protected Member Functions inherited from ossimImageSource
 ossimImageSource (const ossimImageSource &rhs)
 
const ossimImageSourceoperator= (const ossimImageSource &)
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 

Protected Attributes

ossimRefPtr< ossimImageHandlerm_adaptedHandler
 
ossimRefPtr< ossimCacheTileSourcem_cache
 
std::mutex m_mutex
 
bool d_useCache
 
bool d_useFauxTile
 
ossimRefPtr< ossimImageDatad_fauxTile
 
- Protected Attributes inherited from ossimImageHandler
ossimFilename theImageFile
 
ossimFilename theOverviewFile
 
ossimFilename theSupplementaryDirectory
 
ossimRefPtr< ossimImageHandlertheOverview
 
vector< ossimIpttheValidImageVertices
 
ossimImageMetaData theMetaData
 
ossimRefPtr< ossimImageGeometrytheGeometry
 
ossimRefPtr< ossimNBandLutDataObjecttheLut
 
std::vector< ossimDpttheDecimationFactors
 
ossimString theImageID
 
ossim_uint32 theStartingResLevel
 theStartingResLevel If set to something other than zero(default) this is indicative that the reader is an overview. More...
 
bool theOpenOverviewFlag
 If true opening of overviews will be attempted. More...
 
ossimPixelType thePixelType
 
std::shared_ptr< ossim::ImageHandlerState > m_state
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 

Friends

class ossimMtDebug
 

Additional Inherited Members

- Public Types inherited from ossimImageHandler
enum  ossimImageHandlerOverviewCompressionType {
  OSSIM_OVERVIEW_COMPRESSION_NONE = 0, OSSIM_OVERVIEW_COMPRESSION_JPEG, OSSIM_OVERVIEW_COMPRESSION_LZW, OSSIM_OVERVIEW_COMPRESSION_DEFLATE,
  OSSIM_OVERVIEW_COMPRESSION_PACKBITS
}
 
- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 

Detailed Description

Intended mainly to provide a mechanism for mutex-locking access to a shared resource during a getTile operation on an ossimImageHandler.

This is needed for multi-threaded implementation.

Definition at line 20 of file ossimImageHandlerMtAdaptor.h.

Constructor & Destructor Documentation

◆ ossimImageHandlerMtAdaptor()

ossimImageHandlerMtAdaptor::ossimImageHandlerMtAdaptor ( ossimImageHandler adaptee = 0,
bool  use_cache = false,
ossim_uint32  cache_tile_size = 64 
)

Definition at line 31 of file ossimImageHandlerMtAdaptor.cpp.

References setAdaptee(), setCacheTileSize(), and setUseCache().

32  : d_getTileT (0),
33  d_cacheTileSize(1024),
34  m_adaptedHandler (0),
35  m_cache (0),
36  d_useCache (false),
37  d_useFauxTile (false)
38 {
39  //###### DEBUG ############
40  // ossimMtDebug* mt_debug = ossimMtDebug::instance();
41  //d_useCache = mt_debug->handlerCacheEnabled;
42  //d_useFauxTile = mt_debug->handlerUseFauxTile;
43  //###### END DEBUG ############
44 
45  setUseCache(use_cache);
46  setCacheTileSize(cache_tile_size);
47  setAdaptee(adaptee);
48 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
void setAdaptee(ossimImageHandler *handler)
Sets the handler being adapted.
ossimRefPtr< ossimCacheTileSource > m_cache
void setCacheTileSize(ossim_uint32 cache_tile_size)

◆ ~ossimImageHandlerMtAdaptor()

ossimImageHandlerMtAdaptor::~ossimImageHandlerMtAdaptor ( )
protectedvirtual

Protected destructor forces using reference pointer for instantiation.

Definition at line 53 of file ossimImageHandlerMtAdaptor.cpp.

References d_fauxTile, m_adaptedHandler, and m_cache.

54 {
55  m_adaptedHandler = 0;
56  m_cache = 0;
57  d_fauxTile = 0;
58 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
ossimRefPtr< ossimCacheTileSource > m_cache
ossimRefPtr< ossimImageData > d_fauxTile

Member Function Documentation

◆ canConnectMyInputTo()

bool ossimImageHandlerMtAdaptor::canConnectMyInputTo ( ossim_int32  i,
const ossimConnectableObject obj 
) const
virtual

Only an ossimImageHandler is allowed as input here.

Reimplemented from ossimImageHandler.

Definition at line 108 of file ossimImageHandlerMtAdaptor.cpp.

110 {
111  const ossimImageHandler* h = dynamic_cast<const ossimImageHandler*>(obj);
112  if ((inputIndex == 0) && (h != NULL))
113  return true;
114  return false;
115 }
This class defines an abstract Handler which all image handlers(loaders) should derive from...

◆ close()

void ossimImageHandlerMtAdaptor::close ( )
virtual

Deletes the overview and clears the valid image vertices.

Derived classes should implement.

Reimplemented from ossimImageHandler.

Definition at line 343 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::close(), ossimImageHandler::closeOverview(), d_fauxTile, ossimConnectableObject::disconnectAllOutputs(), m_adaptedHandler, m_cache, ossimListenerManager::removeListener(), and ossimRefPtr< T >::valid().

344 {
346  this->disconnectAllOutputs();
347  m_cache = 0;
348  if (m_adaptedHandler.valid())
349  {
352  }
353  d_fauxTile = 0;
354 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
virtual void disconnectAllOutputs()
Will disconnect all of the output objects.
bool valid() const
Definition: ossimRefPtr.h:75
virtual void closeOverview()
If theOverview is initialized it will be deleted and set to NULL.
virtual void close()
Deletes the overview and clears the valid image vertices.
ossimRefPtr< ossimCacheTileSource > m_cache
ossimRefPtr< ossimImageData > d_fauxTile
virtual bool removeListener(ossimListener *listener)

◆ getImageTileHeight()

ossim_uint32 ossimImageHandlerMtAdaptor::getImageTileHeight ( ) const
virtual

Returns the tile width of the image or 0 if the image is not tiled.

Note: this is not the same as the ossimImageSource::getTileWidth which returns the output tile width which can be different than the internal image tile width on disk.

Implements ossimImageHandler.

Definition at line 322 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::getImageTileHeight(), m_adaptedHandler, and ossimRefPtr< T >::valid().

323 {
324  if (m_adaptedHandler.valid())
326  return 0;
327 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getImageTileHeight() const =0
Returns the tile width of the image or 0 if the image is not tiled.

◆ getImageTileWidth()

ossim_uint32 ossimImageHandlerMtAdaptor::getImageTileWidth ( ) const
virtual

Returns the tile width of the image or 0 if the image is not tiled.

Note: this is not the same as the ossimImageSource::getTileWidth which returns the output tile width which can be different than the internal image tile width on disk.

Implements ossimImageHandler.

Definition at line 315 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::getImageTileWidth(), m_adaptedHandler, and ossimRefPtr< T >::valid().

316 {
317  if (m_adaptedHandler.valid())
319  return 0;
320 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getImageTileWidth() const =0
Returns the tile width of the image or 0 if the image is not tiled.

◆ getLongName()

ossimString ossimImageHandlerMtAdaptor::getLongName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 329 of file ossimImageHandlerMtAdaptor.cpp.

References ossimObject::getLongName(), m_adaptedHandler, and ossimRefPtr< T >::valid().

330 {
331  if (m_adaptedHandler.valid())
332  return m_adaptedHandler->getLongName();
333  return ossimString();
334 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimString getLongName() const
Definition: ossimObject.cpp:53

◆ getMaxPixelValue()

ossim_float64 ossimImageHandlerMtAdaptor::getMaxPixelValue ( ossim_uint32  band = 0) const
virtual

Returns the max pixel of the band.

Reimplemented from ossimImageHandler.

Definition at line 425 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::getMaxPixelValue(), m_adaptedHandler, and ossimRefPtr< T >::valid().

426 {
427  if (m_adaptedHandler.valid())
428  return m_adaptedHandler->getMaxPixelValue(band);
429  return 0.0;
430 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.

◆ getMinPixelValue()

ossim_float64 ossimImageHandlerMtAdaptor::getMinPixelValue ( ossim_uint32  band = 0) const
virtual

Retuns the min pixel value.

If there was an external eta data file then use the meta data from that file. If not given then we will return the default min

Reimplemented from ossimImageHandler.

Definition at line 418 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::getMinPixelValue(), m_adaptedHandler, and ossimRefPtr< T >::valid().

419 {
420  if (m_adaptedHandler.valid())
421  return m_adaptedHandler->getMinPixelValue(band);
422  return 0.0;
423 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual double getMinPixelValue(ossim_uint32 band=0) const
Retuns the min pixel value.

◆ getNullPixelValue()

ossim_float64 ossimImageHandlerMtAdaptor::getNullPixelValue ( ossim_uint32  band = 0) const
virtual

Each band has a null pixel associated with it.

The null pixel represents an invalid value.

Reimplemented from ossimImageHandler.

Definition at line 432 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::getNullPixelValue(), m_adaptedHandler, and ossimRefPtr< T >::valid().

433 {
434  if (m_adaptedHandler.valid())
435  return m_adaptedHandler->getNullPixelValue(band);
436  return 0.0;
437 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.

◆ getNumberOfDecimationLevels()

ossim_uint32 ossimImageHandlerMtAdaptor::getNumberOfDecimationLevels ( ) const
virtual

This returns the total number of decimation levels.

It is important to note that res level 0 or full resolution is included in the list and has decimation values 1.0, 1.0

Reimplemented from ossimImageHandler.

Definition at line 373 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::getNumberOfDecimationLevels(), m_adaptedHandler, and ossimRefPtr< T >::valid().

374 {
375  if (m_adaptedHandler.valid())
377  return 0;
378 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfDecimationLevels() const
This returns the total number of decimation levels.

◆ getNumberOfInputBands()

ossim_uint32 ossimImageHandlerMtAdaptor::getNumberOfInputBands ( ) const
virtual

Returns the number of bands available from the input.

Implements ossimImageSource.

Definition at line 280 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageSource::getNumberOfInputBands(), m_adaptedHandler, and ossimRefPtr< T >::valid().

281 {
282  if (m_adaptedHandler.valid())
284  return 0;
285 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfInputBands() const =0

◆ getNumberOfLines()

ossim_uint32 ossimImageHandlerMtAdaptor::getNumberOfLines ( ossim_uint32  resLevel = 0) const
virtual

Pure virtual, derived classes must implement.

Parameters
resLevelReduced resolution level to return lines of. Default = 0
Returns
The number of lines for specified reduced resolution level.

Implements ossimImageHandler.

Definition at line 301 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::getNumberOfLines(), m_adaptedHandler, and ossimRefPtr< T >::valid().

302 {
303  if (m_adaptedHandler.valid())
304  return m_adaptedHandler->getNumberOfLines(resLevel);
305  return 0;
306 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfLines(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.

◆ getNumberOfOutputBands()

ossim_uint32 ossimImageHandlerMtAdaptor::getNumberOfOutputBands ( ) const
virtual

Returns the number of bands in a tile returned from this TileSource.

Reimplemented from ossimImageSource.

Definition at line 356 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageSource::getNumberOfOutputBands(), m_adaptedHandler, and ossimRefPtr< T >::valid().

357 {
358  if (m_adaptedHandler.valid())
360  return 0;
361 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
bool valid() const
Definition: ossimRefPtr.h:75

◆ getNumberOfSamples()

ossim_uint32 ossimImageHandlerMtAdaptor::getNumberOfSamples ( ossim_uint32  resLevel = 0) const
virtual

Pure virtual, derived classes must implement.

Parameters
resLevelReduced resolution level to return samples of. Default = 0
Returns
The number of samples for specified reduced resolution level.

Implements ossimImageHandler.

Definition at line 308 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::getNumberOfSamples(), m_adaptedHandler, and ossimRefPtr< T >::valid().

309 {
310  if (m_adaptedHandler.valid())
311  return m_adaptedHandler->getNumberOfSamples(resLevel);
312  return 0;
313 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getNumberOfSamples(ossim_uint32 resLevel=0) const =0
Pure virtual, derived classes must implement.

◆ getOutputScalarType()

ossimScalarType ossimImageHandlerMtAdaptor::getOutputScalarType ( ) const
virtual

This will be used to query the output pixel type of the tile source.

Please ignore the argument. It will soon be removed.

Reimplemented from ossimImageSource.

Definition at line 397 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageSource::getOutputScalarType(), m_adaptedHandler, OSSIM_SCALAR_UNKNOWN, and ossimRefPtr< T >::valid().

398 {
399  if (m_adaptedHandler.valid())
401  return OSSIM_SCALAR_UNKNOWN;
402 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.

◆ getShortName()

ossimString ossimImageHandlerMtAdaptor::getShortName ( ) const
virtual

Reimplemented from ossimObject.

Definition at line 336 of file ossimImageHandlerMtAdaptor.cpp.

References ossimObject::getShortName(), m_adaptedHandler, and ossimRefPtr< T >::valid().

337 {
338  if (m_adaptedHandler.valid())
339  return m_adaptedHandler->getShortName();
340  return ossimString();
341 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossimString getShortName() const
Definition: ossimObject.cpp:48

◆ getTile() [1/3]

ossimRefPtr< ossimImageData > ossimImageHandlerMtAdaptor::getTile ( const ossimIpt origin,
ossim_uint32  rLevel = 0 
)
virtual

Intercepts the getTile call intended for the adaptee and sets a mutex lock around the adaptee's getTile call.

Reimplemented from ossimImageSource.

Definition at line 123 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageSource::getTileHeight(), ossimImageSource::getTileWidth(), m_adaptedHandler, ossimRefPtr< T >::valid(), ossimIpt::x, and ossimIpt::y.

124 {
125  if (!m_adaptedHandler.valid())
126  return NULL;
127 
128  // Establish tile rect to call overloaded getTile(tile_rect):
131  ossimIpt lr (origin.x + w - 1, origin.y + h - 1);
132  ossimIrect tile_rect (origin, lr);
133 
134  // Need to unlock to prevent freezing in the called getTile():
135  return getTile(tile_rect, rLevel);
136 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.
unsigned int ossim_uint32
ossim_int32 y
Definition: ossimIpt.h:142
ossim_int32 x
Definition: ossimIpt.h:141
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)
Intercepts the getTile call intended for the adaptee and sets a mutex lock around the adaptee&#39;s getTi...

◆ getTile() [2/3]

ossimRefPtr< ossimImageData > ossimImageHandlerMtAdaptor::getTile ( const ossimIrect tile_rect,
ossim_uint32  rLevel = 0 
)
virtual

Intercepts the getTile call intended for the adaptee and sets a mutex lock around the adaptee's getTile call.

Reimplemented from ossimImageSource.

Definition at line 143 of file ossimImageHandlerMtAdaptor.cpp.

144 {
145  if (traceDebug())
146  {
147  std::cout << "TILE: " << tile_rect << std::endl;
148  }
149 
150  if (d_useFauxTile)
151  {
153  ftile->setOrigin(tile_rect.ul());
154  return ftile;
155  }
156 
157  if (!m_adaptedHandler.valid())
158  return NULL;
159 
160  // The sole purpose of the adapter is this mutex lock around the actual handler getTile:
161  //std::lock_guard<std::mutex> lock(m_mutex);
162 
164  ossimRefPtr<ossimImageData> temp_tile = 0;
165  double dt = ossimTimer::instance()->time_s();
166 
167  //writeTime();
168  if (traceDebug())
169  {
170  std::cout << "WAIT LOCK: " << tile_rect << std::endl;
171  }
172  std::lock_guard<std::mutex> lock(m_mutex);
173 
174  if (traceDebug())
175  {
176  std::cout << "START LOCK: " << tile_rect << std::endl;
177  }
178 
179  if (d_useCache)
180  temp_tile = m_cache->getTile(tile_rect, rLevel);
181  else
182  temp_tile = m_adaptedHandler->getTile(tile_rect, rLevel);
184 
185  // We make our own instance of a tile and copy the adaptee's returned tile to it. This avoids
186  // the product tile from changing while being processed up the chain. The adaptee's tile can
187  // change as soon as the mutex lock is released:
188 
189  if (temp_tile.valid())
190  *tile = *(temp_tile.get());
191  else
192  tile = NULL;
193 
194  //writeTime();
195  if (traceDebug())
196  {
197  std::cout << "END LOCK: " << tile_rect << std::endl;
198  }
199  if (traceDebug())
200  {
201  std::cout << "END TILE: " << tile_rect << std::endl;
202  }
203 
204  return tile;
205 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
const ossimIpt & ul() const
Definition: ossimIrect.h:274
static ossimTimer * instance()
Definition: ossimTimer.cpp:19
double time_s() const
Get elapsed time in seconds.
Definition: ossimTimer.h:33
virtual void setOrigin(const ossimIpt &origin)
ossimRefPtr< ossimCacheTileSource > m_cache
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
ossimRefPtr< ossimImageData > d_fauxTile
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ getTile() [3/3]

bool ossimImageHandlerMtAdaptor::getTile ( ossimImageData tile,
ossim_uint32  rLevel = 0 
)
virtual

Intercepts the getTile call intended for the adaptee and sets a mutex lock around the adaptee's getTile call.

Reimplemented from ossimImageSource.

Definition at line 211 of file ossimImageHandlerMtAdaptor.cpp.

References d_useCache, ossimRefPtr< T >::get(), ossimImageData::getImageRectangle(), ossimCacheTileSource::getTile(), ossimImageSource::getTile(), m_adaptedHandler, m_cache, m_mutex, ossimReferenced::ref(), status, ossimReferenced::unref(), and ossimRefPtr< T >::valid().

212 {
213  if ((!m_adaptedHandler.valid()) || (tile == NULL))
214  return false;
215 
216  // The sole purpose of the adapter is this mutex lock around the actual handler getTile:
217  std::lock_guard<std::mutex> lock(m_mutex);
218 
219  // This is effectively a copy of ossimImageSource::getTile(ossimImageData*). It is reimplemented
220  // here to save two additional function calls:
221  tile->ref();
222  bool status = true;
223  ossimIrect tile_rect = tile->getImageRectangle();
224 
225  ossimRefPtr<ossimImageData> temp_tile = 0;
226  if (d_useCache)
227  temp_tile = m_cache->getTile(tile_rect, rLevel);
228  else
229  temp_tile = m_adaptedHandler->getTile(tile_rect, rLevel);
230 
231  if (temp_tile.valid())
232  *tile = *(temp_tile.get());
233  else
234  status = false;
235  tile->unref();
236 
237  return status;
238 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
void ref() const
increment the reference count by one, indicating that this object has another pointer which is refere...
virtual ossimIrect getImageRectangle() const
void unref() const
decrement the reference count by one, indicating that a pointer to this object is referencing it...
return status
ossimRefPtr< ossimCacheTileSource > m_cache
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &tileRect, ossim_uint32 resLevel=0)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ getTileHeight()

ossim_uint32 ossimImageHandlerMtAdaptor::getTileHeight ( ) const
virtual

Returns the default processing tile height.

Reimplemented from ossimImageSource.

Definition at line 411 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageSource::getTileHeight(), m_adaptedHandler, and ossimRefPtr< T >::valid().

412 {
413  if (m_adaptedHandler.valid())
415  return 0;
416 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.

◆ getTileWidth()

ossim_uint32 ossimImageHandlerMtAdaptor::getTileWidth ( ) const
virtual

Returns the default processing tile width.

Reimplemented from ossimImageSource.

Definition at line 404 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageSource::getTileWidth(), m_adaptedHandler, and ossimRefPtr< T >::valid().

405 {
406  if (m_adaptedHandler.valid())
407  return m_adaptedHandler->getTileWidth();
408  return 0;
409 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual ossim_uint32 getTileWidth() const
Returns the default processing tile width.

◆ isOpen()

bool ossimImageHandlerMtAdaptor::isOpen ( ) const
virtual

Derived classes must implement this method to be concrete.

Returns
true if open, false if not.

Implements ossimImageHandler.

Definition at line 287 of file ossimImageHandlerMtAdaptor.cpp.

References ossimImageHandler::isOpen(), m_adaptedHandler, and ossimRefPtr< T >::valid().

288 {
289  if (m_adaptedHandler.valid())
290  return m_adaptedHandler->isOpen();
291  return false;
292 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
virtual bool isOpen() const =0
Derived classes must implement this method to be concrete.

◆ loadState()

bool ossimImageHandlerMtAdaptor::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of an object from a keyword list.

Return true if ok or false on error.

Reimplemented from ossimImageHandler.

Definition at line 261 of file ossimImageHandlerMtAdaptor.cpp.

References ADAPTEE_ID_KW, ossimString::empty(), ossimKeywordlist::find(), ossimImageSource::loadState(), and m_adaptedHandler.

262 {
263  m_adaptedHandler = 0;
264 
265  // Skip the ossimImageHandler::loadState() since it is not necessary here:
266  if (!ossimImageSource::loadState(kwl, prefix))
267  return false;
268 
269  // The adaptee's ID at least will be in the KWL:
270  ossimString value = kwl.find(prefix, ADAPTEE_ID_KW);
271  if (value.empty())
272  return false;
273 
274  return true;
275 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
Method to the load (recreate) the state of an object from a keyword list.
const char * find(const char *key) const
bool empty() const
Definition: ossimString.h:411

◆ open()

bool ossimImageHandlerMtAdaptor::open ( )
virtual

Pure virtual open.

Derived classes must implement.

Returns
Returns true on success, false on error.
Note
This method relies on the data member ossimImageData::theImageFile being set. Callers should do a "setFilename" prior to calling this method or use the ossimImageHandler::open that takes a file name and an entry index.

Implements ossimImageHandler.

Definition at line 294 of file ossimImageHandlerMtAdaptor.cpp.

References m_adaptedHandler, ossimImageHandler::open(), and ossimRefPtr< T >::valid().

295 {
296  if (m_adaptedHandler.valid())
297  return m_adaptedHandler->open();
298  return false;
299 }
virtual bool open()=0
Pure virtual open.
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75

◆ saveState()

bool ossimImageHandlerMtAdaptor::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

Method to save the state of an object to a keyword list.

Return true if ok or false on error.

Reimplemented from ossimImageHandler.

Definition at line 244 of file ossimImageHandlerMtAdaptor.cpp.

References ADAPTEE_ID_KW, ossimKeywordlist::add(), ossimId::getId(), ossimConnectableObject::getId(), m_adaptedHandler, ossimImageSource::saveState(), and ossimRefPtr< T >::valid().

245 {
246  if (!m_adaptedHandler.valid())
247  return false;
248 
249  // Skip the ossimImageHandler::saveState() since it is not necessary here:
250  ossimImageSource::saveState(kwl, prefix);
251 
252  kwl.add(prefix, ADAPTEE_ID_KW, m_adaptedHandler->getId().getId());
253 
254  return true;
255 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
bool valid() const
Definition: ossimRefPtr.h:75
ossim_int64 getId() const
Definition: ossimId.h:29
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
const ossimId & getId() const
Will allow us to get this object&#39;s id.
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
Method to save the state of an object to a keyword list.

◆ setAdaptee()

void ossimImageHandlerMtAdaptor::setAdaptee ( ossimImageHandler handler)

Sets the handler being adapted.

Definition at line 63 of file ossimImageHandlerMtAdaptor.cpp.

References ossimConnectableObject::changeOwner(), ossimConnectableObject::connectMyOutputTo(), d_cacheTileSize, d_fauxTile, d_useCache, d_useFauxTile, ossimConnectableObject::disconnectMyOutputs(), ossimImageData::dup(), ossimRefPtr< T >::get(), ossimConnectableObject::getOutputList(), ossimImageSource::getTile(), m_adaptedHandler, m_cache, and ossimCacheTileSource::setTileSize().

Referenced by ossimImageHandlerMtAdaptor().

64 {
65  m_adaptedHandler = handler;
66  if (handler == NULL)
67  return;
68 
69  // Fetch the adaptee's output list and make it our own:
70  ConnectableObjectList output_list = handler->getOutputList();
71 
72  if (d_useCache)
73  {
74  // Create the cache and connect this adaptor as its output:
77  m_cache->connectMyOutputTo(this, true, false);
78  m_cache->changeOwner(this);
79  //m_cache->connectMyOutputTo(this, true, false);
80  handler->disconnectMyOutputs(output_list, true, false);
81  handler->connectMyOutputTo(m_cache.get(), true, true);
82  }
83  else
84  {
85  handler->disconnectMyOutputs(output_list, true, false);
86  handler->connectMyOutputTo(this, true, false);
87  }
88 
89  // Finally connect the adaptee's outputs to this and fire connection events:
90  connectMyOutputTo(output_list, true, true);
91  handler->changeOwner(this);
92 
93  if (d_useFauxTile)
94  {
95  d_fauxTile = (ossimImageData*) handler->getTile(ossimIpt(0,0), 0)->dup();
96  //d_fauxTile = new ossimImageData(this,
97  // handler->getOutputScalarType(),
98  // handler->getNumberOfOutputBands(),
99  // handler->getTileWidth(),
100  // handler->getTileHeight());
101  //d_fauxTile->fill(128.0);
102  }
103 }
ossimRefPtr< ossimImageHandler > m_adaptedHandler
virtual ossimObject * dup() const
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
virtual void changeOwner(ossimObject *owner)
Permits changing the object&#39;s owner.
Cache Tile Source.
void setTileSize(const ossimIpt &size)
Set the tile size.
const ConnectableObjectList & getOutputList() const
virtual ossim_int32 connectMyOutputTo(ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
Will try to connect this objects output to the passed in object.
ossimRefPtr< ossimCacheTileSource > m_cache
ossimRefPtr< ossimImageData > d_fauxTile
virtual void disconnectMyOutputs(ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
virtual ossimRefPtr< ossimImageData > getTile(const ossimIpt &origin, ossim_uint32 resLevel=0)

◆ setCacheTileSize()

void ossimImageHandlerMtAdaptor::setCacheTileSize ( ossim_uint32  cache_tile_size)

Definition at line 368 of file ossimImageHandlerMtAdaptor.cpp.

References d_cacheTileSize.

Referenced by ossimImageHandlerMtAdaptor().

369 {
370  d_cacheTileSize = cache_tile_size;
371 }

◆ setUseCache()

void ossimImageHandlerMtAdaptor::setUseCache ( bool  use_cache)

Definition at line 363 of file ossimImageHandlerMtAdaptor.cpp.

References d_useCache.

Referenced by ossimImageHandlerMtAdaptor().

364 {
365  d_useCache = use_cache;
366 }

◆ writeTime()

void ossimImageHandlerMtAdaptor::writeTime ( ) const

Definition at line 380 of file ossimImageHandlerMtAdaptor.cpp.

References ossim::getTime().

381 {
382 #if 0 /* not portable (drb) */
383  struct timeval tv;
384  struct timezone tz;
385  struct tm *tm;
386  gettimeofday(&tv, &tz);
387  tm=localtime(&tv.tv_sec);
388  printf("%d:%02d:%02d.%ld ", tm->tm_hour, tm->tm_min,tm->tm_sec,tv.tv_usec);
389 #endif
390  // Sorry no usecs...
391  time_t rawTime = (time_t)ossim::getTime();
392  char buf[9];
393  strftime(buf, 9, "%H:%M:%S", gmtime(&rawTime));
394  cerr << buf << std::endl;
395 }
OSSIM_DLL ossim_int64 getTime()
Gets the current time.

Friends And Related Function Documentation

◆ ossimMtDebug

friend class ossimMtDebug
friend

Definition at line 90 of file ossimImageHandlerMtAdaptor.h.

Referenced by ossimMtDebug::instance().

Member Data Documentation

◆ ADAPTEE_ID_KW

const char * ossimImageHandlerMtAdaptor::ADAPTEE_ID_KW = "adaptee_id"
static

Definition at line 23 of file ossimImageHandlerMtAdaptor.h.

Referenced by loadState(), and saveState().

◆ d_cacheTileSize

ossim_uint32 ossimImageHandlerMtAdaptor::d_cacheTileSize

Definition at line 77 of file ossimImageHandlerMtAdaptor.h.

Referenced by setAdaptee(), and setCacheTileSize().

◆ d_fauxTile

ossimRefPtr<ossimImageData> ossimImageHandlerMtAdaptor::d_fauxTile
protected

Definition at line 89 of file ossimImageHandlerMtAdaptor.h.

Referenced by close(), setAdaptee(), and ~ossimImageHandlerMtAdaptor().

◆ d_getTileT

double ossimImageHandlerMtAdaptor::d_getTileT

◆ d_useCache

bool ossimImageHandlerMtAdaptor::d_useCache
protected

Definition at line 87 of file ossimImageHandlerMtAdaptor.h.

Referenced by getTile(), setAdaptee(), and setUseCache().

◆ d_useFauxTile

bool ossimImageHandlerMtAdaptor::d_useFauxTile
protected

Definition at line 88 of file ossimImageHandlerMtAdaptor.h.

Referenced by setAdaptee().

◆ m_adaptedHandler

ossimRefPtr<ossimImageHandler> ossimImageHandlerMtAdaptor::m_adaptedHandler
protected

◆ m_cache

ossimRefPtr<ossimCacheTileSource> ossimImageHandlerMtAdaptor::m_cache
protected

◆ m_mutex

std::mutex ossimImageHandlerMtAdaptor::m_mutex
mutableprotected

Definition at line 85 of file ossimImageHandlerMtAdaptor.h.

Referenced by getTile().


The documentation for this class was generated from the following files: