text: //////////////////////////////////////////////////////////////////////////
  //
  //  Copyright (c) 2012, John Haddon. All rights reserved.
  //  Copyright (c) 2012-2015, Image Engine Design Inc. All rights reserved.
  //
  //  Redistribution and use in source and binary forms, with or without
  //  modification, are permitted provided that the following conditions are
  //  met:
  //
  //      * Redistributions of source code must retain the above
  //        copyright notice, this list of conditions and the following
  //        disclaimer.
  //
  //      * Redistributions in binary form must reproduce the above
  //        copyright notice, this list of conditions and the following
  //        disclaimer in the documentation and/or other materials provided with
  //        the distribution.
  //
  //      * Neither the name of John Haddon nor the names of
  //        any other contributors to this software may be used to endorse or
  //        promote products derived from this software without specific prior
  //        written permission.
  //
  //  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
  //  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  //  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  //  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  //  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  //  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  //  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  //  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  //  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  //  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  //  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  //
  //////////////////////////////////////////////////////////////////////////
  
  #ifndef GAFFERIMAGE_OPENIMAGEIOREADER_H
  #define GAFFERIMAGE_OPENIMAGEIOREADER_H
  
  #include "Gaffer/NumericPlug.h"
  
  #include "GafferImage/ImageNode.h"
  
  namespace Gaffer
  {
  
  IE_CORE_FORWARDDECLARE( StringPlug )
  
  } // namespace Gaffer
  
  namespace GafferImage
  {
  
  class OpenImageIOReader : public ImageNode
  {
  
  	public :
  
  		OpenImageIOReader( const std::string &name=defaultName<OpenImageIOReader>() );
  		virtual ~OpenImageIOReader();
  
  		IE_CORE_DECLARERUNTIMETYPEDEXTENSION( GafferImage::OpenImageIOReader, OpenImageIOReaderTypeId, ImageNode );
  
  		enum MissingFrameMode
  		{
  			Error = 0,
  			Black,
  			Hold,
  		};
  
  		Gaffer::StringPlug *fileNamePlug();
  		const Gaffer::StringPlug *fileNamePlug() const;
  
  		/// Number of times the node has been refreshed.
  		Gaffer::IntPlug *refreshCountPlug();
  		const Gaffer::IntPlug *refreshCountPlug() const;
  
  		Gaffer::IntPlug *missingFrameModePlug();
  		const Gaffer::IntPlug *missingFrameModePlug() const;
  
  		Gaffer::IntVectorDataPlug *availableFramesPlug();
  		const Gaffer::IntVectorDataPlug *availableFramesPlug() const;
  
  		virtual void affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const;
  
  		static size_t supportedExtensions( std::vector<std::string> &extensions );
  
  		/// Returns the maximum amount of memory in Mb to use for the cache.
  		static size_t getCacheMemoryLimit();
  		/// Sets the maximum amount of memory the cache may use in Mb.
  		static void setCacheMemoryLimit( size_t mb );
  
  	protected :
  
  		virtual void hash( const Gaffer::ValuePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const;
  		virtual void compute( Gaffer::ValuePlug *output, const Gaffer::Context *context ) const;
  
  		virtual void hashFormat( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const;
  		virtual void hashDataWindow( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const;
  		virtual void hashMetadata( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const;
  		virtual void hashChannelNames( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const;
  		virtual void hashChannelData( const GafferImage::ImagePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const;
  
  		virtual GafferImage::Format computeFormat( const Gaffer::Context *context, const ImagePlug *parent ) const;
  		virtual Imath::Box2i computeDataWindow( const Gaffer::Context *context, const ImagePlug *parent ) const;
  		virtual IECore::ConstCompoundObjectPtr computeMetadata( const Gaffer::Context *context, const ImagePlug *parent ) const;
  		virtual IECore::ConstStringVectorDataPtr computeChannelNames( const Gaffer::Context *context, const ImagePlug *parent ) const;
  		virtual IECore::ConstFloatVectorDataPtr computeChannelData( const std::string &channelName, const Imath::V2i &tileOrigin, const Gaffer::Context *context, const ImagePlug *parent ) const;
  
  	private :
  
  		void hashFileName( const Gaffer::Context *context, IECore::MurmurHash &h ) const;
  
  		void plugSet( Gaffer::Plug *plug );
  
  		static size_t g_firstPlugIndex;
  
  };
  
  IE_CORE_DECLAREPTR( OpenImageIOReader )
  
  } // namespace GafferImage
  
  #endif // GAFFERIMAGE_OPENIMAGEIOREADER_H
  