Search Results for

    Show / Hide Table of Contents

    Class DataContainer

    Universal utility class that can store the chunk of data or just reference to the memory. Supports only value types that don't require constructor/destructor invocation.

    Inheritance
    Span
    DataContainer
    Inherited Members
    Span::_data
    Span::_length
    DataContainer
    Span::begin()
    Span::end()
    Span::Get()
    Span::IsInvalid()
    Span::IsValid()
    Span::Length()
    Span::operator[](int32 index)
    Span::Slice(int32 start)
    Span::Slice(int32 start, int32 length)
    Span::Span()
    Span::Span(const T* data, int32 length)
    Assembly: FlaxEngine.dll
    File: Engine/Core/Types/DataContainer.h
    Syntax
    public class DataContainer<T> : public Span
    Type Parameters
    T

    Constructors

    ~DataContainer()

    Releases any allocated memory.

    Declaration
    public ~DataContainer()

    DataContainer()

    Initializes a new instance of the DataContainer class.

    Declaration
    public DataContainer()

    DataContainer(const Array<T, AllocationType>& data)

    Initializes a new instance of the DataContainer class.

    Declaration
    public DataContainer(const Array<T, AllocationType>& data)
    Parameters
    Array<T, AllocationType> data

    The data array to link.

    Type Parameters
    typename AllocationType

    DataContainer(const DataContainer& other)

    Copy constructor

    Declaration
    public DataContainer(const DataContainer& other)
    Parameters
    DataContainer other

    Other container to copy

    DataContainer(const Span<T>& data)

    Initializes a new instance of the DataContainer class.

    Declaration
    public DataContainer(const Span<T>& data)
    Parameters
    Span<T> data

    The data span to link.

    DataContainer(const T* data, int32 length)

    Initializes a new instance of the DataContainer class.

    Declaration
    public DataContainer(const T* data, int32 length)
    Parameters
    T data

    The data pointer to link.

    int32 length

    The data length.

    DataContainer(DataContainer&& other)

    Initializes a new instance of the DataContainer class.

    Declaration
    public DataContainer(DataContainer&& other) noexcept
    Parameters
    DataContainer other

    The other collection to move.

    Methods

    Allocate(const int32 length)

    Allocate a new memory chunk.

    Declaration
    public void Allocate(const int32 length)
    Parameters
    int32 length

    Length of the data (amount of T elements).

    Append(const T* data, int32 length)

    Appends the specified data at the end of the container. Will perform the data allocation.

    Declaration
    public void Append(const T* data, int32 length)
    Parameters
    T data

    The data.

    int32 length

    The length.

    Copy(const Array<T, AllocationType>& data)

    Copies the data to a new allocated chunk.

    Declaration
    public void Copy(const Array<T, AllocationType>& data)
    Parameters
    Array<T, AllocationType> data

    Data array to copy.

    Returns
    void

    Type Parameters
    typename AllocationType

    Copy(const DataContainer& data)

    Copies the data to a new allocated chunk.

    Declaration
    public void Copy(const DataContainer& data)
    Parameters
    DataContainer data

    Data to copy.

    Copy(const Span<T>& data)

    Copies the data to a new allocated chunk.

    Declaration
    public void Copy(const Span<T>& data)
    Parameters
    Span<T> data

    Data to copy.

    Copy(const T* data, int32 length)

    Copies the data to a new allocated chunk.

    Declaration
    public void Copy(const T* data, int32 length)
    Parameters
    T data

    Pointer to data to copy.

    int32 length

    Length of the data (amount of T elements).

    Copy(const U* data)

    Copies the data to a new allocated chunk.

    Declaration
    public void Copy(const U* data)
    Parameters
    U data

    Pointer to data to copy.

    Returns
    void

    Type Parameters
    typename U

    IsAllocated()

    Returns true if data is allocated by container itself, otherwise it's just linked.

    Declaration
    public bool IsAllocated() const
    Returns
    bool

    Link(const Array<T, AllocationType>& data)

    Links the external data.

    Declaration
    public void Link(const Array<T, AllocationType>& data)
    Parameters
    Array<T, AllocationType> data

    Data array to link

    Type Parameters
    typename AllocationType

    Link(const DataContainer& data)

    Links the external data.

    Declaration
    public void Link(const DataContainer& data)
    Parameters
    DataContainer data

    Data to link.

    Returns
    void

    Link(const Span<T>& data)

    Links the external data.

    Declaration
    public void Link(const Span<T>& data)
    Parameters
    Span<T> data

    Data to link.

    Returns
    void

    Link(const T* data, int32 length)

    Links the external data.

    Declaration
    public void Link(const T* data, int32 length)
    Parameters
    T data

    Data pointer.

    int32 length

    Data length.

    Link(const U* data)

    Links external data.

    Declaration
    public void Link(const U* data)
    Parameters
    U data

    Data to link.

    Returns
    void

    Type Parameters
    typename U

    operator=(const DataContainer& other)

    Assignment operator

    Declaration
    public DataContainer operator=(const DataContainer& other)
    Parameters
    DataContainer other

    The other container.

    Returns
    DataContainer

    This

    operator=(DataContainer&& other)

    The move assignment operator that deletes the current container of data and the moves items from the other container.

    Declaration
    public DataContainer operator=(DataContainer&& other) noexcept
    Parameters
    DataContainer other

    The other collection to move.

    Returns
    DataContainer

    The reference to this.

    Read(ReadStream* stream, int32 length)

    Declaration
    public void Read(ReadStream* stream, int32 length)
    Parameters
    ReadStream stream

    int32 length

    Type Parameters
    typename ReadStream

    Release()

    Releases the data.

    Declaration
    public void Release()

    SetLength(int32 length)

    Sets the length of the internal allocated buffer. Can be used to trim length allocated data without performing reallocation. Use with caution because it's not safe.

    Declaration
    public void SetLength(int32 length)
    Parameters
    int32 length

    The length.

    Swap(DataContainer& data)

    Swaps data of two containers. Performs no data copy.

    Declaration
    public void Swap(DataContainer& data)
    Parameters
    DataContainer data

    Data to swap

    Unlink()

    Unlinks the buffer and clears the length to zero. Use with caution because it's not safe.

    Declaration
    public void Unlink()

    Write(WriteStream* stream)

    Declaration
    public void Write(WriteStream* stream) const
    Parameters
    WriteStream stream

    Type Parameters
    typename WriteStream

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat