예제 #1
0
    ArrayOutputOperator::ArrayOutputOperator(
      RC::ConstHandle<Executable> const &executable,
      RC::ConstHandle<AST::Operator> const &astOperator,
      void (*functionPtr)(...)
      )
      : m_executable( executable )
    {
      if ( astOperator )
      {
        RC::Handle<CG::Manager> cgManager = executable->getCGManager();
        
        RC::ConstHandle<AST::ParamVector> params = astOperator->getParams( cgManager );
        size_t numParams = params->size();
        if ( numParams < 1 || numParams > 4 )
          throw GetPrototypeException();
        
        RC::ConstHandle<AST::Param> valueParam = params->get(0);
        if ( valueParam->getUsage() != CG::USAGE_LVALUE )
          throw GetPrototypeException();
        RC::ConstHandle<RT::Desc> valueDesc = valueParam->getAdapter( cgManager )->getDesc();
        
        RC::ConstHandle<RT::Desc> sharedDesc;
        if ( numParams >= 2 )
        {
          RC::ConstHandle<AST::Param> indexParam = params->get(1);
          if ( indexParam->getUsage() != CG::USAGE_RVALUE
            || !indexParam->getAdapter( cgManager )->isEquivalentTo( cgManager->getSizeAdapter() )
            )
            throw GetPrototypeException();
        
          if ( numParams >= 3 )
          {
            RC::ConstHandle<AST::Param> countParam = params->get(2);
            if ( countParam->getUsage() != CG::USAGE_RVALUE
              || !countParam->getAdapter( cgManager )->isEquivalentTo( cgManager->getSizeAdapter() )
              )
              throw GetPrototypeException();
          
            if ( numParams >= 4 )
            {
              RC::ConstHandle<AST::Param> sharedParam = params->get(3);
              if ( sharedParam->getUsage() != CG::USAGE_RVALUE )
                throw GetPrototypeException();
              sharedDesc = sharedParam->getAdapter( cgManager )->getDesc();
            }
          }
        }

        init( functionPtr, numParams, valueDesc, sharedDesc );
      }
    }
 ArrayProducerAdapter::ArrayProducerAdapter(
   RC::ConstHandle<Manager> const &manager,
   RC::ConstHandle<RT::ArrayProducerDesc> const &arrayProducerDesc
   )
   : Adapter( manager, arrayProducerDesc, FL_PASS_BY_REFERENCE )
   , m_arrayProducerDesc( arrayProducerDesc )
   , m_elementAdapter( manager->getAdapter( arrayProducerDesc->getElementDesc() ) )
   , m_elementVariableArrayAdapter( manager->getVariableArrayOf( m_elementAdapter ) )
 {
 }
예제 #3
0
 ArrayAdapter::ArrayAdapter( RC::ConstHandle<Manager> const &manager, RC::ConstHandle<RT::ArrayDesc> const &arrayDesc, Flags flags )
   : Adapter( manager, arrayDesc, flags )
   , m_arrayDesc( arrayDesc )
   , m_memberAdapter( manager->getAdapter( arrayDesc->getMemberDesc() ) )
 {
 }