当前位置: 首页>>代码示例>>C++>>正文


C++ TypeRef类代码示例

本文整理汇总了C++中TypeRef的典型用法代码示例。如果您正苦于以下问题:C++ TypeRef类的具体用法?C++ TypeRef怎么用?C++ TypeRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TypeRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AreIntrinsicClustersCompatible

 //------------------------------------------------------------
 bool DualTypeEqual::AreIntrinsicClustersCompatible(TypeRef typeRefX, TypeRef typeRefY) const
 {
     SubString typeXName, typeYName;
     Boolean isTypeXIntrinsicClusterType = typeRefX->IsIntrinsicClusterDataType(&typeXName);
     Boolean isTypeYIntrinsicClusterType = typeRefY->IsIntrinsicClusterDataType(&typeYName);
     return typeXName.Compare(&typeYName);
 }
开发者ID:ni,项目名称:VireoSDK,代码行数:8,代码来源:DualTypeEqual.cpp

示例2: SetVariantToDataTypeError

void VariantType::SetVariantToDataTypeError(TypeRef inputType, TypeRef targetType, TypeRef outputType, void* outputData, ErrorCluster* errPtr)
{
    if (inputType && inputType->IsCluster() && targetType->IsArray()) {
        errPtr->SetErrorAndAppendCallChain(true, kUnsupportedOnTarget, "Variant To Data");
    } else {
        errPtr->SetErrorAndAppendCallChain(true, kVariantIncompatibleType, "Variant To Data");
    }
    if (outputType && outputData) {
            outputType->InitData(outputData);
    }
}
开发者ID:cglzaguilar,项目名称:VireoSDK,代码行数:11,代码来源:Variants.cpp

示例3: VIREO_FUNCTION_SIGNATURE3

//------------------------------------------------------------
VIREO_FUNCTION_SIGNATURE3(ArrayFill, TypedArrayCoreRef, Int32, void)
{
    TypedArrayCore* array = _Param(0);
    TypeRef     eltType = array->ElementType();
    Int32       length = _Param(1);
    
    if (array->Resize1D(length)) {
        eltType->MultiCopyData(_ParamPointer(2), array->RawBegin(), length);
    }
    return _NextInstruction();
}
开发者ID:JackDunaway,项目名称:VireoSDK,代码行数:12,代码来源:Array.cpp

示例4: EggShell_FindSubValue

//------------------------------------------------------------
//! Get a reference to the type pointer and data for a sub element
VIREO_EXPORT EggShellResult EggShell_FindSubValue(TypeManagerRef tm,
        const TypeRef typeRef, void * pData, const char* eltName, TypeRef* typeRefLocation, void** dataRefLocation)
{
    if (typeRef == nullptr || !typeRef->IsValid())
        return kEggShellResult_InvalidTypeRef;

    TypeManagerScope scope(tm);
    SubString path(eltName);
    *typeRefLocation = typeRef->GetSubElementAddressFromPath(&path, pData, dataRefLocation, true);
    if (*typeRefLocation == nullptr)
        return kEggShellResult_ObjectNotFoundAtPath;

    return kEggShellResult_Success;
}
开发者ID:ni,项目名称:VireoSDK,代码行数:16,代码来源:CEntryPoints.cpp

示例5: THREAD_TADM

VariantTypeRef VariantType::CreateNewVariantFromStaticTypeAndData(const StaticTypeAndData& input)
{
    TypeRef inputType = input._paramType;
    TypeManagerRef tm = THREAD_TADM();

    auto inputData = input._pData;
    if (inputType->IsVariant()) {
        VariantTypeRef variant = *reinterpret_cast<VariantTypeRef *>(input._pData);
        inputType = variant->_underlyingTypeRef;
        inputData = variant->Begin(kPARead);
    }
    VariantTypeRef newVariant = VariantType::New(tm, inputType);
    newVariant->CopyData(inputData, newVariant->Begin(kPAWrite));
    return newVariant;
}
开发者ID:cglzaguilar,项目名称:VireoSDK,代码行数:15,代码来源:Variants.cpp

示例6: Apply

 //------------------------------------------------------------
 bool DualTypeEqual::Apply(TypeRef typeRefX, void* pDataX, TypeRef typeRefY, void* pDataY) const
 {
     EncodingEnum encodingX = typeRefX->BitEncoding();
     bool success = false;
     switch (encodingX) {
         case kEncoding_Boolean:
             success = ApplyBooleans(typeRefX, pDataX, typeRefY, pDataY);
             break;
         case kEncoding_UInt:
             success = ApplyUInts(typeRefX, pDataX, typeRefY, pDataY);
             break;
         case kEncoding_S2CInt:
             success = ApplyS2CInts(typeRefX, pDataX, typeRefY, pDataY);
             break;
         case kEncoding_IEEE754Binary:
             success = ApplyIEEE754Binaries(typeRefX, pDataX, typeRefY, pDataY);
             break;
         case kEncoding_Enum:
             success = ApplyUInts(typeRefX, pDataX, typeRefY, pDataY);
             break;
         default:
             break;
     }
     return success;
 }
开发者ID:ni,项目名称:VireoSDK,代码行数:26,代码来源:DualTypeEqual.cpp

示例7: EggShell_ReadValueString

//------------------------------------------------------------
//! Read a symbol's value as a string. Value will be formatted according to designated format.
VIREO_EXPORT EggShellResult EggShell_ReadValueString(TypeManagerRef tm, const TypeRef typeRef, void* pData, const char* format, UInt8** valueString)
{
    TypeManagerScope scope(tm);

    if (typeRef == nullptr || !typeRef->IsValid())
        return kEggShellResult_InvalidTypeRef;

    static StringRef returnBuffer = nullptr;
    if (returnBuffer == nullptr) {
        // Allocate a string the first time it is used.
        // After that it will be resized as needed.
        STACK_VAR(String, tempReturn);
        returnBuffer = tempReturn.DetachValue();
    } else {
        returnBuffer->Resize1D(0);
    }

    if (returnBuffer) {
        SubString formatss(format);
        TDViaFormatter formatter(returnBuffer, true, 0, &formatss, kJSONEncodingEggShell);
        formatter.FormatData(typeRef, pData);
        // Add an explicit null terminator so it looks like a C string.
        returnBuffer->Append((Utf8Char)'\0');
        *valueString = returnBuffer->Begin();
        return kEggShellResult_Success;
    }

    return kEggShellResult_UnableToCreateReturnBuffer;
}
开发者ID:ni,项目名称:VireoSDK,代码行数:31,代码来源:CEntryPoints.cpp

示例8: create

FunctionRef FunctionRef::create(
        TypeRef returnType,
        Visibility visibility,
        const QByteArray &name,
        const QVector<TypeRef> &argTypes,
        const QVector<QByteArray> &argNames,
        bool firstArgIsReturnValuePointer,
        ModuleRef & parent,
        llvm::LLVMContext* ctx
        )
{
    llvm::Type *lt = returnType.rawPtr();
    std::vector<llvm::Type*> largTypes(argTypes.size());
    for (int i=0; i<argTypes.size(); ++i) {
        llvm::Type *at = (llvm::Type*) argTypes[i].rawPtr();
        largTypes[i] = at;
    }

    llvm::FunctionType * lft = largTypes.empty()
            ? llvm::FunctionType::get(lt, false)
            : llvm::FunctionType::get(lt, largTypes, false)
              ;

    llvm::GlobalValue::LinkageTypes link =
            VS_Extern==visibility
            ? llvm::GlobalValue::ExternalLinkage
            : llvm::GlobalValue::PrivateLinkage
              ;

    std::string lname(name.constData(), name.size());
    llvm::Module *lm = (llvm::Module*) parent.rawPtr();
    llvm::Function *lf = llvm::Function::Create(
                lft, link, lname, lm
                );

    lf->addFnAttr(llvm::Attribute::NoUnwind);
    lf->addFnAttr(llvm::Attribute::UWTable);

    typedef llvm::Function::ArgumentListType::iterator AIt;
    int argNumber = 0;
    for (AIt it=lf->getArgumentList().begin();
         argNumber<argNames.size() ; ++argNumber, ++it)
    {
        const std::string argName(argNames[argNumber].constData());
        it->setName(argName);
    }

    if (firstArgIsReturnValuePointer) {
        llvm::Argument & firstArg = lf->getArgumentList().front();
        llvm::AttrBuilder abuilder;
        abuilder.addAttribute(llvm::Attribute::StructRet);
        abuilder.addAttribute(llvm::Attribute::NoAlias);
        firstArg.addAttr(llvm::AttributeSet::get(*ctx, 0, abuilder));
        firstArg.addAttr(llvm::AttributeSet::get(*ctx, 1, abuilder));
    }

    FunctionRef result;
    result.d = (lf);
    return result;
}
开发者ID:victor-yacovlev,项目名称:kumir2,代码行数:60,代码来源:llvm_function_3.8.cpp

示例9: VIREO_FUNCTION_SIGNATURE4

VIREO_FUNCTION_SIGNATURE4(AnalogWaveformBuild, AnalogWaveform, Timestamp, Double, TypedArrayCoreRef)
{
    _Param(0)._t0 = _ParamPointer(1) ? _Param(1) : Timestamp(0, 0);
    _Param(0)._dt = _ParamPointer(2) ? _Param(2) : 1.0;

    TypedArrayCoreRef* argY_source = _ParamPointer(3);
    TypedArrayCoreRef* waveY_dest = &_Param(0)._Y;
    if (argY_source) {
        if (!(*argY_source)->ElementType()->IsA((*waveY_dest)->ElementType())) {
            THREAD_EXEC()->LogEvent(EventLog::kHardDataError, "AnalogWaveformBuild() Type of argument-3 does not match type of output waveform");
            return THREAD_EXEC()->Stop();
        }
        TypeRef type = (*argY_source)->Type();
        type->CopyData(argY_source, waveY_dest);
    }

    return _NextInstruction();
}
开发者ID:cglzaguilar,项目名称:VireoSDK,代码行数:18,代码来源:Waveform.cpp

示例10: VIREO_FUNCTION_SIGNATURE4

//------------------------------------------------------------
VIREO_FUNCTION_SIGNATURE4(ArrayReplaceElt, TypedArrayCoreRef, TypedArrayCoreRef, Int32, void)
{
    TypedArrayCoreRef arrayOut = _Param(0);
    TypedArrayCoreRef arrayIn = _Param(1);

    TypeRef     elementType = arrayOut->ElementType();
    Int32       index = _Param(2);
    Int32       length = arrayIn->Length();
    if(arrayOut != arrayIn){
        arrayOut->Type()->CopyData(_ParamPointer(1), _ParamPointer(0));
    } 
    
    if (index >= 0 && index < length) {
        void* pDest = arrayOut->BeginAt(index);
        elementType->CopyData(_ParamPointer(3), pDest);
    }

    return _NextInstruction();
}
开发者ID:JackDunaway,项目名称:VireoSDK,代码行数:20,代码来源:Array.cpp

示例11: EggShell_DeallocateData

//------------------------------------------------------------
//! Deallocates data and frees up memory in dataRef described by typeRef
VIREO_EXPORT EggShellResult EggShell_DeallocateData(TypeManagerRef tm, const TypeRef typeRef, void* dataRef)
{
    TypeManagerScope scope(tm);
    if (typeRef == nullptr || !typeRef->IsValid()) {
        return kEggShellResult_InvalidTypeRef;
    }

    if (dataRef == nullptr) {
        return kEggShellResult_InvalidDataPointer;
    }

    NIError error = typeRef->ClearData(dataRef);
    THREAD_TADM()->Free(dataRef);
    if (error != kNIError_Success) {
        return kEggShellResult_UnableToDeallocateData;
    }

    return kEggShellResult_Success;
}
开发者ID:ni,项目名称:VireoSDK,代码行数:21,代码来源:CEntryPoints.cpp

