ParameterGroupDataPrivate::~ParameterGroupDataPrivate( )
 {
   for ( ParameterGroupSpec::iterator it = getParameterGroupSpec()->beginParameterSpecs() ; it != getParameterGroupSpec()->endParameterSpecs() ; ++it )
   {
     if ( isParameterPointer( it->first ) )
     {
       size_t arraySize = std::max( 1u, it->first.getArraySize() );
       for ( size_t index = 0; index < arraySize; ++index )
       {
         updateString( it, index, nullptr );
       }
     }
   }
 }
Beispiel #2
0
 const void * ParameterGroupData::getParameter( dp::fx::ParameterGroupSpec::iterator it ) const
 {
   DP_ASSERT( it != m_parameterGroupSpec->endParameterSpecs() );
   //DP_ASSERT( ( it->first.getType() & ( dp::fx::PT_SCALAR_TYPE_MASK | dp::fx::PT_SCALAR_MODIFIER_MASK ) ) == it->first.getType() );
   DP_ASSERT( it->second + it->first.getSizeInByte() <= m_data.size() );
   if ( isParameterPointer( it->first ) )
   {
     // return a pointer to a constant pointer of char
     return( *reinterpret_cast<char *const *>(&m_data[it->second]) );
   }
   else
   {
     return( &m_data[it->second] );
   }
 }
    void ParameterGroupDataPrivate::setParameter( dp::fx::ParameterGroupSpec::iterator it, const void * value )
    {
      DP_ASSERT( it != m_parameterGroupSpec->endParameterSpecs() );

      if ( isParameterPointer( it->first ) )
      {
        DP_ASSERT( it->first.getArraySize() == 0 );
        updateString( it, 0, reinterpret_cast<const char*>(value) );
      }
      else
      {
        unsigned int elementSize = it->first.getElementSizeInBytes();
        const char * charValue = reinterpret_cast<const char *>(value);
        unsigned int count = std::max( dp::checked_cast<unsigned int>(it->first.getArraySize()), (unsigned int)(1) );
        for ( unsigned int i=0 ; i<count ; i++ )
        {
          updateValue( it, i, charValue );
          charValue += elementSize;
        }
      }
    }
Beispiel #4
0
    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 );
      }

    }