Esempio n. 1
0
//------------------------------------------------------------
//! Get the values for dimensions of the array. Assumes dimensions target is of length equal to rank
//! Caller is expected to allocate an array dimensions of size array rank for the duration of function invocation.
VIREO_EXPORT void Data_GetArrayDimensions(const void* pData, IntIndex dimensionsLengths[])
{
    TypedArrayCoreRef arrayObject = *(static_cast<const TypedArrayCoreRef*>(pData));
    VIREO_ASSERT(TypedArrayCore::ValidateHandle(arrayObject));
    for (int i = 0; i < arrayObject->Rank(); i++) {
        dimensionsLengths[i] = arrayObject->GetLength(i);
    }
}
Esempio n. 2
0
VivmDataQueue::VivmDataQueue(int size)
{
    _freeSpace = size;
    // TODO needs to be allocated from the Contexts Type Manager
    VIREO_ASSERT(false)
    _insert = (Double*)_buffer->Begin();
    _remove = _insert;
    _eltSize = sizeof(Double);
}
Esempio n. 3
0
//------------------------------------------------------------
//! 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;
}
Esempio n. 4
0
//------------------------------------------------------------
VIREO_EXPORT void Data_WriteBytes(TypedBlock* object, Int32 offset, Int32 count, Int32* buffer)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    memcpy(object->BeginAtAQ<void*>(offset), buffer, count);
}
Esempio n. 5
0
//------------------------------------------------------------
VIREO_EXPORT Int32 Data_GetLength(TypedBlock* object, Int32 dimension)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    return object->GetLength(dimension);
}
Esempio n. 6
0
//------------------------------------------------------------
VIREO_EXPORT void Data_Write8Bytes(TypedBlock* object, Int32 offset, Int64 value)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    *object->BeginAtAQ<Int64*>(offset) = value;
}
Esempio n. 7
0
//------------------------------------------------------------
VIREO_EXPORT void Data_WritePointer(TypedBlock* object, Int32 offset, void* value)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    *object->BeginAtAQ<void**>(offset) = value;
}
Esempio n. 8
0
//------------------------------------------------------------
VIREO_EXPORT void* Data_RawPointerFromOffset(TypedBlock* object, Int32 offset)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    return object->RawBegin() + offset;
}
Esempio n. 9
0
//------------------------------------------------------------
VIREO_EXPORT void Data_Read8Bytes(TypedBlock* object, Int32 offset, Int64* value)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    *value = *object->BeginAtAQ<Int64*>(offset);
}
Esempio n. 10
0
//------------------------------------------------------------
VIREO_EXPORT void Data_Resize1D(TypedBlock* object, Int32 size)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    object->Resize1D(size);
}
Esempio n. 11
0
//------------------------------------------------------------
VIREO_EXPORT void Data_ResizeDimensions(TypedBlock* object, Int32 rank, IntIndex* sizes)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    object->ResizeDimensions(rank, sizes, false);
}
Esempio n. 12
0
//------------------------------------------------------------
VIREO_EXPORT TypeRef Data_Type(TypedBlock* object)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    return object->Type();
}
Esempio n. 13
0
//------------------------------------------------------------
VIREO_EXPORT void* Data_GetStringBegin(StringRef stringObject)
{
    VIREO_ASSERT(String::ValidateHandle(stringObject));
    return stringObject->Begin();
}
Esempio n. 14
0
//------------------------------------------------------------
VIREO_EXPORT Int32 Data_Length(TypedBlock* object)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    return object->Length();
}
Esempio n. 15
0
//------------------------------------------------------------
VIREO_EXPORT Int32 Data_RawBlockSize(TypedBlock* object)
{
    VIREO_ASSERT(TypedBlock::ValidateHandle(object));
    return object->AQBlockLength(object->Length());
}
Esempio n. 16
0
//------------------------------------------------------------
//! Get the total length for an array
VIREO_EXPORT Int32 Data_GetArrayLength(const void* pData)
{
    TypedArrayCoreRef arrayObject = *(static_cast<const TypedArrayCoreRef*>(pData));
    VIREO_ASSERT(TypedArrayCore::ValidateHandle(arrayObject));
    return arrayObject->Length();
}
Esempio n. 17
0
//------------------------------------------------------------
VIREO_EXPORT Int32 Data_GetStringLength(StringRef stringObject)
{
    VIREO_ASSERT(String::ValidateHandle(stringObject));
    return stringObject->Length();
}
Esempio n. 18
0
//------------------------------------------------------------
//! Get the starting location of the first element of an Array / String type in memory
// This function returns the start address of where elements would appear in memory (returns address even if length zero)
VIREO_EXPORT void* Data_GetArrayBegin(const void* pData)
{
    TypedArrayCoreRef arrayObject = *(static_cast<const TypedArrayCoreRef*>(pData));
    VIREO_ASSERT(TypedArrayCore::ValidateHandle(arrayObject));
    return arrayObject->BeginAt(0);
}