ParameterGroupData::ParameterGroupData( const ParameterGroupData & rhs ) : Object( rhs ) { m_objectCode = OC_PARAMETER_GROUP_DATA; initSpec( rhs.getParameterGroupSpec() ); // fill the data area with the values from rhs for ( ParameterGroupSpec::iterator it = m_parameterGroupSpec->beginParameterSpecs() ; it != m_parameterGroupSpec->endParameterSpecs() ; ++it ) { if ( it->first.getType() & PT_POINTER_TYPE_MASK ) { DP_ASSERT( ( it->first.getType() & PT_POINTER_TYPE_MASK ) == PT_SAMPLER_PTR ); setParameter( it, rhs.getParameter<SamplerSharedPtr>( it ) ); } else { setParameter( it, rhs.getParameter( it ) ); } } }
bool ParameterGroupData::operator ==( const ParameterGroupData& rhs) const { if ( this == &rhs ) { return true; } else { DP_ASSERT( m_parameterGroupSpec ); bool equal = m_name == rhs.m_name; for ( ParameterGroupSpec::iterator it = m_parameterGroupSpec->beginParameterSpecs() ; equal && it != m_parameterGroupSpec->endParameterSpecs() ; ++it ) { const void *pLhs = getParameter( it ); const void *pRhs = rhs.getParameter( it ); if ( isParameterPointer( it->first) ) { if ( pLhs != pRhs ) { // both pointers are non-zero. Do a string compare if ( pLhs != nullptr && pRhs != nullptr ) { equal = strcmp( reinterpret_cast<const char *>(pLhs), reinterpret_cast<const char*>(pRhs) ) == 0; } // either one of the pointers is zero while the other is not. different. else { equal = false; } } } else { equal = ( memcmp( pLhs, pRhs, it->first.getSizeInByte() ) == 0 ); } } return( equal ); } }