TuttleOFX
1
|
00001 #ifndef _TUTTLE_HOST_OFX_PARAM_PARAMCHOICE_HPP_ 00002 #define _TUTTLE_HOST_OFX_PARAM_PARAMCHOICE_HPP_ 00003 00004 #include "OfxhParam.hpp" 00005 #include "OfxhKeyframeParam.hpp" 00006 00007 namespace tuttle { 00008 namespace host { 00009 namespace ofx { 00010 namespace attribute { 00011 00012 class OfxhParamChoice 00013 : public OfxhParam 00014 , public OfxhKeyframeParam 00015 { 00016 public: 00017 OfxhParamChoice( const OfxhParamDescriptor& descriptor, const std::string& name, OfxhParamSet& setInstance ) : OfxhParam( descriptor, name, setInstance ) {} 00018 virtual ~OfxhParamChoice() {} 00019 00020 int getIndexFor( const std::string& key ) const; 00021 const std::string& getChoiceKeyAt( const int index ) const; 00022 00023 const std::vector<std::string>& getChoiceKeys() const 00024 { 00025 return this->getProperties().fetchStringProperty( kOfxParamPropChoiceOption ).getValues(); 00026 } 00027 // Deriving implementatation needs to overide these 00028 virtual void getValue( int& ) const OFX_EXCEPTION_SPEC = 0; 00029 virtual void getValueAtTime( const OfxTime time, int& ) const OFX_EXCEPTION_SPEC = 0; 00030 virtual void setValue( const int&, const EChange change ) OFX_EXCEPTION_SPEC = 0; 00031 virtual void setValueAtTime( const OfxTime time, const int&, const EChange change ) OFX_EXCEPTION_SPEC = 0; 00032 00033 void getValue( std::string& outKey ) const OFX_EXCEPTION_SPEC; 00034 00035 void getValueAtTime( const OfxTime time, std::string& outKey ) const OFX_EXCEPTION_SPEC; 00036 00037 void setValue( const std::string& key, const EChange change ) OFX_EXCEPTION_SPEC 00038 { 00039 setValue( getIndexFor( key ), change ); 00040 } 00041 00042 void setValueAtTime( const OfxTime time, const std::string& key, const EChange change ) OFX_EXCEPTION_SPEC 00043 { 00044 setValueAtTime( time, getIndexFor( key ), change ); 00045 } 00046 00047 #ifndef SWIG 00048 /// implementation of var args function 00049 virtual void getV( va_list arg ) const OFX_EXCEPTION_SPEC; 00050 00051 /// implementation of var args function 00052 virtual void getV( const OfxTime time, va_list arg ) const OFX_EXCEPTION_SPEC; 00053 00054 /// implementation of var args function 00055 virtual void setV( va_list arg, const EChange change ) OFX_EXCEPTION_SPEC; 00056 00057 /// implementation of var args function 00058 virtual void setV( const OfxTime time, va_list arg, const EChange change ) OFX_EXCEPTION_SPEC; 00059 #endif 00060 00061 bool paramTypeHasData() const { return true; } 00062 00063 std::size_t getHashAtTime( const OfxTime time ) const; 00064 }; 00065 00066 } 00067 } 00068 } 00069 } 00070 00071 #endif 00072