FuncDoodle
Loading...
Searching...
No Matches
FuncDoodle::LongIndexArray Class Reference

Dynamic array of Frame objects for animation storage. More...

#include <DynArr.h>

Public Member Functions

 LongIndexArray (int width, int height, Col bgCol, uint64_t initialcap=10)
 Creates a frame array with default empty frames.
 ~LongIndexArray ()
void PushBack (const Frame *value)
 Appends a copy of a frame.
void PushBackEmpty ()
 Appends a newly created empty frame.
void InsertAfterEmpty (uint64_t index)
 Inserts an empty frame after an index.
void InsertBeforeEmpty (uint64_t index)
 Inserts an empty frame before an index.
void InsertAfter (uint64_t index, const Frame *value)
 Inserts a frame copy after an index.
void InsertAfter (uint64_t index, Frame val)
 Inserts a frame value after an index.
void InsertBefore (uint64_t index, const Frame *value)
 Inserts a frame copy before an index.
void InsertBefore (uint64_t index, Frame val)
 Inserts a frame value before an index.
void MoveBackward (uint64_t i)
 Moves a frame one slot toward the beginning.
void MoveForward (uint64_t i)
 Moves a frame one slot toward the end.
void Remove (uint64_t index)
 Removes a frame at an index.
Frameoperator[] (uint64_t index)
 Returns mutable frame access by index.
const Frameoperator[] (uint64_t index) const
 Returns immutable frame access by index.
FrameGet (uint64_t index)
 Returns mutable frame access by index.
uint64_t Size () const
 Returns the number of stored frames.
uint64_t Capacity () const
 Returns the reserved frame capacity.

Private Member Functions

void Resize (uint64_t newCap)

Private Attributes

std::vector< Framem_Data
uint64_t m_Capacity
uint64_t size = 0
int m_Width
int m_Height
Col m_BG

Detailed Description

Dynamic array of Frame objects for animation storage.

Ordered container holding all frames in an animation. Provides O(1) random access by index, amortized O(1) push to end, and O(n) insert/remove. Owns the frame data - frames are copied on insert, owned and destructed on remove.

Invariant
size

Constructor & Destructor Documentation

◆ LongIndexArray()

FuncDoodle::LongIndexArray::LongIndexArray ( int width,
int height,
Col bgCol,
uint64_t initialcap = 10 )

Creates a frame array with default empty frames.

Parameters
widthWidth used for newly created empty frames.
heightHeight used for newly created empty frames.
bgColBackground color used for empty frames.
initial_capacityInitial reserved frame capacity.

◆ ~LongIndexArray()

FuncDoodle::LongIndexArray::~LongIndexArray ( )
default

Member Function Documentation

◆ Capacity()

uint64_t FuncDoodle::LongIndexArray::Capacity ( ) const
inlinenodiscard

Returns the reserved frame capacity.

Returns
Current capacity.

◆ Get()

Frame * FuncDoodle::LongIndexArray::Get ( uint64_t index)

Returns mutable frame access by index.

Parameters
indexFrame index.
Returns
Pointer to the frame.

◆ InsertAfter() [1/2]

void FuncDoodle::LongIndexArray::InsertAfter ( uint64_t index,
const Frame * value )

Inserts a frame copy after an index.

Parameters
indexIndex after which to insert.
valueFrame to copy.

◆ InsertAfter() [2/2]

void FuncDoodle::LongIndexArray::InsertAfter ( uint64_t index,
Frame val )

Inserts a frame value after an index.

Parameters
indexIndex after which to insert.
valFrame value to copy.

◆ InsertAfterEmpty()

void FuncDoodle::LongIndexArray::InsertAfterEmpty ( uint64_t index)

Inserts an empty frame after an index.

Parameters
indexIndex after which to insert.

◆ InsertBefore() [1/2]

void FuncDoodle::LongIndexArray::InsertBefore ( uint64_t index,
const Frame * value )

Inserts a frame copy before an index.

Parameters
indexIndex before which to insert.
valueFrame to copy.

◆ InsertBefore() [2/2]

void FuncDoodle::LongIndexArray::InsertBefore ( uint64_t index,
Frame val )

Inserts a frame value before an index.

Parameters
indexIndex before which to insert.
valFrame value to copy.

◆ InsertBeforeEmpty()

void FuncDoodle::LongIndexArray::InsertBeforeEmpty ( uint64_t index)

Inserts an empty frame before an index.

Parameters
indexIndex before which to insert.

◆ MoveBackward()

void FuncDoodle::LongIndexArray::MoveBackward ( uint64_t i)

Moves a frame one slot toward the beginning.

Parameters
iIndex to move.

◆ MoveForward()

void FuncDoodle::LongIndexArray::MoveForward ( uint64_t i)

Moves a frame one slot toward the end.

Parameters
iIndex to move.

◆ operator[]() [1/2]

Frame * FuncDoodle::LongIndexArray::operator[] ( uint64_t index)

Returns mutable frame access by index.

Parameters
indexFrame index.
Returns
Pointer to the frame.

◆ operator[]() [2/2]

const Frame * FuncDoodle::LongIndexArray::operator[] ( uint64_t index) const

Returns immutable frame access by index.

Parameters
indexFrame index.
Returns
Pointer to the frame.

◆ PushBack()

void FuncDoodle::LongIndexArray::PushBack ( const Frame * value)

Appends a copy of a frame.

Parameters
valueFrame to append.

◆ PushBackEmpty()

void FuncDoodle::LongIndexArray::PushBackEmpty ( )

Appends a newly created empty frame.

◆ Remove()

void FuncDoodle::LongIndexArray::Remove ( uint64_t index)

Removes a frame at an index.

Parameters
indexIndex to remove.

◆ Resize()

void FuncDoodle::LongIndexArray::Resize ( uint64_t newCap)
private

◆ Size()

uint64_t FuncDoodle::LongIndexArray::Size ( ) const
inlinenodiscard

Returns the number of stored frames.

Returns
Current frame count.

Member Data Documentation

◆ m_BG

Col FuncDoodle::LongIndexArray::m_BG
private

◆ m_Capacity

uint64_t FuncDoodle::LongIndexArray::m_Capacity
private

◆ m_Data

std::vector<Frame> FuncDoodle::LongIndexArray::m_Data
private

◆ m_Height

int FuncDoodle::LongIndexArray::m_Height
private

◆ m_Width

int FuncDoodle::LongIndexArray::m_Width
private

◆ size

uint64_t FuncDoodle::LongIndexArray::size = 0
private

The documentation for this class was generated from the following files: