CoinArrayWithLength

Pointer with length in bytes.

Pointer with length in bytes.

Derived classes: CoinArbitraryArrayWithLength, CoinBigIndexArrayWithLength, CoinDoubleArrayWithLength, CoinFactorizationDoubleArrayWithLength, CoinFactorizationLongDoubleArrayWithLength, CoinIntArrayWithLength, CoinUnsignedIntArrayWithLength, CoinVoidStarArrayWithLength

Description

This has a pointer to an array and the number of bytes in array. If number of bytes==-1 then CoinConditionalNew deletes existing pointer and returns new pointer of correct size (and number bytes still -1). CoinConditionalDelete deletes existing pointer and NULLs it. So behavior is as normal (apart from New deleting pointer which will have no effect with good coding practices. If number of bytes >=0 then CoinConditionalNew just returns existing pointer if array big enough otherwise deletes existing pointer, allocates array with spare 1%+64 bytes and updates number of bytes CoinConditionalDelete sets number of bytes = -size-2 and then array returns NULL

Public Methods

getSize

Get the size.

CoinBigIndex getSize()

rawSize

Get the size.

CoinBigIndex rawSize()

switchedOn

See if persistence already on.

bool switchedOn()

capacity

Get the capacity (just read it)

CoinBigIndex capacity()

setCapacity

Set the capacity to >=0 if <=-2.

void setCapacity()

array

Get Array.

const char * array()

setSize

Set the size.

void setSize(CoinByteArray value)

Parameters:

switchOff

Set the size to -1.

void switchOff()

switchOn

Set the size to -2 and alignment.

void switchOn(int alignment = 3)

Parameters:

setPersistence

Does what is needed to set persistence.

void setPersistence(int flag, CoinByteArray currentLength)

Parameters:

clear

Zero out array.

void clear()

swap

Swaps memory between two members.

void swap(CoinArrayWithLength & other)

Parameters:

extend

Extend a persistent array keeping data (size in bytes)

void extend(CoinByteArray newSize)

Parameters:

conditionalNew

Conditionally gets new array.

char * conditionalNew(CoinByteArray sizeWanted)

Parameters:

conditionalDelete

Conditionally deletes.

void conditionalDelete()

CoinArrayWithLength

Default constructor - NULL.

 CoinArrayWithLength()

CoinArrayWithLength

Alternate Constructor - length in bytes - size_ -1.

 CoinArrayWithLength(CoinByteArray size)

Parameters:

CoinArrayWithLength

Alternate Constructor - length in bytes mode - 0 size_ set to size mode>0 size_ set to size and zeroed if size<=0 just does alignment If abs(mode) >2 then align on that as power of 2.

 CoinArrayWithLength(CoinByteArray size, int mode)

Parameters:

CoinArrayWithLength

Copy constructor.

 CoinArrayWithLength(const CoinArrayWithLength & rhs)

Parameters:

CoinArrayWithLength

Copy constructor.2.

 CoinArrayWithLength(const CoinArrayWithLength * rhs)

Parameters:

operator=

Assignment operator.

CoinArrayWithLength & operator=(const CoinArrayWithLength & rhs)

Parameters:

copy

Assignment with length (if -1 use internal length)

void copy(const CoinArrayWithLength & rhs, CoinByteArray numberBytes = -1)

Parameters:

allocate

Assignment with length - does not copy.

void allocate(const CoinArrayWithLength & rhs, CoinByteArray numberBytes)

Parameters:

~CoinArrayWithLength

Destructor.

 ~CoinArrayWithLength()

getArray

Get array with alignment.

void getArray(CoinByteArray size)

Parameters:

reallyFreeArray

Really get rid of array with alignment.

void reallyFreeArray()

getCapacity

Get enough space (if more needed then do at least needed)

void getCapacity(CoinByteArray numberBytes, CoinByteArray numberIfNeeded = -1)

Parameters:

Source

Header: layer-0/CoinUtils/src/CoinIndexedVector.hpp