TuttleOFX
1
|
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 int _built; 00036 00037 private: 00038 // private CC 00039 OfxhImageEffectNodeDescriptor( const OfxhImageEffectNodeDescriptor& other ) 00040 : OfxhImageEffectNodeBase( other._properties ) 00041 , _plugin( other._plugin ) 00042 {} 00043 00044 OfxhImageEffectNodeDescriptor(); 00045 00046 public: 00047 /// used to construct the global description 00048 OfxhImageEffectNodeDescriptor( OfxhPlugin& plug ); 00049 00050 /// used to construct a context description, 'other' is the main context 00051 OfxhImageEffectNodeDescriptor( const OfxhImageEffectNodeDescriptor& rootContext, OfxhPlugin& plug ); 00052 00053 /// used to construct populate the cache 00054 OfxhImageEffectNodeDescriptor( const std::string& bundlePath, OfxhPlugin& plug ); 00055 00056 /// dtor 00057 virtual ~OfxhImageEffectNodeDescriptor(); 00058 00059 bool operator==( const This& other ) const; 00060 bool operator!=( const This& other ) const { return !This::operator==( other ); } 00061 00062 /// implemented for ParamDescriptorSet 00063 property::OfxhSet& getParamSetProps() 00064 { 00065 return _properties; 00066 } 00067 00068 /// get the plugin I belong to 00069 OfxhPlugin& getPlugin() const { return *_plugin; } 00070 00071 /// create a new clip and add this to the clip map 00072 virtual attribute::OfxhClipImageDescriptor* defineClip( const std::string& name ); 00073 00074 /// get the clips 00075 const ClipImageDescriptorMap& getClips() const { return _clips; } 00076 00077 /// add a new clip 00078 void addClip( const std::string& name, attribute::OfxhClipImageDescriptor* clip ); 00079 00080 /// get the clips in order of construction 00081 const ClipImageDescriptorVector& getClipsByOrder() const { return _clipsByOrder; } 00082 00083 /// get the clips in order of construction 00084 ClipImageDescriptorVector& getClipsByOrder() { return _clipsByOrder; } 00085 00086 /** 00087 * @todo tuttle some modifs here... doc needs updates... 00088 * Get the interact description, this will also call describe on the interact 00089 * This will return NULL if there is not main entry point or if the description failed 00090 * otherwise it will return the described overlay 00091 */ 00092 const interact::OfxhInteractDescriptor& getOverlayDescriptor() const { return _overlayDescriptor; } 00093 00094 void initOverlayDescriptor( int bitDepthPerComponent = 8, bool hasAlpha = false ); 00095 00096 private: 00097 friend class boost::serialization::access; 00098 template<class Archive> 00099 void serialize( Archive& ar, const unsigned int version ) 00100 { 00101 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP( OfxhImageEffectNodeBase ); 00102 ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP( OfxhParamSetDescriptor ); 00103 ar& BOOST_SERIALIZATION_NVP( _clipsByOrder ); 00104 } 00105 00106 }; 00107 00108 } 00109 } 00110 } 00111 } 00112 00113 #endif 00114