示例12: EggShell_WriteDouble

//------------------------------------------------------------
//! Write a numeric value to a symbol. Value will be coerced as needed.
VIREO_EXPORT EggShellResult EggShell_WriteDouble(TypeManagerRef tm, const TypeRef typeRef, void* pData, Double value)
{
    TypeManagerScope scope(tm);
    if (typeRef == nullptr || !typeRef->IsValid())
        return kEggShellResult_InvalidTypeRef;

    NIError error = WriteDoubleToMemory(typeRef, pData, value);
    if (error)
        return kEggShellResult_UnexpectedObjectType;
    return kEggShellResult_Success;
}
开发者ID:ni,项目名称:VireoSDK,代码行数:13,代码来源:CEntryPoints.cpp

示例13: EggShell_AllocateData

//------------------------------------------------------------
//! Allocates enough memory to fit a new object of TypeRef
VIREO_EXPORT EggShellResult EggShell_AllocateData(TypeManagerRef tm, const TypeRef typeRef, void** dataRefLocation)
{
    TypeManagerScope scope(tm);
    if (typeRef == nullptr || !typeRef->IsValid()) {
        return kEggShellResult_InvalidTypeRef;
    }

    if (dataRefLocation == nullptr) {
        return kEggShellResult_InvalidDataPointer;
    }

    *dataRefLocation = nullptr;
    Int32 topSize = typeRef->TopAQSize();
    void* pData = THREAD_TADM()->Malloc(topSize);
    NIError error = typeRef->InitData(pData);
    if (error != kNIError_Success) {
        return kEggShellResult_UnableToAllocateData;
    }
    *dataRefLocation = pData;
    return kEggShellResult_Success;
}
开发者ID:ni,项目名称:VireoSDK,代码行数:23,代码来源:CEntryPoints.cpp

示例14: EggShell_ResizeArray

//------------------------------------------------------------
//! Resizes a variable size Array symbol to have new dimension lengths specified by newLengths, it also initializes cells for non-flat data.
VIREO_EXPORT EggShellResult EggShell_ResizeArray(TypeManagerRef tm, const TypeRef typeRef, const void* pData,
                                                 Int32 rank, Int32 dimensionLengths[])
{
    TypeManagerScope scope(tm);
    if (typeRef == nullptr || !typeRef->IsValid())
        return kEggShellResult_InvalidTypeRef;

    if (!typeRef->IsArray())
        return kEggShellResult_UnexpectedObjectType;

    if (typeRef->Rank() != rank)
        return kEggShellResult_MismatchedArrayRank;

    TypedArrayCoreRef arrayObject = *(static_cast<const TypedArrayCoreRef*>(pData));
    VIREO_ASSERT(TypedArrayCore::ValidateHandle(arrayObject));

    if (!arrayObject->ResizeDimensions(rank, dimensionLengths, true, false)) {
        return kEggShellResult_UnableToCreateReturnBuffer;
    }
    return kEggShellResult_Success;
}
开发者ID:ni,项目名称:VireoSDK,代码行数:23,代码来源:CEntryPoints.cpp

示例15: reachable

bool TypeHierarchy::reachable(const TypeRef & t1,const TypeRef & t2)
{
	if(t1 == t2) return true;

	Graph::iterator i = graph.find(&t1);
	if(i == graph.end()) 
	{
		return false;
	};
	
	Graph::const_iterator j = graph.find(&t2);
	if(j == graph.end() && t2.expected()) 
	{
		return false;
	};
	t2.addContents(this);
	j = graph.find(&t2);
	
	if(i->second.find(j->first) != i->second.end()) return true;

	Nodes ns;
	return closure(graph,i,ns,i,j->first);
};
开发者ID:mdrichar,项目名称:POGDDL,代码行数:23,代码来源:typecheck.cpp


注:本文中的TypeRef类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。