TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/ofx/OfxhImageEffectNodeDescriptor.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_HOST_OFX_IMAGEEFFECTNODE_DESCRIPTOR_HPP_
00002 #define _TUTTLE_HOST_OFX_IMAGEEFFECTNODE_DESCRIPTOR_HPP_
00003 
00004 #include "OfxhImageEffectNodeBase.hpp"
00005 #include "attribute/OfxhClipImageDescriptor.hpp"
00006 #include "attribute/OfxhParamDescriptor.hpp"
00007 #include "attribute/OfxhParamSetDescriptor.hpp"
00008 #include "OfxhInteract.hpp"
00009 
00010 #include <boost/ptr_container/serialize_ptr_vector.hpp>
00011 
00012 namespace tuttle {
00013 namespace host {
00014 namespace ofx {
00015 namespace imageEffect {
00016 
00017 /**
00018  * an image effect plugin descriptor
00019  */
00020 class OfxhImageEffectNodeDescriptor
00021         : public OfxhImageEffectNodeBase
00022         , public attribute::OfxhParamSetDescriptor
00023         , private boost::noncopyable
00024 {
00025 public:
00026         typedef OfxhImageEffectNodeDescriptor This;
00027         typedef std::map<std::string, attribute::OfxhClipImageDescriptor*> ClipImageDescriptorMap;
00028         typedef boost::ptr_vector<attribute::OfxhClipImageDescriptor> ClipImageDescriptorVector;
00029 
00030 protected:
00031         OfxhPlugin* _plugin;      ///< the plugin I belong to
00032         ClipImageDescriptorMap _clips;        ///< clips descriptors by name
00033         ClipImageDescriptorVector _clipsByOrder; ///< clip descriptors in order of declaration
00034         mutable interact::OfxhInteractDescriptor _overlayDescriptor; ///< descriptor to use for overlays, it has delayed description @todo tuttle: remove mutable
00035 
00036 private:
00037         // private CC
00038         OfxhImageEffectNodeDescriptor( const OfxhImageEffectNodeDescriptor& other )
00039                 : OfxhImageEffectNodeBase( other._properties )
00040                 , _plugin( other._plugin )
00041         {}
00042 
00043         OfxhImageEffectNodeDescriptor();
00044 
00045 public:
00046         /// used to construct the global description
00047         OfxhImageEffectNodeDescriptor( OfxhPlugin& plug );
00048 
00049         /// used to construct a context description, 'other' is the main context
00050         OfxhImageEffectNodeDescriptor( const OfxhImageEffectNodeDescriptor& rootContext, OfxhPlugin& plug );
00051 
00052         /// used to construct populate the cache
00053         OfxhImageEffectNodeDescriptor( const std::string& bundlePath, OfxhPlugin& plug );
00054 
00055         /// dtor
00056         virtual ~OfxhImageEffectNodeDescriptor();
00057 
00058         bool operator==( const This& other ) const;
00059         bool operator!=( const This& other ) const { return !This::operator==( other ); }
00060 
00061         /// implemented for ParamDescriptorSet
00062         property::OfxhSet& getParamSetProps()
00063         {
00064                 return _properties;
00065         }
00066 
00067         /// get the plugin I belong to
00068         OfxhPlugin& getPlugin() const { return *_plugin; }
00069 
00070         /// create a new clip and add this to the clip map
00071         virtual attribute::OfxhClipImageDescriptor* defineClip( const std::string& name );
00072 
00073         /// get the clips
00074         const ClipImageDescriptorMap& getClips() const { return _clips; }
00075 
00076         /// add a new clip
00077         void addClip( const std::string& name, attribute::OfxhClipImageDescriptor* clip );
00078 
00079         /// get the clips in order of construction
00080         const ClipImageDescriptorVector& getClipsByOrder() const { return _clipsByOrder; }
00081 
00082         /// get the clips in order of construction
00083         ClipImageDescriptorVector& getClipsByOrder() { return _clipsByOrder; }
00084 
00085         /**
00086          * @todo tuttle some modifs here... doc needs updates...
00087          * Get the interact description, this will also call describe on the interact
00088          * This will return NULL if there is not main entry point or if the description failed
00089          * otherwise it will return the described overlay
00090          */
00091         const interact::OfxhInteractDescriptor& getOverlayDescriptor() const { return _overlayDescriptor; }
00092 
00093         void initOverlayDescriptor( int bitDepthPerComponent = 8, bool hasAlpha = false );
00094 
00095 private:
00096         friend class boost::serialization::access;
00097         template<class Archive>
00098         void serialize( Archive& ar, const unsigned int version )
00099         {
00100                 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP( OfxhImageEffectNodeBase );
00101                 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP( OfxhParamSetDescriptor );
00102                 ar& BOOST_SERIALIZATION_NVP( _clipsByOrder );
00103         }
00104 
00105 };
00106 
00107 }
00108 }
00109 }
00110 }
00111 
00112 #endif
00113