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, unsigned long 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 (unsigned long index)
 Inserts an empty frame after an index.
void InsertBeforeEmpty (unsigned long index)
 Inserts an empty frame before an index.
void InsertAfter (unsigned long index, const Frame *value)
 Inserts a frame copy after an index.
void InsertAfter (unsigned long index, Frame val)
 Inserts a frame value after an index.
void InsertBefore (unsigned long index, const Frame *value)
 Inserts a frame copy before an index.
void InsertBefore (unsigned long index, Frame val)
 Inserts a frame value before an index.
void MoveBackward (unsigned long i)
 Moves a frame one slot toward the beginning.
void MoveForward (unsigned long i)
 Moves a frame one slot toward the end.
void Remove (unsigned long index)
 Removes a frame at an index.
Frameoperator[] (unsigned long index)
 Returns mutable frame access by index.
const Frameoperator[] (unsigned long index) const
 Returns immutable frame access by index.
FrameGet (unsigned long index)
 Returns mutable frame access by index.
unsigned long Size () const
 Returns the number of stored frames.
unsigned long Capacity () const
 Returns the reserved frame capacity.

Private Member Functions

void Resize (unsigned long newCap)

Private Attributes

std::vector< Framem_Data
unsigned long m_Capacity
unsigned long 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,
unsigned long 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()

unsigned long FuncDoodle::LongIndexArray::Capacity ( ) const
inlinenodiscard

Returns the reserved frame capacity.

Returns
Current capacity.

◆ Get()

Frame * FuncDoodle::LongIndexArray::Get ( unsigned long index)

Returns mutable frame access by index.

Parameters
indexFrame index.
Returns
Pointer to the frame.

◆ InsertAfter() [1/2]

void FuncDoodle::LongIndexArray::InsertAfter ( unsigned long 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 ( unsigned long 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 ( unsigned long index)

Inserts an empty frame after an index.

Parameters
indexIndex after which to insert.

◆ InsertBefore() [1/2]

void FuncDoodle::LongIndexArray::InsertBefore ( unsigned long 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 ( unsigned long 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 ( unsigned long index)

Inserts an empty frame before an index.

Parameters
indexIndex before which to insert.

◆ MoveBackward()

void FuncDoodle::LongIndexArray::MoveBackward ( unsigned long i)

Moves a frame one slot toward the beginning.

Parameters
iIndex to move.

◆ MoveForward()

void FuncDoodle::LongIndexArray::MoveForward ( unsigned long i)

Moves a frame one slot toward the end.

Parameters
iIndex to move.

◆ operator[]() [1/2]

Frame * FuncDoodle::LongIndexArray::operator[] ( unsigned long index)

Returns mutable frame access by index.

Parameters
indexFrame index.
Returns
Pointer to the frame.

◆ operator[]() [2/2]

const Frame * FuncDoodle::LongIndexArray::operator[] ( unsigned long 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 ( unsigned long index)

Removes a frame at an index.

Parameters
indexIndex to remove.

◆ Resize()

void FuncDoodle::LongIndexArray::Resize ( unsigned long newCap)
private

◆ Size()

unsigned long 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

unsigned long 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

unsigned long FuncDoodle::LongIndexArray::size = 0
private

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