[Hdrflow-svn] SF.net SVN: hdrflow: [112] lib/openlibraries/src
Status: Pre-Alpha
Brought to you by:
glslang
|
From: <gl...@us...> - 2007-05-03 23:00:02
|
Revision: 112
http://hdrflow.svn.sourceforge.net/hdrflow/?rev=112&view=rev
Author: glslang
Date: 2007-05-03 16:00:00 -0700 (Thu, 03 May 2007)
Log Message:
-----------
+ OFX bindings continued
Modified Paths:
--------------
lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
lib/openlibraries/src/openpluginlib/pl/pcos/property.cpp
lib/openlibraries/src/openpluginlib/pl/pcos/property.hpp
Modified: lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp
===================================================================
--- lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-01 22:40:09 UTC (rev 111)
+++ lib/openlibraries/src/openmedialib/plugins/ofx/ofx_plugin.cpp 2007-05-03 23:00:00 UTC (rev 112)
@@ -38,8 +38,6 @@
namespace
{
- typedef pcos::property_container* property_container_ptr;
-
void set_property_suite( OfxPropertySuiteV1& );
void set_image_effect_suite( OfxImageEffectSuiteV1& );
void set_parameter_suite( OfxParameterSuiteV1& );
@@ -48,6 +46,14 @@
void set_interact_suite( OfxInteractSuiteV1& );
void set_message_suite( OfxMessageSuiteV1& );
+ // typedefs
+ typedef pcos::property_container* property_container_ptr;
+
+ // forward declaration
+ class param;
+ class param_set;
+ class clip_instance;
+
struct Ofx_base
{
virtual ~Ofx_base( ) { }
@@ -75,8 +81,8 @@
set_param_descriptor_properties( );
}
- virtual property_container_ptr get_property_set( )
- { return ¶m_descriptor_props_; }
+ virtual property_container_ptr get_property_set( ) { return ¶m_descriptor_props_; }
+ virtual param* create_instance( ) = 0;
private:
void set_param_descriptor_properties( )
@@ -162,6 +168,8 @@
{
set_string_param_descriptor_properties( );
}
+
+ virtual param* create_instance( );
private:
void set_string_param_descriptor_properties( )
@@ -192,6 +200,8 @@
set_int_param_descriptor_properties( );
}
+ virtual param* create_instance( );
+
private:
void set_int_param_descriptor_properties( )
{
@@ -225,6 +235,8 @@
{
set_int2D_param_descriptor_properties( );
}
+
+ virtual param* create_instance( );
private:
void set_int2D_param_descriptor_properties( )
@@ -261,6 +273,8 @@
{
set_int3D_param_descriptor_properties( );
}
+
+ virtual param* create_instance( );
private:
void set_int3D_param_descriptor_properties( )
@@ -326,6 +340,8 @@
{
set_double_param_descriptor_properties( );
}
+
+ virtual param* create_instance( );
private:
void set_double_param_descriptor_properties( )
@@ -369,6 +385,8 @@
param_props_->append( double2D_param_descriptor_param_prop_display_max_ = pcos::double_vec( 2, ( std::numeric_limits<double>::max )( ) ) );
param_props_->append( double2D_param_descriptor_param_prop_dimension_label_ = pl::string_vec( 2 ) );
}
+
+ virtual param* create_instance( );
private:
pcos::property double2D_param_descriptor_param_prop_min_;
@@ -390,6 +408,8 @@
{
set_double3D_param_descriptor_properties( );
}
+
+ virtual param* create_instance( );
private:
void set_double3D_param_descriptor_properties( )
@@ -416,6 +436,8 @@
public:
explicit rgb_param_descriptor( )
{ }
+
+ virtual param* create_instance( );
};
class rgba_param_descriptor : public value_param_descriptor
@@ -423,6 +445,8 @@
public:
explicit rgba_param_descriptor( )
{ }
+
+ virtual param* create_instance( );
};
class boolean_param_descriptor : public value_param_descriptor
@@ -433,6 +457,8 @@
{
set_boolean_param_descriptor_properties( );
}
+
+ virtual param* create_instance( );
private:
void set_boolean_param_descriptor_properties( )
@@ -451,6 +477,8 @@
public:
explicit choice_param_descriptor( )
{ }
+
+ virtual param* create_instance( );
};
class group_param_descriptor : public value_param_descriptor
@@ -458,13 +486,34 @@
public:
explicit group_param_descriptor( )
{ }
+
+ virtual param* create_instance( );
};
class page_param_descriptor : public value_param_descriptor
{
public:
explicit page_param_descriptor( )
- { }
+ : page_param_descriptor_param_prop_type_( pcos::key::from_string( kOfxParamPropType ) )
+ , page_param_descriptor_param_prop_child_( pcos::key::from_string( kOfxParamPropPageChild ) )
+ {
+ set_page_param_descriptor_properties( );
+ }
+
+ virtual param* create_instance( );
+
+ private:
+ void set_page_param_descriptor_properties( )
+ {
+ property_container_ptr param_props_ = get_property_set( );
+
+ param_props_->append( page_param_descriptor_param_prop_type_ = pl::string( kOfxParamTypePage ) );
+ param_props_->append( page_param_descriptor_param_prop_child_ = pl::string_vec( ) );
+ }
+
+ private:
+ pcos::property page_param_descriptor_param_prop_type_;
+ pcos::property page_param_descriptor_param_prop_child_;
};
class push_button_param_descriptor : public value_param_descriptor
@@ -472,6 +521,8 @@
public:
explicit push_button_param_descriptor( )
{ }
+
+ virtual param* create_instance( );
};
class custom_param_descriptor : public value_param_descriptor
@@ -479,6 +530,8 @@
public:
explicit custom_param_descriptor( )
{ }
+
+ virtual param* create_instance( );
};
class param_set_base : public Ofx_base
@@ -498,108 +551,30 @@
#else
typedef std::map<key_type, param_descriptor_ptr> container;
#endif
+ typedef container::const_iterator const_iterator;
public:
explicit param_set_descriptor( )
{ }
- OfxStatus define( const pl::string& param_type, const pl::string& name )
- {
- typedef container::const_iterator const_iterator;
-
- const_iterator I;
- if( ( I = params_.find( name ) ) == params_.end( ) )
- {
- if( param_type == kOfxParamTypeInteger )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new int_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeInteger2D )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new int2D_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeInteger3D )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new int3D_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeDouble )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new double_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeDouble2D )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new double2D_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeDouble3D )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new double3D_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeRGB )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new rgb_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeRGBA )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new rgba_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeBoolean )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new boolean_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeChoice )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new choice_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeGroup )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new group_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypePage )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new page_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeCustom )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new custom_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypePushButton )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new push_button_param_descriptor( ) ) ) );
- }
- else if( param_type == kOfxParamTypeString )
- {
- params_.insert( container::value_type( name, param_descriptor_ptr( new string_param_descriptor( ) ) ) );
- }
- }
- else
- {
- // parameter already exists. if the type is the same return success. otherwise flag as an error.
- }
-
- return kOfxStatOK;
- }
+ OfxStatus define( const pl::string& param_type, const pl::string& name );
property_container_ptr find_property_set( const pl::string& name )
{
- typedef container::const_iterator const_iterator;
-
const_iterator I;
if( ( I = params_.find( name ) ) != params_.end( ) )
return I->second->get_property_set( );
-
return 0;
}
- virtual property_container_ptr get_property_set( )
- {
- return ¶m_set_descriptor_props_;
- }
+ virtual property_container_ptr get_property_set( ) { return ¶m_set_descriptor_props_; }
+ virtual OfxParamSetHandle get_param_set( ) { return ( OfxParamSetHandle ) this; }
- virtual OfxParamSetHandle get_param_set( )
- {
- return ( OfxParamSetHandle ) this;
- }
+ const_iterator begin( ) const { return params_.begin( ); }
+ const_iterator end( ) const { return params_.end( ); }
+ virtual param_set* create_instance( );
+
private:
container params_;
pcos::property_container param_set_descriptor_props_;
@@ -608,13 +583,12 @@
class param : public Ofx_base
{
public:
- explicit param( )
+ explicit param( param_descriptor& vpd )
: param_prop_type_( pcos::key::from_string( kOfxPropType ) )
, param_prop_name_( pcos::key::from_string( kOfxPropName ) )
, param_prop_label_( pcos::key::from_string( kOfxPropLabel ) )
, param_prop_short_label_( pcos::key::from_string( kOfxPropShortLabel ) )
, param_prop_long_label_( pcos::key::from_string( kOfxPropLongLabel ) )
- , param_prop_param_prop_type_( pcos::key::from_string( kOfxParamPropType ) )
, param_prop_param_prop_secret_( pcos::key::from_string( kOfxParamPropSecret ) )
, param_prop_param_prop_can_undo_( pcos::key::from_string( kOfxParamPropCanUndo ) )
, param_prop_param_prop_hint_( pcos::key::from_string( kOfxParamPropHint ) )
@@ -623,31 +597,47 @@
, param_prop_param_prop_enabled_( pcos::key::from_string( kOfxParamPropEnabled ) )
, param_prop_param_prop_data_ptr_( pcos::key::from_string( kOfxParamPropDataPtr ) )
{
- set_param_properties( );
+ set_param_properties( vpd );
}
- virtual property_container_ptr get_property_set( )
- { return ¶m_props_; }
-
- virtual pcos::property get_value( ) = 0;
- virtual pl::string get_type( ) = 0;
+ virtual property_container_ptr get_property_set( ) { return ¶m_props_; }
+ virtual pcos::property get_value( ) = 0;
+ virtual pl::string get_type( ) = 0;
private:
- void set_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_param_properties( param_descriptor& vpd )
{
- param_props_.append( param_prop_type_ = pl::string( kOfxTypeParameter ) );
- param_props_.append( param_prop_name_ = pl::string( ) );
- param_props_.append( param_prop_label_ = pl::string( ) );
- param_props_.append( param_prop_short_label_ = pl::string( ) );
- param_props_.append( param_prop_long_label_ = pl::string( ) );
- param_props_.append( param_prop_name_ = pl::string( ) );
- param_props_.append( param_prop_param_prop_secret_ = 0 );
- param_props_.append( param_prop_param_prop_can_undo_ = 1 );
- param_props_.append( param_prop_param_prop_hint_ = pl::string( ) );
- param_props_.append( param_prop_param_prop_script_name_ = pl::string( ) );
- param_props_.append( param_prop_param_prop_parent_ = pl::string( ) );
- param_props_.append( param_prop_param_prop_enabled_ = 1 );
- param_props_.append( param_prop_param_prop_data_ptr_ = ( void* ) 0 );
+ property_container_ptr vpd_set = vpd.get_property_set( );
+
+ pl::string type = vpd_set->get_property_with_key( pcos::key::from_string( kOfxPropType ) ).value<pl::string>( );
+ pl::string name = vpd_set->get_property_with_key( pcos::key::from_string( kOfxPropName ) ).value<pl::string>( );
+ pl::string label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxPropLabel ) ).value<pl::string>( );
+ pl::string short_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxPropShortLabel ) ).value<pl::string>( );
+ pl::string long_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxPropLongLabel ) ).value<pl::string>( );
+ int secret = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropSecret ) ).value<int>( );
+ int can_undo = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropCanUndo ) ).value<int>( );
+ pl::string hint = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropHint ) ).value<pl::string>( );
+ pl::string script_name = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropScriptName ) ).value<pl::string>( );
+ pl::string parent = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropParent ) ).value<pl::string>( );
+ int enabled = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropEnabled ) ).value<int>( );
+ void* data_ptr = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDataPtr ) ).value<void*>( );
+
+ param_props_.append( param_prop_type_ = type );
+ param_props_.append( param_prop_name_ = name );
+ param_props_.append( param_prop_label_ = label );
+ param_props_.append( param_prop_short_label_ = short_label );
+ param_props_.append( param_prop_long_label_ = long_label );
+ param_props_.append( param_prop_param_prop_secret_ = secret );
+ param_props_.append( param_prop_param_prop_can_undo_ = can_undo );
+ param_props_.append( param_prop_param_prop_hint_ = hint );
+ param_props_.append( param_prop_param_prop_script_name_ = script_name );
+ param_props_.append( param_prop_param_prop_parent_ = parent );
+ param_props_.append( param_prop_param_prop_enabled_ = enabled );
+ param_props_.append( param_prop_param_prop_data_ptr_ = data_ptr );
}
private:
@@ -657,7 +647,6 @@
pcos::property param_prop_label_;
pcos::property param_prop_short_label_;
pcos::property param_prop_long_label_;
- pcos::property param_prop_param_prop_type_;
pcos::property param_prop_param_prop_secret_;
pcos::property param_prop_param_prop_can_undo_;
pcos::property param_prop_param_prop_hint_;
@@ -670,8 +659,9 @@
class value_param : public param
{
public:
- explicit value_param( )
- : value_param_prop_animates_( pcos::key::from_string( kOfxParamPropAnimates ) )
+ explicit value_param( value_param_descriptor& vpd )
+ : param( vpd )
+ , value_param_prop_animates_( pcos::key::from_string( kOfxParamPropAnimates ) )
, value_param_prop_is_animating_( pcos::key::from_string( kOfxParamPropIsAnimating ) )
, value_param_prop_is_auto_keying_( pcos::key::from_string( kOfxParamPropIsAutoKeying ) )
, value_param_prop_persistant_( pcos::key::from_string( kOfxParamPropPersistant ) )
@@ -679,21 +669,35 @@
, value_param_prop_plugin_may_write_( pcos::key::from_string( kOfxParamPropPluginMayWrite ) )
, value_param_prop_cache_invalidation_( pcos::key::from_string( kOfxParamPropCacheInvalidation ) )
{
- set_value_param_properties( );
+ set_value_param_properties( vpd );
}
private:
- void set_value_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_value_param_properties( value_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( value_param_prop_animates_ = 1 );
- param_props_->append( value_param_prop_is_animating_ = 0 );
- param_props_->append( value_param_prop_is_auto_keying_ = 0 );
- param_props_->append( value_param_prop_persistant_ = 1 );
- param_props_->append( value_param_prop_evaluate_on_change_ = 1 );
- param_props_->append( value_param_prop_plugin_may_write_ = 0 );
- param_props_->append( value_param_prop_cache_invalidation_ = pl::string( kOfxParamInvalidateValueChange ) );
+ int animates = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropAnimates ) ).value<int>( );
+ int is_animating = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropIsAnimating ) ).value<int>( );
+ int is_auto_keying = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropIsAutoKeying ) ).value<int>( );
+ int persistant = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropPersistant ) ).value<int>( );
+ int evaluate_on_change = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropEvaluateOnChange ) ).value<int>( );
+ int may_write = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropPluginMayWrite ) ).value<int>( );
+ pl::string cache_invalidation = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropCacheInvalidation ) ).value<pl::string>( );
+
+ param_props_->append( value_param_prop_animates_ = animates );
+ param_props_->append( value_param_prop_is_animating_ = is_animating );
+ param_props_->append( value_param_prop_is_auto_keying_ = is_auto_keying );
+ param_props_->append( value_param_prop_persistant_ = persistant );
+ param_props_->append( value_param_prop_evaluate_on_change_ = evaluate_on_change );
+ param_props_->append( value_param_prop_plugin_may_write_ = may_write );
+ param_props_->append( value_param_prop_cache_invalidation_ = cache_invalidation );
}
private:
@@ -709,34 +713,38 @@
class string_param : public value_param
{
public:
- explicit string_param( )
- : string_param_value_( pcos::key::from_string( "value" ) )
+ explicit string_param( string_param_descriptor& vpd )
+ : value_param( vpd )
+ , string_param_value_( pcos::key::from_string( "value" ) )
, string_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
, string_param_prop_string_mode_( pcos::key::from_string( kOfxParamPropStringMode ) )
, string_param_prop_string_file_path_exists_( pcos::key::from_string( kOfxParamPropStringFilePathExists ) )
{
- set_string_param_properties( );
+ set_string_param_properties( vpd );
}
- virtual pcos::property get_value( )
- {
- return string_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypeString;
- }
+ virtual pcos::property get_value( ) { return string_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeString; }
private:
- void set_string_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_string_param_properties( string_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( string_param_value_ = pl::string( ) );
- param_props_->append( string_param_prop_default_ = pl::string( ) );
- param_props_->append( string_param_prop_string_mode_ = pl::string( kOfxParamStringIsSingleLine ) );
- param_props_->append( string_param_prop_string_file_path_exists_ = 1 );
+ pl::string def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<pl::string>( );
+ pl::string mode = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropStringMode ) ).value<pl::string>( );
+ int file_path_exists = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropStringFilePathExists ) ).value<int>( );
+
+ param_props_->append( string_param_value_ = def );
+ param_props_->append( string_param_prop_default_ = def );
+ param_props_->append( string_param_prop_string_mode_ = mode );
+ param_props_->append( string_param_prop_string_file_path_exists_ = file_path_exists );
}
private:
@@ -749,38 +757,44 @@
class int_param : public value_param
{
public:
- explicit int_param( )
- : int_param_value_( pcos::key::from_string( "value" ) )
+ explicit int_param( int_param_descriptor& vpd )
+ : value_param( vpd )
+ , int_param_value_( pcos::key::from_string( "value" ) )
, int_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
, int_param_prop_min_( pcos::key::from_string( kOfxParamPropMin ) )
, int_param_prop_max_( pcos::key::from_string( kOfxParamPropMax ) )
, int_param_prop_display_min_( pcos::key::from_string( kOfxParamPropDisplayMin ) )
, int_param_prop_display_max_( pcos::key::from_string( kOfxParamPropDisplayMax ) )
{
- set_int_param_properties( );
+ set_int_param_properties( vpd );
}
- virtual pcos::property get_value( )
- {
- return int_param_value_;
- }
+ virtual pcos::property get_value( ) { return int_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeInteger; }
- virtual pl::string get_type( )
- {
- return kOfxParamTypeInteger;
- }
-
private:
- void set_int_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_int_param_properties( int_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( int_param_value_ = 0 );
- param_props_->append( int_param_prop_default_ = 0 );
- param_props_->append( int_param_prop_min_ = ( std::numeric_limits<int>::min )( ) );
- param_props_->append( int_param_prop_max_ = ( std::numeric_limits<int>::max )( ) );
- param_props_->append( int_param_prop_display_min_ = ( std::numeric_limits<int>::min )( ) );
- param_props_->append( int_param_prop_display_max_ = ( std::numeric_limits<int>::max )( ) );
+ int def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<int>( );
+ int min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMin ) ).value<int>( );
+ int max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMax ) ).value<int>( );
+ int display_min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMin ) ).value<int>( );
+ int display_max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<int>( );
+
+ param_props_->append( int_param_value_ = def );
+ param_props_->append( int_param_prop_default_ = def );
+ param_props_->append( int_param_prop_min_ = min );
+ param_props_->append( int_param_prop_max_ = max );
+ param_props_->append( int_param_prop_display_min_ = display_min );
+ param_props_->append( int_param_prop_display_max_ = display_max );
}
private:
@@ -795,8 +809,9 @@
class int2D_param : public value_param
{
public:
- explicit int2D_param( )
- : int2D_param_value_( pcos::key::from_string( "value" ) )
+ explicit int2D_param( int2D_param_descriptor& vpd )
+ : value_param( vpd )
+ , int2D_param_value_( pcos::key::from_string( "value" ) )
, int2D_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
, int2D_param_prop_min_( pcos::key::from_string( kOfxParamPropMin ) )
, int2D_param_prop_max_( pcos::key::from_string( kOfxParamPropMax ) )
@@ -804,31 +819,37 @@
, int2D_param_prop_display_max_( pcos::key::from_string( kOfxParamPropDisplayMax ) )
, int2D_param_prop_dimension_label_( pcos::key::from_string( kOfxParamPropDimensionLabel ) )
{
- set_int2D_param_properties( );
+ set_int2D_param_properties( vpd );
}
- virtual pcos::property get_value( )
- {
- return int2D_param_value_;
- }
+ virtual pcos::property get_value( ) { return int2D_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeInteger2D; }
- virtual pl::string get_type( )
- {
- return kOfxParamTypeInteger2D;
- }
-
private:
- void set_int2D_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_int2D_param_properties( int2D_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( int2D_param_value_ = pcos::int_vec( 2, 0 ) );
- param_props_->append( int2D_param_prop_default_ = pcos::int_vec( 2, 0 ) );
- param_props_->append( int2D_param_prop_min_ = pcos::int_vec( 2, ( std::numeric_limits<int>::min )( ) ) );
- param_props_->append( int2D_param_prop_max_ = pcos::int_vec( 2, ( std::numeric_limits<int>::max )( ) ) );
- param_props_->append( int2D_param_prop_display_min_ = pcos::int_vec( 2, ( std::numeric_limits<int>::min )( ) ) );
- param_props_->append( int2D_param_prop_display_max_ = pcos::int_vec( 2, ( std::numeric_limits<int>::max )( ) ) );
- param_props_->append( int2D_param_prop_dimension_label_ = pl::string_vec( 2 ) );
+ pcos::int_vec def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<pcos::int_vec>( );
+ pcos::int_vec min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMin ) ).value<pcos::int_vec>( );
+ pcos::int_vec max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMax ) ).value<pcos::int_vec>( );
+ pcos::int_vec display_min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMin ) ).value<pcos::int_vec>( );
+ pcos::int_vec display_max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pcos::int_vec>( );
+ pl::string_vec dimension_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDimensionLabel ) ).value<pl::string_vec>( );
+
+ param_props_->append( int2D_param_value_ = def );
+ param_props_->append( int2D_param_prop_default_ = def );
+ param_props_->append( int2D_param_prop_min_ = min );
+ param_props_->append( int2D_param_prop_max_ = max );
+ param_props_->append( int2D_param_prop_display_min_ = display_min );
+ param_props_->append( int2D_param_prop_display_max_ = display_max );
+ param_props_->append( int2D_param_prop_dimension_label_ = dimension_label );
}
private:
@@ -844,8 +865,9 @@
class int3D_param : public value_param
{
public:
- explicit int3D_param( )
- : int3D_param_value_( pcos::key::from_string( "value" ) )
+ explicit int3D_param( int3D_param_descriptor& vpd )
+ : value_param( vpd )
+ , int3D_param_value_( pcos::key::from_string( "value" ) )
, int3D_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
, int3D_param_prop_min_( pcos::key::from_string( kOfxParamPropMin ) )
, int3D_param_prop_max_( pcos::key::from_string( kOfxParamPropMax ) )
@@ -853,31 +875,37 @@
, int3D_param_prop_display_max_( pcos::key::from_string( kOfxParamPropDisplayMax ) )
, int3D_param_prop_dimension_label_( pcos::key::from_string( kOfxParamPropDimensionLabel ) )
{
- set_int3D_param_properties( );
+ set_int3D_param_properties( vpd );
}
- virtual pcos::property get_value( )
- {
- return int3D_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypeInteger3D;
- }
+ virtual pcos::property get_value( ) { return int3D_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeInteger3D; }
private:
- void set_int3D_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_int3D_param_properties( int3D_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( int3D_param_value_ = pcos::int_vec( 3, 0 ) );
- param_props_->append( int3D_param_prop_default_ = pcos::int_vec( 3, 0 ) );
- param_props_->append( int3D_param_prop_min_ = pcos::int_vec( 3, ( std::numeric_limits<int>::min )( ) ) );
- param_props_->append( int3D_param_prop_max_ = pcos::int_vec( 3, ( std::numeric_limits<int>::max )( ) ) );
- param_props_->append( int3D_param_prop_display_min_ = pcos::int_vec( 3, ( std::numeric_limits<int>::min )( ) ) );
- param_props_->append( int3D_param_prop_display_max_ = pcos::int_vec( 3, ( std::numeric_limits<int>::max )( ) ) );
- param_props_->append( int3D_param_prop_dimension_label_ = pl::string_vec( 3 ) );
+ pcos::int_vec def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<pcos::int_vec>( );
+ pcos::int_vec min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMin ) ).value<pcos::int_vec>( );
+ pcos::int_vec max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMax ) ).value<pcos::int_vec>( );
+ pcos::int_vec display_min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMin ) ).value<pcos::int_vec>( );
+ pcos::int_vec display_max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pcos::int_vec>( );
+ pl::string_vec dimension_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDimensionLabel ) ).value<pl::string_vec>( );
+
+ param_props_->append( int3D_param_value_ = def );
+ param_props_->append( int3D_param_prop_default_ = def );
+ param_props_->append( int3D_param_prop_min_ = min );
+ param_props_->append( int3D_param_prop_max_ = max );
+ param_props_->append( int3D_param_prop_display_min_ = display_min );
+ param_props_->append( int3D_param_prop_display_max_ = display_max );
+ param_props_->append( int3D_param_prop_dimension_label_ = dimension_label );
}
private:
@@ -893,28 +921,36 @@
class base_double_param : public value_param
{
public:
- explicit base_double_param( )
- : base_double_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
+ explicit base_double_param( base_double_param_descriptor& vpd )
+ : value_param( vpd )
, base_double_param_prop_increment_( pcos::key::from_string( kOfxParamPropIncrement ) )
, base_double_param_prop_digits_( pcos::key::from_string( kOfxParamPropDigits ) )
, base_double_param_prop_double_type_( pcos::key::from_string( kOfxParamPropDoubleType ) )
{
- set_base_double_param_properties( );
+ set_base_double_param_properties( vpd );
}
private:
- void set_base_double_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_base_double_param_properties( base_double_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( base_double_param_prop_default_ = 0.0 );
- param_props_->append( base_double_param_prop_increment_ = 1.0 );
- param_props_->append( base_double_param_prop_digits_ = 2 );
- param_props_->append( base_double_param_prop_double_type_ = pl::string( kOfxParamDoubleTypePlain ) );
+ double increment = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropIncrement ) ).value<double>( );
+ int digits = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDigits ) ).value<int>( );
+ pl::string double_type = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDoubleType ) ).value<pl::string>( );
+
+ param_props_->append( base_double_param_prop_increment_ = increment );
+ param_props_->append( base_double_param_prop_digits_ = digits );
+ param_props_->append( base_double_param_prop_double_type_ = double_type );
}
private:
- pcos::property base_double_param_prop_default_;
pcos::property base_double_param_prop_increment_;
pcos::property base_double_param_prop_digits_;
pcos::property base_double_param_prop_double_type_;
@@ -923,42 +959,52 @@
class double_param : public base_double_param
{
public:
- explicit double_param( )
- : double_param_value_( pcos::key::from_string( "value" ) )
+ explicit double_param( double_param_descriptor& vpd )
+ : base_double_param( vpd )
+ , double_param_value_( pcos::key::from_string( "value" ) )
+ , double_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
, double_param_prop_min_( pcos::key::from_string( kOfxParamPropMin ) )
, double_param_prop_max_( pcos::key::from_string( kOfxParamPropMax ) )
, double_param_prop_display_min_( pcos::key::from_string( kOfxParamPropDisplayMin ) )
, double_param_prop_display_max_( pcos::key::from_string( kOfxParamPropDisplayMax ) )
, double_param_prop_show_time_marker_( pcos::key::from_string( kOfxParamPropShowTimeMarker ) )
{
- set_double_param_properties( );
+ set_double_param_properties( vpd );
}
- virtual pcos::property get_value( )
- {
- return double_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypeDouble;
- }
+ virtual pcos::property get_value( ) { return double_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeDouble; }
private:
- void set_double_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_double_param_properties( double_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( double_param_value_ = 0.0 );
- param_props_->append( double_param_prop_min_ = ( std::numeric_limits<double>::min )( ) );
- param_props_->append( double_param_prop_max_ = ( std::numeric_limits<double>::max )( ) );
- param_props_->append( double_param_prop_display_min_ = ( std::numeric_limits<double>::min )( ) );
- param_props_->append( double_param_prop_display_max_ = ( std::numeric_limits<double>::max )( ) );
- param_props_->append( double_param_prop_show_time_marker_ = 0 );
+ double def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<double>( );
+ double min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMin ) ).value<double>( );
+ double max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMax ) ).value<double>( );
+ double display_min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMin ) ).value<double>( );
+ double display_max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<double>( );
+ int time_marker = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropShowTimeMarker ) ).value<int>( );
+
+ param_props_->append( double_param_value_ = def );
+ param_props_->append( double_param_prop_default_ = def );
+ param_props_->append( double_param_prop_min_ = min );
+ param_props_->append( double_param_prop_max_ = max );
+ param_props_->append( double_param_prop_display_min_ = display_min );
+ param_props_->append( double_param_prop_display_max_ = display_max );
+ param_props_->append( double_param_prop_show_time_marker_ = time_marker );
}
private:
pcos::property double_param_value_;
+ pcos::property double_param_prop_default_;
pcos::property double_param_prop_min_;
pcos::property double_param_prop_max_;
pcos::property double_param_prop_display_min_;
@@ -969,42 +1015,52 @@
class double2D_param : public base_double_param
{
public:
- explicit double2D_param( )
- : double2D_param_value_( pcos::key::from_string( "value" ) )
+ explicit double2D_param( double2D_param_descriptor& vpd )
+ : base_double_param( vpd )
+ , double2D_param_value_( pcos::key::from_string( "value" ) )
+ , double2D_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
, double2D_param_prop_min_( pcos::key::from_string( kOfxParamPropMin ) )
, double2D_param_prop_max_( pcos::key::from_string( kOfxParamPropMax ) )
, double2D_param_prop_display_min_( pcos::key::from_string( kOfxParamPropDisplayMin ) )
, double2D_param_prop_display_max_( pcos::key::from_string( kOfxParamPropDisplayMax ) )
, double2D_param_prop_dimension_label_( pcos::key::from_string( kOfxParamPropDimensionLabel ) )
{
- set_double2D_param_properties( );
+ set_double2D_param_properties( vpd );
}
- virtual pcos::property get_value( )
- {
- return double2D_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypeDouble2D;
- }
+ virtual pcos::property get_value( ) { return double2D_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeDouble2D; }
private:
- void set_double2D_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_double2D_param_properties( base_double_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( double2D_param_value_ = pcos::double_vec( 2, 0.0 ) );
- param_props_->append( double2D_param_prop_min_ = pcos::double_vec( 2, ( std::numeric_limits<double>::min )( ) ) );
- param_props_->append( double2D_param_prop_max_ = pcos::double_vec( 2, ( std::numeric_limits<double>::max )( ) ) );
- param_props_->append( double2D_param_prop_display_min_ = pcos::double_vec( 2, ( std::numeric_limits<double>::min )( ) ) );
- param_props_->append( double2D_param_prop_display_max_ = pcos::double_vec( 2, ( std::numeric_limits<double>::max )( ) ) );
- param_props_->append( double2D_param_prop_dimension_label_ = pl::string_vec( 2 ) );
+ pcos::double_vec def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<pcos::double_vec>( );
+ pcos::double_vec min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMin ) ).value<pcos::double_vec>( );
+ pcos::double_vec max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMax ) ).value<pcos::double_vec>( );
+ pcos::double_vec display_min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMin ) ).value<pcos::double_vec>( );
+ pcos::double_vec display_max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pcos::double_vec>( );
+ pl::string_vec dimension_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pl::string_vec>( );
+
+ param_props_->append( double2D_param_value_ = def );
+ param_props_->append( double2D_param_prop_default_ = def );
+ param_props_->append( double2D_param_prop_min_ = min );
+ param_props_->append( double2D_param_prop_max_ = max );
+ param_props_->append( double2D_param_prop_display_min_ = display_min );
+ param_props_->append( double2D_param_prop_display_max_ = display_max );
+ param_props_->append( double2D_param_prop_dimension_label_ = dimension_label );
}
private:
pcos::property double2D_param_value_;
+ pcos::property double2D_param_prop_default_;
pcos::property double2D_param_prop_min_;
pcos::property double2D_param_prop_max_;
pcos::property double2D_param_prop_display_min_;
@@ -1015,42 +1071,52 @@
class double3D_param : public base_double_param
{
public:
- explicit double3D_param( )
- : double3D_param_value_( pcos::key::from_string( "value" ) )
+ explicit double3D_param( double3D_param_descriptor& vpd )
+ : base_double_param( vpd )
+ , double3D_param_value_( pcos::key::from_string( "value" ) )
+ , double3D_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
, double3D_param_prop_min_( pcos::key::from_string( kOfxParamPropMin ) )
, double3D_param_prop_max_( pcos::key::from_string( kOfxParamPropMax ) )
, double3D_param_prop_display_min_( pcos::key::from_string( kOfxParamPropDisplayMin ) )
, double3D_param_prop_display_max_( pcos::key::from_string( kOfxParamPropDisplayMax ) )
, double3D_param_prop_dimension_label_( pcos::key::from_string( kOfxParamPropDimensionLabel ) )
{
- set_double3D_param_properties( );
+ set_double3D_param_properties( vpd );
}
- virtual pcos::property get_value( )
- {
- return double3D_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypeDouble3D;
- }
+ virtual pcos::property get_value( ) { return double3D_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeDouble3D; }
private:
- void set_double3D_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_double3D_param_properties( double3D_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( double3D_param_value_ = pcos::double_vec( 3, 0.0 ) );
- param_props_->append( double3D_param_prop_min_ = pcos::double_vec( 3, ( std::numeric_limits<double>::min )( ) ) );
- param_props_->append( double3D_param_prop_max_ = pcos::double_vec( 3, ( std::numeric_limits<double>::max )( ) ) );
- param_props_->append( double3D_param_prop_display_min_ = pcos::double_vec( 3, ( std::numeric_limits<double>::min )( ) ) );
- param_props_->append( double3D_param_prop_display_max_ = pcos::double_vec( 3, ( std::numeric_limits<double>::max )( ) ) );
- param_props_->append( double3D_param_prop_dimension_label_ = pl::string_vec( 3 ) );
+ pcos::double_vec def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<pcos::double_vec>( );
+ pcos::double_vec min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMin ) ).value<pcos::double_vec>( );
+ pcos::double_vec max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropMax ) ).value<pcos::double_vec>( );
+ pcos::double_vec display_min = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMin ) ).value<pcos::double_vec>( );
+ pcos::double_vec display_max = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pcos::double_vec>( );
+ pl::string_vec dimension_label = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDisplayMax ) ).value<pl::string_vec>( );
+
+ param_props_->append( double3D_param_value_ = def );
+ param_props_->append( double3D_param_prop_default_ = def );
+ param_props_->append( double3D_param_prop_min_ = min );
+ param_props_->append( double3D_param_prop_max_ = max );
+ param_props_->append( double3D_param_prop_display_min_ = display_min );
+ param_props_->append( double3D_param_prop_display_max_ = display_max );
+ param_props_->append( double3D_param_prop_dimension_label_ = dimension_label );
}
private:
pcos::property double3D_param_value_;
+ pcos::property double3D_param_prop_default_;
pcos::property double3D_param_prop_min_;
pcos::property double3D_param_prop_max_;
pcos::property double3D_param_prop_display_min_;
@@ -1061,20 +1127,14 @@
class rgb_param : public value_param
{
public:
- explicit rgb_param( )
- : rgb_param_value_( pcos::key::from_string( "value" ) )
+ explicit rgb_param( rgb_param_descriptor& vpd )
+ : value_param( vpd )
+ , rgb_param_value_( pcos::key::from_string( "value" ) )
{ }
- virtual pcos::property get_value( )
- {
- return rgb_param_value_;
- }
+ virtual pcos::property get_value( ) { return rgb_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeRGB; }
- virtual pl::string get_type( )
- {
- return kOfxParamTypeRGB;
- }
-
private:
pcos::property rgb_param_value_;
};
@@ -1082,19 +1142,13 @@
class rgba_param : public value_param
{
public:
- explicit rgba_param( )
- : rgba_param_value_( pcos::key::from_string( "value" ) )
+ explicit rgba_param( rgba_param_descriptor& vpd )
+ : value_param( vpd )
+ , rgba_param_value_( pcos::key::from_string( "value" ) )
{ }
- virtual pcos::property get_value( )
- {
- return rgba_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypeRGBA;
- }
+ virtual pcos::property get_value( ) { return rgba_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeRGBA; }
private:
pcos::property rgba_param_value_;
@@ -1103,30 +1157,32 @@
class boolean_param : public value_param
{
public:
- explicit boolean_param( )
- : boolean_param_value_( pcos::key::from_string( "value" ) )
+ explicit boolean_param( boolean_param_descriptor& vpd )
+ : value_param( vpd )
+ , boolean_param_value_( pcos::key::from_string( "value" ) )
, boolean_param_prop_default_( pcos::key::from_string( kOfxParamPropDefault ) )
{
- set_boolean_param_properties( );
+ set_boolean_param_properties( vpd );
}
- virtual pcos::property get_value( )
- {
- return boolean_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypeBoolean;
- }
+ virtual pcos::property get_value( ) { return boolean_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeBoolean; }
private:
- void set_boolean_param_properties( )
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
+ void set_boolean_param_properties( boolean_param_descriptor& vpd )
{
property_container_ptr param_props_ = get_property_set( );
+
+ property_container_ptr vpd_set = vpd.get_property_set( );
- param_props_->append( boolean_param_value_ = 0 );
- param_props_->append( boolean_param_prop_default_ = 0 );
+ int def = vpd_set->get_property_with_key( pcos::key::from_string( kOfxParamPropDefault ) ).value<int>( );
+
+ param_props_->append( boolean_param_value_ = def );
+ param_props_->append( boolean_param_prop_default_ = def );
}
private:
@@ -1137,19 +1193,13 @@
class choice_param : public value_param
{
public:
- explicit choice_param( )
- : choice_param_value_( pcos::key::from_string( "value" ) )
+ explicit choice_param( choice_param_descriptor& vpd )
+ : value_param( vpd )
+ , choice_param_value_( pcos::key::from_string( "value" ) )
{ }
- virtual pcos::property get_value( )
- {
- return choice_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypeChoice;
- }
+ virtual pcos::property get_value( ) { return choice_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeChoice; }
private:
pcos::property choice_param_value_;
@@ -1158,20 +1208,14 @@
class group_param : public value_param
{
public:
- explicit group_param( )
- : group_param_value_( pcos::key::from_string( "value" ) )
+ explicit group_param( group_param_descriptor& vpd )
+ : value_param( vpd )
+ , group_param_value_( pcos::key::from_string( "value" ) )
{ }
- virtual pcos::property get_value( )
- {
- return group_param_value_;
- }
+ virtual pcos::property get_value( ) { return group_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeGroup; }
- virtual pl::string get_type( )
- {
- return kOfxParamTypeGroup;
- }
-
private:
pcos::property group_param_value_;
};
@@ -1179,20 +1223,20 @@
class page_param : public value_param
{
public:
- explicit page_param( )
- : page_param_value_( pcos::key::from_string( "value" ) )
+ explicit page_param( page_param_descriptor& vpd )
+ : value_param( vpd )
+ , page_param_value_( pcos::key::from_string( "value" ) )
{ }
- virtual pcos::property get_value( )
- {
- return page_param_value_;
- }
+ virtual pcos::property get_value( ) { return page_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypePage; }
+
+ private:
+ // assign the instance properties from the descriptor. do not assign properties since
+ // they have shallow copy semantics and clone will cause a leak.
+ // therefore extract all the values and assign those. descriptors and instances are
+ // meant to be separate entities and values should not be shared.
- virtual pl::string get_type( )
- {
- return kOfxParamTypePage;
- }
-
private:
pcos::property page_param_value_;
};
@@ -1200,19 +1244,13 @@
class push_button_param : public value_param
{
public:
- explicit push_button_param( )
- : push_button_param_value_( pcos::key::from_string( "value" ) )
+ explicit push_button_param( push_button_param_descriptor& vpd )
+ : value_param( vpd )
+ , push_button_param_value_( pcos::key::from_string( "value" ) )
{ }
- virtual pcos::property get_value( )
- {
- return push_button_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypePushButton;
- }
+ virtual pcos::property get_value( ) { return push_button_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypePushButton; }
private:
pcos::property push_button_param_value_;
@@ -1221,19 +1259,13 @@
class custom_param : public value_param
{
public:
- explicit custom_param( )
- : custom_param_value_( pcos::key::from_string( "value" ) )
+ explicit custom_param( custom_param_descriptor& vpd )
+ : value_param( vpd )
+ , custom_param_value_( pcos::key::from_string( "value" ) )
{ }
- virtual pcos::property get_value( )
- {
- return custom_param_value_;
- }
-
- virtual pl::string get_type( )
- {
- return kOfxParamTypeCustom;
- }
+ virtual pcos::property get_value( ) { return custom_param_value_; }
+ virtual pl::string get_type( ) { return kOfxParamTypeCustom; }
private:
pcos::property custom_param_value_;
@@ -1250,109 +1282,33 @@
#else
typedef std::map<key_type, param_ptr> container;
#endif
+ typedef container::const_iterator const_iterator;
public:
- explicit param_set( )
- { }
-
- OfxStatus define( const pl::string& param_type, const pl::string& name )
+ explicit param_set( param_set_descriptor& psd )
{
- typedef container::const_iterator const_iterator;
-
- const_iterator I;
- if( ( I = params_.find( name ) ) == params_.end( ) )
- {
- if( param_type == kOfxParamTypeInteger )
- {
- params_.insert( container::value_type( name, param_ptr( new int_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeInteger2D )
- {
- params_.insert( container::value_type( name, param_ptr( new int2D_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeInteger3D )
- {
- params_.insert( container::value_type( name, param_ptr( new int3D_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeDouble )
- {
- params_.insert( container::value_type( name, param_ptr( new double_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeDouble2D )
- {
- params_.insert( container::value_type( name, param_ptr( new double2D_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeDouble3D )
- {
- params_.insert( container::value_type( name, param_ptr( new double3D_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeRGB )
- {
- params_.insert( container::value_type( name, param_ptr( new rgb_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeRGBA )
- {
- params_.insert( container::value_type( name, param_ptr( new rgba_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeBoolean )
- {
- params_.insert( container::value_type( name, param_ptr( new boolean_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeChoice )
- {
- params_.insert( container::value_type( name, param_ptr( new choice_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeGroup )
- {
- params_.insert( container::value_type( name, param_ptr( new group_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypePage )
- {
- params_.insert( container::value_type( name, param_ptr( new page_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeCustom )
- {
- params_.insert( container::value_type( name, param_ptr( new custom_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypePushButton )
- {
- params_.insert( container::value_type( name, param_ptr( new push_button_param( ) ) ) );
- }
- else if( param_type == kOfxParamTypeString )
- {
- params_.insert( container::value_type( name, param_ptr( new string_param( ) ) ) );
- }
- }
- else
- {
- // parameter already exists. if the type is the same return success. otherwise flag as an error.
- }
-
- return kOfxStatOK;
+ set_parameters( psd );
}
+
+ virtual property_container_ptr get_property_set( ) { return ¶m_set_props_; }
+ virtual OfxParamSetHandle get_param_set( ) { return ( OfxParamSetHandle ) this; }
- virtual property_container_ptr get_property_set( )
- {
- return ¶m_set_props_;
- }
-
- virtual OfxParamSetHandle get_param_set( )
- {
- return ( OfxParamSetHandle ) this;
- }
-
param* find_param( const pl::string& name )
{
- typedef container::const_iterator const_iterator;
-
const_iterator I;
if( ( I = params_.find( name ) ) != params_.end( ) )
return I->second.get( );
-
return 0;
}
private:
+ void set_parameters( const param_set_descriptor& psd )
+ {
+ for( param_set_descriptor::const_iterator I = psd.begin( ); I != psd.end( ); ++I )
+ params_.insert( container::value_type( I->first, param_ptr( I->second->create_instance( ) ) ) );
+ }
+
+ private:
container params_;
pcos::property_container param_set_props_;
};
@@ -1460,8 +1416,8 @@
set_clip_descriptor_properties( );
}
- virtual property_container_ptr get_property_set( )
- { return &clip_descriptor_props_; }
+ virtual property_container_ptr get_property_set( ) { return &clip_descriptor_props_; }
+ virtual clip_instance* create_instance( );
private:
void set_clip_descriptor_properties( )
@@ -1506,6 +1462,7 @@
#else
typedef std::map<key_type, clip_descriptor_ptr> container;
#endif
+ typedef container::const_iterator const_iterator;
public:
explicit image_effect_descriptor( )
@@ -1532,26 +1489,25 @@
set_image_effect_descriptor_properties( );
}
- virtual property_container_ptr get_property_set( )
- { return &effect_descriptor_props_; }
+ virtual property_container_ptr get_property_set( ) { return &effect_descriptor_props_; }
- void clip_define( const pl::string& name, OfxPropertySetHandle* props )
- {
- typedef container::const_iterator const_iterator;
-
+ clip_descriptor* clip_get_handle( const pl::string& name )
+ {
const_iterator I = clip_desc_.find( name );
if( I != clip_desc_.end( ) )
- {
- if( props )
- *props = ( OfxPropertySetHandle ) I->second->get_property_set( );
- }
-
- clip_descriptor_ptr new_clip_desc( new clip_descriptor( ) );
- clip_desc_.insert( container::value_type( name, new_clip_desc ) );
-
- if( props )
- *props = ( OfxPropertySetHandle ) new_clip_desc->get_property_set( );
+ return I->second.get( );
+ return 0;
}
+
+ clip_descriptor* append_clip( const pl::string& name )
+ {
+ clip_descriptor_ptr clip( new clip_descriptor( ) );
+ clip_desc_.insert( container::value_type( name, clip ) );
+ return clip.get( );
+ }
+
+ const_iterator clip_begin( ) const { return clip_desc_.begin( ); }
+ const_iterator clip_end( ) const { return clip_desc_.end( ); }
private:
void set_image_effect_descriptor_properties( )
@@ -1607,7 +1563,7 @@
container clip_desc_;
};
- struct image_effect_instance_base : public param_set
+ struct image_effect_instance_base
{
virtual il::image_type_ptr get_source( ) = 0;
virtual il::image_type_ptr get_output( ) = 0;
@@ -1616,7 +1572,7 @@
class clip_instance : public Ofx_base
{
public:
- explicit clip_instance( image_effect_instance_base* const image_instance, const pl::string& name )
+ explicit clip_instance( clip_descriptor& cd )
: clip_instance_prop_type_( pcos::key::from_string( kOfxPropType ) )
, clip_instance_prop_name_( pcos::key::from_string( kOfxPropName ) )
, clip_instance_prop_label_( pcos::key::from_string( kOfxPropLabel ) )
@@ -1641,27 +1597,17 @@
, clip_instance_prop_unmapped_frame_range_( pcos::key::from_string( kOfxImageEffectPropUnmappedFrameRange ) )
, clip_instance_prop_unmapped_frame_rate_( pcos::key::from_string( kOfxImageEffectPropUnmappedFrameRate ) )
, clip_instance_prop_continuous_samples_( pcos::key::from_string( kOfxImageClipPropContinuousSamples ) )
- , image_instance_( image_instance )
- , name_( name )
{
- set_clip_instance_properties( );
+ set_clip_instance_properties( cd );
}
- virtual property_container_ptr get_property_set( )
- { return &clip_instance_props_; }
+ virtual property_container_ptr get_property_set( ) { return &clip_instance_props_; }
- property_container_ptr get_image( )
- {
- if( name_ == "Source" )
- im_.set_image( image_instance_->get_source( ) );
- else if( name_ == "Output" )
- im_.set_image( image_instance_->get_output( ) );
-
- return im_.get_property_set( );
- }
-
+ void set_image( il::image_type_ptr im ) { im_.set_image( im ); }
+ property_container_ptr get_image( ) { return im_.get_property_set( ); }
+
private:
- void set_clip_instance_properties( )
+ void set_clip_instance_properties( clip_descriptor& cd )
{
clip_instance_props_.append( clip_instance_prop_type_ = pl::string( kOfxTypeClip ) );
clip_instance_props_.append( clip_instance_prop_name_ = pl::string( "" ) );
@@ -1719,10 +1665,6 @@
private:
image im_;
-
- private:
- image_effect_instance_base* const image_instance_;
- pl::string name_;
};
class image_effect_instance :...
[truncated message content] |