MCPcopy Create free account
hub / github.com/ImageEngine/cortex / valueValid

Method valueValid

src/IECore/Parameter.cpp:132–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130//////////////////////////////////////////////////////////////////////////////////////////////////////////
131
132bool Parameter::valueValid( const Object *value, std::string *reason ) const
133{
134 if( !value )
135 {
136 if( reason )
137 {
138 *reason = "Value is a null pointer.";
139 }
140 return false;
141 }
142 if( value->typeId()==NullObject::staticTypeId() )
143 {
144 if( reason )
145 {
146 *reason = "Value is of type NullObject.";
147 }
148 return false;
149 }
150 if( !m_presetsOnly )
151 {
152 return true;
153 }
154 const PresetsContainer &pr = getPresets();
155 for( PresetsContainer::const_iterator it = pr.begin(); it!=pr.end(); it++ )
156 {
157 if( it->second->isEqualTo( value ) )
158 {
159 return true;
160 }
161 }
162 if( reason )
163 {
164 *reason = "Value not present in presets.";
165 }
166 return false;
167}
168
169bool Parameter::valueValid( std::string *reason ) const
170{

Callers 2

testNoneIsValidMethod · 0.95
valueValid2Function · 0.45

Calls 6

getPresetsFunction · 0.85
typeIdMethod · 0.80
getValueFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
isEqualToMethod · 0.45

Tested by

no test coverage detected