本文整理汇总了C++中rc::ConstHandle::getUserName方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstHandle::getUserName方法的具体用法?C++ ConstHandle::getUserName怎么用?C++ ConstHandle::getUserName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rc::ConstHandle
的用法示例。
在下文中一共展示了ConstHandle::getUserName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exception
ValueGenerator::ValueGenerator(
RC::ConstHandle<ValueOutputOperator> const &operator_,
RC::ConstHandle<ValueProducer> const &shared
)
: m_operator( operator_ )
, m_shared( shared )
{
RC::ConstHandle<RT::Desc> operatorValueDesc = m_operator->getValueDesc();
if ( !operatorValueDesc )
throw Exception("operator is invalid");
m_valueDesc = operatorValueDesc;
RC::ConstHandle<RT::Desc> operatorSharedDesc = m_operator->getSharedDesc();
if ( operatorSharedDesc )
{
RC::ConstHandle<RT::Desc> sharedValueDesc = m_shared? m_shared->getValueDesc(): RC::ConstHandle<RT::Desc>();
if ( !sharedValueDesc )
throw Exception( "operator requires a shared value but no shared value producer is provided" );
if ( !sharedValueDesc->isEquivalentTo( operatorSharedDesc ) )
throw Exception(
"shared value type ("
+ _(sharedValueDesc->getUserName())
+ ") is not equivalent to operator shared type ("
+ _(operatorSharedDesc->getUserName()) + ")"
);
}
}
示例2: BinOpFullDesc
std::string BinOpFullDesc(
RC::ConstHandle<Adapter> const &returnAdapter,
BinOpType type,
RC::ConstHandle<CG::Adapter> const &lhsAdapter,
RC::ConstHandle<CG::Adapter> const &rhsAdapter
)
{
std::string result = "function ";
if ( returnAdapter )
result += returnAdapter->getUserName() + " ";
result += binOpUserName( type ) + "(" + lhsAdapter->getUserName() + ", " + rhsAdapter->getUserName() + ")";
return result;
}
示例3: ConstructorQueryDesc
std::string ConstructorQueryDesc(
RC::ConstHandle<CG::Adapter> const &thisAdapter,
AdapterVector const ¶mAdapters
)
{
return "constructor " + thisAdapter->getUserName() + DescParams( paramAdapters );
}
示例4: BinOpQueryDesc
std::string BinOpQueryDesc(
BinOpType type,
RC::ConstHandle<CG::Adapter> const &lhsAdapter,
RC::ConstHandle<CG::Adapter> const &rhsAdapter
)
{
return "binary operation " + lhsAdapter->getUserName() + " " + binOpUserName( type ) + " " + rhsAdapter->getUserName();
}
示例5: AssignOpQueryDesc
std::string AssignOpQueryDesc(
RC::ConstHandle<CG::Adapter> const &thisAdapter,
AssignOpType type,
RC::ConstHandle<CG::Adapter> const &thatAdapter
)
{
return "assignment operator " + thisAdapter->getUserName() + " " + assignOpUserName( type ) + " " + thatAdapter->getUserName();
}
示例6: AssignOpFullDesc
std::string AssignOpFullDesc(
RC::ConstHandle<CG::Adapter> const &thisAdapter,
AssignOpType type,
RC::ConstHandle<CG::Adapter> const &thatAdapter
)
{
return "function " + thisAdapter->getUserName() + "." + assignOpUserName( type ) + "(" + thatAdapter->getUserName() + ")";
}
示例7: FunctionFullDesc
std::string FunctionFullDesc(
RC::ConstHandle<Adapter> const &returnAdapter,
std::string const &functionName,
ExprTypeVector const ¶mTypes
)
{
std::string result = "function ";
if ( returnAdapter )
result += returnAdapter->getUserName() + " ";
result += functionName + DescParams( paramTypes );
return result;
}
示例8: UniOpFullDesc
std::string UniOpFullDesc(
RC::ConstHandle<Adapter> const &returnAdapter,
UniOpType type,
ExprType const &thisExprType
)
{
std::string result = "function ";
if ( returnAdapter )
result += returnAdapter->getUserName() + " ";
result += uniOpUserName( type ) + DescParams( ExprTypeVector( thisExprType ) );
return result;
}
示例9: MethodFullDesc
std::string MethodFullDesc(
RC::ConstHandle<Adapter> const &returnAdapter,
CG::ExprType const &thisType,
std::string const &methodName,
CG::ExprTypeVector const ¶mTypes
)
{
std::string result = "function ";
if ( returnAdapter )
result += returnAdapter->getUserName() + " ";
result += thisType.getUserName() + "." + methodName + DescParams( paramTypes );
return result;
}
示例10: Exception
ValueMap::ValueMap(
RC::ConstHandle<ValueProducer> const &input,
RC::ConstHandle<ValueIOOperator> const &operator_,
RC::ConstHandle<ValueProducer> const &shared
)
: m_input( input )
, m_operator( operator_ )
, m_shared( shared )
{
RC::ConstHandle<RT::Desc> inputValueDesc = input->getValueDesc();
if ( !inputValueDesc )
throw Exception("input is invalid");
RC::ConstHandle<RT::Desc> operatorInputDesc = operator_->getInputDesc();
if ( !operatorInputDesc )
throw Exception("operator is invalid");
if ( !operatorInputDesc->isEquivalentTo( inputValueDesc ) )
throw Exception(
"input value type ("
+ _(inputValueDesc->getUserName())
+ ") is not equivalent to value map operator input type ("
+ _(operatorInputDesc->getUserName()) + ")"
);
RC::ConstHandle<RT::Desc> operatorSharedDesc = operator_->getSharedDesc();
if ( operatorSharedDesc )
{
RC::ConstHandle<RT::Desc> sharedValueDesc = shared->getValueDesc();
if ( !sharedValueDesc )
throw Exception( "operator requires a shared value but no shared value producer is provided" );
if ( !sharedValueDesc->isEquivalentTo( operatorSharedDesc ) )
throw Exception(
"shared value type ("
+ _(sharedValueDesc->getUserName())
+ ") is not equivalent to value map operator shared type ("
+ _(operatorSharedDesc->getUserName()) + ")"
);
}
}
示例11: DestructorDesc
std::string DestructorDesc( RC::ConstHandle<CG::Adapter> const &thisAdapter )
{
return "function ~" + thisAdapter->getUserName();
}
示例12: buildExprValue
CG::ExprValue CreateArrayGenerator::buildExprValue( CG::BasicBlockBuilder &basicBlockBuilder, CG::Usage usage, std::string const &lValueErrorDesc ) const
{
if ( usage == CG::USAGE_LVALUE )
throw Exception( "cannot be used as l-values" );
RC::Handle<CG::Context> context = basicBlockBuilder.getContext();
llvm::LLVMContext &llvmContext = context->getLLVMContext();
RC::ConstHandle<CG::SizeAdapter> sizeAdapter = basicBlockBuilder.getManager()->getSizeAdapter();
RC::ConstHandle<CG::Symbol> operatorSymbol = basicBlockBuilder.getScope().get( m_operatorName );
if ( !operatorSymbol )
throw CG::Error( getLocation(), _(m_operatorName) + ": operator not found" );
if ( !operatorSymbol->isPencil() )
throw CG::Error( getLocation(), _(m_operatorName) + ": not an operator" );
RC::ConstHandle<CG::PencilSymbol> pencil = RC::ConstHandle<CG::PencilSymbol>::StaticCast( operatorSymbol );
CG::Function const *function = pencil->getUniqueFunction( getLocation(), "operator " + _(m_operatorName) );
std::vector<CG::FunctionParam> const &operatorParams = function->getParams();
if ( operatorParams.size() < 1 )
throw MR::ArrayGeneratorOperator::GetPrototypeException();
CG::ExprType countExprType = m_count->getExprType( basicBlockBuilder );
if ( !RT::isValueProducer( countExprType.getAdapter()->getType() ) )
throw CG::Error( getLocation(), "count must be a value producer" );
RC::ConstHandle<CG::ValueProducerAdapter> countValueProducerAdapter = RC::ConstHandle<CG::ValueProducerAdapter>::StaticCast( countExprType.getAdapter() );
RC::ConstHandle<CG::Adapter> countAdapter = countValueProducerAdapter->getValueAdapter();
if ( countAdapter != sizeAdapter )
throw CG::Error( getLocation(), "count value type must be 'Size'" );
CG::ExprValue countValueProducerExprValue = m_count->buildExprValue( basicBlockBuilder, CG::USAGE_RVALUE, lValueErrorDesc );
if ( operatorParams[0].getUsage() != CG::USAGE_LVALUE )
throw CG::Error( getLocation(), "operator value parameter must be an 'io' parameter" );
RC::ConstHandle<CG::Adapter> outputAdapter = operatorParams[0].getAdapter();
RC::ConstHandle<CG::ArrayProducerAdapter> outputArrayProducerAdapter = basicBlockBuilder.getManager()->getArrayProducerOf( outputAdapter );
llvm::Value *resultLValue = outputArrayProducerAdapter->llvmAlloca( basicBlockBuilder, "result" );
outputArrayProducerAdapter->llvmInit( basicBlockBuilder, resultLValue );
basicBlockBuilder.getScope().put(
CG::VariableSymbol::Create(
CG::ExprValue(
outputArrayProducerAdapter,
CG::USAGE_LVALUE,
context,
resultLValue
)
)
);
bool needCall = true;
if ( operatorParams.size() >= 2 )
{
if ( operatorParams[1].getAdapter() != sizeAdapter )
throw CG::Error( getLocation(), "operator index parameter type (" + operatorParams[1].getAdapter()->getUserName() + ") must be 'Size'" );
if ( operatorParams[1].getUsage() != CG::USAGE_RVALUE )
throw CG::Error( getLocation(), "operator index parameter must be an 'in' parameter" );
if ( operatorParams.size() >= 3 )
{
if ( operatorParams[2].getAdapter() != sizeAdapter )
throw CG::Error( getLocation(), "operator index parameter type (" + operatorParams[2].getAdapter()->getUserName() + ") must be 'Size'" );
if ( operatorParams[2].getUsage() != CG::USAGE_RVALUE )
throw CG::Error( getLocation(), "operator index parameter must be an 'in' parameter" );
if ( operatorParams.size() >= 4 )
{
if ( operatorParams.size() > 4 )
throw MR::ArrayGeneratorOperator::GetPrototypeException();
if ( !m_shared )
throw CG::Error( getLocation(), "operator takes a shared value but no shared value is provided" );
CG::ExprType sharedExprType = m_shared->getExprType( basicBlockBuilder );
if ( !RT::isValueProducer( sharedExprType.getAdapter()->getType() ) )
throw CG::Error( getLocation(), "shared value must be a value producer" );
RC::ConstHandle<CG::ValueProducerAdapter> sharedValueProducerAdapter = RC::ConstHandle<CG::ValueProducerAdapter>::StaticCast( sharedExprType.getAdapter() );
RC::ConstHandle<CG::Adapter> sharedAdapter = sharedValueProducerAdapter->getValueAdapter();
if ( operatorParams[3].getAdapter() != sharedAdapter )
throw CG::Error( getLocation(), "operator shared value parameter type (" + operatorParams[3].getAdapter()->getUserName() + ") does not match shared value type (" + sharedAdapter->getUserName() + ")" );
if ( operatorParams[3].getUsage() != CG::USAGE_RVALUE )
throw CG::Error( getLocation(), "operator shared value parameter must be an 'in' parameter" );
CG::ExprValue sharedExprRValue = m_shared->buildExprValue( basicBlockBuilder, CG::USAGE_RVALUE, lValueErrorDesc );
std::vector<llvm::Type const *> argTypes;
argTypes.push_back( llvm::Type::getInt8PtrTy( llvmContext ) ); // function
argTypes.push_back( sizeAdapter->llvmRType( context ) ); // numParams
argTypes.push_back( countValueProducerAdapter->llvmLType( context ) ); // count value producer
argTypes.push_back( sharedValueProducerAdapter->llvmLType( context ) ); // shared value producer
argTypes.push_back( llvm::Type::getInt8PtrTy( llvmContext ) ); // output array producer adapter
argTypes.push_back( outputArrayProducerAdapter->llvmLType( context ) ); // output array producer
llvm::FunctionType const *funcType = llvm::FunctionType::get( llvm::Type::getVoidTy( llvmContext ), argTypes, false );
llvm::Constant *func = basicBlockBuilder.getModuleBuilder()->getOrInsertFunction( "__MR_CreateArrayGenerator_4", funcType );
std::vector<llvm::Value *> args;
args.push_back( basicBlockBuilder->CreateBitCast(
function->getLLVMFunction(),
llvm::Type::getInt8PtrTy( llvmContext )
) );
args.push_back( sizeAdapter->llvmConst( context, operatorParams.size() ) );
args.push_back( countValueProducerExprValue.getValue() );
args.push_back( sharedExprRValue.getValue() );
//.........这里部分代码省略.........