//------------------------------------------------------------ //! 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); } }
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); }
//------------------------------------------------------------ //! 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; }
//------------------------------------------------------------ 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); }
//------------------------------------------------------------ VIREO_EXPORT Int32 Data_GetLength(TypedBlock* object, Int32 dimension) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); return object->GetLength(dimension); }
//------------------------------------------------------------ VIREO_EXPORT void Data_Write8Bytes(TypedBlock* object, Int32 offset, Int64 value) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); *object->BeginAtAQ<Int64*>(offset) = value; }
//------------------------------------------------------------ VIREO_EXPORT void Data_WritePointer(TypedBlock* object, Int32 offset, void* value) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); *object->BeginAtAQ<void**>(offset) = value; }
//------------------------------------------------------------ VIREO_EXPORT void* Data_RawPointerFromOffset(TypedBlock* object, Int32 offset) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); return object->RawBegin() + offset; }
//------------------------------------------------------------ VIREO_EXPORT void Data_Read8Bytes(TypedBlock* object, Int32 offset, Int64* value) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); *value = *object->BeginAtAQ<Int64*>(offset); }
//------------------------------------------------------------ VIREO_EXPORT void Data_Resize1D(TypedBlock* object, Int32 size) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); object->Resize1D(size); }
//------------------------------------------------------------ VIREO_EXPORT void Data_ResizeDimensions(TypedBlock* object, Int32 rank, IntIndex* sizes) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); object->ResizeDimensions(rank, sizes, false); }
//------------------------------------------------------------ VIREO_EXPORT TypeRef Data_Type(TypedBlock* object) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); return object->Type(); }
//------------------------------------------------------------ VIREO_EXPORT void* Data_GetStringBegin(StringRef stringObject) { VIREO_ASSERT(String::ValidateHandle(stringObject)); return stringObject->Begin(); }
//------------------------------------------------------------ VIREO_EXPORT Int32 Data_Length(TypedBlock* object) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); return object->Length(); }
//------------------------------------------------------------ VIREO_EXPORT Int32 Data_RawBlockSize(TypedBlock* object) { VIREO_ASSERT(TypedBlock::ValidateHandle(object)); return object->AQBlockLength(object->Length()); }
//------------------------------------------------------------ //! 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(); }
//------------------------------------------------------------ VIREO_EXPORT Int32 Data_GetStringLength(StringRef stringObject) { VIREO_ASSERT(String::ValidateHandle(stringObject)); return stringObject->Length(); }
//------------------------------------------------------------ //! 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); }