| 51 | ////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 52 | |
| 53 | Parameter::Parameter( const std::string &name, const std::string &description, ObjectPtr defaultValue, |
| 54 | const PresetsContainer &presets, bool presetsOnly, ConstCompoundObjectPtr userData ) |
| 55 | : m_name( name ), m_description( description ), m_defaultValue( defaultValue ), m_presetsOnly( presetsOnly ), |
| 56 | m_userData( userData ? userData->copy() : nullptr ) |
| 57 | { |
| 58 | if ( !defaultValue ) |
| 59 | { |
| 60 | throw Exception( "Invalid NULL default value!" ); |
| 61 | } |
| 62 | |
| 63 | for( PresetsContainer::const_iterator it=presets.begin(); it!=presets.end(); it++ ) |
| 64 | { |
| 65 | m_presets.push_back( PresetsContainer::value_type( it->first, it->second->copy() ) ); |
| 66 | } |
| 67 | |
| 68 | /// \todo If presetsOnly is true, doesn't this allow us to set a defaultValue that isn't in the presets list? |
| 69 | setValue( defaultValue->copy() ); |
| 70 | } |
| 71 | |
| 72 | Parameter::~Parameter() |
| 73 | { |