TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/attribute/ParamBoolean.cpp
Go to the documentation of this file.
00001 #include "ParamBoolean.hpp"
00002 #include "expression.hpp"
00003 
00004 #include <tuttle/host/INode.hpp>
00005 
00006 namespace tuttle {
00007 namespace host {
00008 namespace attribute {
00009 
00010 ParamBoolean::ParamBoolean( INode&                           effect,
00011                             const std::string&                         name,
00012                             const ofx::attribute::OfxhParamDescriptor& descriptor,
00013                             const std::size_t                          index )
00014         : Param( effect )
00015         , ofx::attribute::OfxhParamBoolean( descriptor, name, effect.getParamSet(), index )
00016 {
00017         _value = getDefault();
00018 }
00019 
00020 bool ParamBoolean::getDefault() const
00021 {
00022         return static_cast<bool>( getProperties().getIntProperty( kOfxParamPropDefault, this->_index ) != 0 );
00023 }
00024 
00025 void ParamBoolean::getValue( bool& v ) const OFX_EXCEPTION_SPEC
00026 {
00027         v = _value;
00028 }
00029 
00030 void ParamBoolean::getValueAtTime( const OfxTime time, bool& v ) const OFX_EXCEPTION_SPEC
00031 {
00032         v = _value; ///< @todo: in time !
00033 }
00034 
00035 void ParamBoolean::setValue( const bool& v, const ofx::attribute::EChange change ) OFX_EXCEPTION_SPEC
00036 {
00037         _value = v;
00038         paramChanged( change );
00039 }
00040 
00041 void ParamBoolean::setValueAtTime( const OfxTime time, const bool& v, const ofx::attribute::EChange change ) OFX_EXCEPTION_SPEC
00042 {
00043         _value = v; ///< @todo: in time !
00044         paramChanged( change );
00045 }
00046 
00047 void ParamBoolean::setValueFromExpression( const std::string& value, const ofx::attribute::EChange change ) OFX_EXCEPTION_SPEC
00048 {
00049         _value = extractValueFromExpression<bool>( value );
00050         this->paramChanged( change );
00051 }
00052 
00053 void ParamBoolean::copy( const ParamBoolean& p ) OFX_EXCEPTION_SPEC
00054 {
00055         _value = p._value;
00056         //      paramChanged( ofx::attribute::eChangeUserEdited );
00057 }
00058 
00059 void ParamBoolean::copy( const OfxhParam& p ) OFX_EXCEPTION_SPEC
00060 {
00061         const ParamBoolean& param = dynamic_cast<const ParamBoolean&>( p );
00062 
00063         copy( param );
00064 }
00065 
00066 }
00067 }
00068 }
00069