- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# CoinArrayWithLength Class Reference

Pointer with length in bytes. More...

`#include <CoinIndexedVector.hpp>`

Inheritance diagram for CoinArrayWithLength:

[legend]
List of all members.

## Public Member Functions
Get methods.
int | getSize () const
| Get the size.
bool | switchedOn () const
| See if persistence already on.
int | getCapacity () const
| Get the capacity.
void | setCapacity ()
| Set the capacity to >=0 if <=-2.
const char * | array () const
| Get Array.
Set methods
void | setSize (int value)
| Set the size.
void | switchOff ()
| Set the size to -1.
void | setPersistence (int flag, int currentLength)
| Does what is needed to set persistence.
void | clear ()
| Zero out array.
void | swap (CoinArrayWithLength &other)
| Swaps memory between two members.
void | extend (int newSize)
| Extend a persistent array keeping data (size in bytes).
Condition methods
char * | conditionalNew (long sizeWanted)
| Conditionally gets new array.
void | conditionalDelete ()
| Conditionally deletes.
Constructors and destructors
| CoinArrayWithLength ()
| Default constructor - NULL.
| CoinArrayWithLength (int size)
| Alternate Constructor - length in bytes - size_ -1.
| CoinArrayWithLength (int size, int mode)
| Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed.
| CoinArrayWithLength (const CoinArrayWithLength &rhs)
| Copy constructor.
| CoinArrayWithLength (const CoinArrayWithLength *rhs)
| Copy constructor.2.
CoinArrayWithLength & | operator= (const CoinArrayWithLength &rhs)
| Assignment operator.
void | copy (const CoinArrayWithLength &rhs, int numberBytes=-1)
| Assignment with length (if -1 use internal length).
void | allocate (const CoinArrayWithLength &rhs, int numberBytes)
| Assignment with length - does not copy.
| ~CoinArrayWithLength ()
| Destructor.
## Protected Attributes
Private member data
char * | array_
| Array.
int | size_
| Size of array in bytes.

## Detailed Description

Pointer with length in bytes.

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

Definition at line 463 of file CoinIndexedVector.hpp.

## Constructor & Destructor Documentation

CoinArrayWithLength::CoinArrayWithLength | ( |  | ) | `[inline]`

Default constructor - NULL.

Definition at line 514 of file CoinIndexedVector.hpp.

References array_, and size_.

CoinArrayWithLength::CoinArrayWithLength | ( | int | size | ) | `[inline]`

Alternate Constructor - length in bytes - size_ -1.

Definition at line 517 of file CoinIndexedVector.hpp.

References array_, and size_.

CoinArrayWithLength::CoinArrayWithLength | ( | int | size,
|  | int | mode |
| ) |  |  | `[inline]`

Alternate Constructor - length in bytes mode - 0 size_ set to size 1 size_ set to size and zeroed.

Definition at line 523 of file CoinIndexedVector.hpp.

References array_, and size_.

CoinArrayWithLength::CoinArrayWithLength | ( | const CoinArrayWithLength & | rhs | ) |

Copy constructor.

CoinArrayWithLength::CoinArrayWithLength | ( | const CoinArrayWithLength * | rhs | ) |

Copy constructor.2.

CoinArrayWithLength::~CoinArrayWithLength | ( |  | ) | `[inline]`

Destructor.

Definition at line 536 of file CoinIndexedVector.hpp.

References array_.

## Member Function Documentation

int CoinArrayWithLength::getSize | ( |  | ) | const`[inline]`

Get the size.

Reimplemented in CoinDoubleArrayWithLength, CoinIntArrayWithLength, CoinBigIndexArrayWithLength, and CoinUnsignedIntArrayWithLength.

Definition at line 469 of file CoinIndexedVector.hpp.

References size_.

bool CoinArrayWithLength::switchedOn | ( |  | ) | const`[inline]`

See if persistence already on.

Definition at line 472 of file CoinIndexedVector.hpp.

References size_.

int CoinArrayWithLength::getCapacity | ( |  | ) | const`[inline]`

Get the capacity.

Definition at line 475 of file CoinIndexedVector.hpp.

References size_.

void CoinArrayWithLength::setCapacity | ( |  | ) | `[inline]`

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

Definition at line 478 of file CoinIndexedVector.hpp.

References size_.

const char* CoinArrayWithLength::array | ( |  | ) | const`[inline]`

Get Array.

Reimplemented in CoinDoubleArrayWithLength, CoinIntArrayWithLength, CoinBigIndexArrayWithLength, and CoinUnsignedIntArrayWithLength.

Definition at line 481 of file CoinIndexedVector.hpp.

References array_, and size_.

void CoinArrayWithLength::setSize | ( | int | value | ) | `[inline]`

Set the size.

Reimplemented in CoinDoubleArrayWithLength, CoinIntArrayWithLength, CoinBigIndexArrayWithLength, and CoinUnsignedIntArrayWithLength.

Definition at line 488 of file CoinIndexedVector.hpp.

References size_.

void CoinArrayWithLength::switchOff | ( |  | ) | `[inline]`

Set the size to -1.

Definition at line 491 of file CoinIndexedVector.hpp.

References size_.

void CoinArrayWithLength::setPersistence | ( | int | flag,
|  | int | currentLength |
| ) |  |  |

Does what is needed to set persistence.

void CoinArrayWithLength::clear | ( |  | ) |

Zero out array.

void CoinArrayWithLength::swap | ( | CoinArrayWithLength & | other | ) |

Swaps memory between two members.

void CoinArrayWithLength::extend | ( | int | newSize | ) |

Extend a persistent array keeping data (size in bytes).

char* CoinArrayWithLength::conditionalNew | ( | long | sizeWanted | ) |

Conditionally gets new array.

Referenced by CoinUnsignedIntArrayWithLength::conditionalNew(), CoinBigIndexArrayWithLength::conditionalNew(), CoinIntArrayWithLength::conditionalNew(), and CoinDoubleArrayWithLength::conditionalNew().

void CoinArrayWithLength::conditionalDelete | ( |  | ) |

Conditionally deletes.

CoinArrayWithLength& CoinArrayWithLength::operator= | ( | const CoinArrayWithLength & | rhs | ) |

Assignment operator.

Referenced by CoinUnsignedIntArrayWithLength::operator=(), CoinBigIndexArrayWithLength::operator=(), CoinIntArrayWithLength::operator=(), and CoinDoubleArrayWithLength::operator=().

void CoinArrayWithLength::copy | ( | const CoinArrayWithLength & | rhs,
|  | int | numberBytes = `-1` |
| ) |  |  |

Assignment with length (if -1 use internal length).

void CoinArrayWithLength::allocate | ( | const CoinArrayWithLength & | rhs,
|  | int | numberBytes |
| ) |  |  |

Assignment with length - does not copy.

## Member Data Documentation

char* CoinArrayWithLength::array_`[protected]`

Array.

Definition at line 545 of file CoinIndexedVector.hpp.

Referenced by CoinUnsignedIntArrayWithLength::array(), CoinBigIndexArrayWithLength::array(), CoinIntArrayWithLength::array(), CoinDoubleArrayWithLength::array(), array(), CoinArrayWithLength(), CoinBigIndexArrayWithLength::CoinBigIndexArrayWithLength(), CoinDoubleArrayWithLength::CoinDoubleArrayWithLength(), CoinIntArrayWithLength::CoinIntArrayWithLength(), CoinUnsignedIntArrayWithLength::CoinUnsignedIntArrayWithLength(), and ~CoinArrayWithLength().

int CoinArrayWithLength::size_`[protected]`

Size of array in bytes.

Definition at line 547 of file CoinIndexedVector.hpp.

Referenced by CoinUnsignedIntArrayWithLength::array(), CoinBigIndexArrayWithLength::array(), CoinIntArrayWithLength::array(), CoinDoubleArrayWithLength::array(), array(), CoinArrayWithLength(), CoinBigIndexArrayWithLength::CoinBigIndexArrayWithLength(), CoinDoubleArrayWithLength::CoinDoubleArrayWithLength(), CoinIntArrayWithLength::CoinIntArrayWithLength(), CoinUnsignedIntArrayWithLength::CoinUnsignedIntArrayWithLength(), getCapacity(), CoinUnsignedIntArrayWithLength::getSize(), CoinBigIndexArrayWithLength::getSize(), CoinIntArrayWithLength::getSize(), CoinDoubleArrayWithLength::getSize(), getSize(), setCapacity(), CoinUnsignedIntArrayWithLength::setSize(), CoinBigIndexArrayWithLength::setSize(), CoinIntArrayWithLength::setSize(), CoinDoubleArrayWithLength::setSize(), setSize(), switchedOn(), and switchOff().

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

- /home/coin/SVN-release/Osi-0.98.1/CoinUtils/src/CoinIndexedVector.hpp