Falcon::ItemArray Class Reference

#include <itemarray.h>

Inheritance diagram for Falcon::ItemArray:

Inheritance graph
[legend]

List of all members.

Public Member Functions

void allocated (uint32 size)
uint32 allocated () const
virtual void append (const Item &ndata)
 Append an item at the end of the sequence.
virtual Itemat (int32 pos)
virtual const Itemat (int32 pos) const
virtual const Itemback () const
 Returns the first element of the sequence.
bool change (const ItemArray &other, int32 begin, int32 end)
virtual void clear ()
 Removes all the items in the sequence.
virtual FalconDataclone () const
void compact ()
 Reduce the memory used by this array to exactly its size.
bool copyOnto (const ItemArray &src, uint32 first=0, uint32 amount=0xFFFFFFFF)
 Copy part or all of another vector on this vector.
bool copyOnto (uint32 from, const ItemArray &src, uint32 first=0, uint32 amount=0xFFFFFFFF)
 Copy part or all of another vector on this vector.
void elements (Item *d)
Itemelements () const
virtual bool empty () const
 Tells if the series is empty.
int32 esize (int32 count=1) const
 An inline utility to compute element size.
int32 find (const Item &itm) const
virtual const Itemfront () const
 Returns the first element of the sequence.
virtual void gcMark (uint32 mark)
bool insert (const ItemArray &other, int32 pos)
bool insert (const Item &ndata, int32 pos)
bool insertSpace (uint32 pos, uint32 size)
 ItemArray (uint32 prealloc)
 ItemArray (const ItemArray &other)
 ItemArray ()
void length (uint32 size)
uint32 length () const
void merge (const ItemArray &other)
void merge_front (const ItemArray &other)
const Itemoperator[] (int32 pos) const throw ()
Itemoperator[] (int32 pos) throw ()
ItemArraypartition (int32 start, int32 end) const
virtual void prepend (const Item &ndata)
 Prepend an item at the beginning of the sequence.
bool remove (int32 first, int32 last)
bool remove (int32 pos)
void reserve (uint32 size)
void resize (uint32 size)
virtual ~ItemArray ()

Protected Member Functions

virtual void copyIterator (Iterator &tgt, const Iterator &source) const
 Copy an iterator so that the two points to the same item.
virtual bool equalIterator (const Iterator &first, const Iterator &second) const
virtual void erase (Iterator &iter)
 Deletes the element at position indicated by the iterator.
virtual ItemgetCurrent (const Iterator &iter)
virtual ItemgetCurrentKey (const Iterator &iter)
virtual void getIterator (Iterator &tgt, bool tail=false) const
 Gets an Iterator valid for this sequence.
virtual bool hasCurrent (const Iterator &iter) const
virtual bool hasNext (const Iterator &iter) const
virtual bool hasPrev (const Iterator &iter) const
virtual void insert (Iterator &iter, const Item &data)
 Inserts an element in a position indicated by the iterator.
virtual bool next (Iterator &iter) const
virtual bool onCriterion (Iterator *elem) const
 Criterion called back by disposeIteratorOnCriterion().
virtual bool prev (Iterator &iter) const

Friends

class CoreArray
class CoreTable


Constructor & Destructor Documentation

Falcon::ItemArray::ItemArray (  ) 

Falcon::ItemArray::ItemArray ( const ItemArray other  ) 

Falcon::ItemArray::ItemArray ( uint32  prealloc  ) 

virtual Falcon::ItemArray::~ItemArray (  )  [virtual]


Member Function Documentation

void Falcon::ItemArray::allocated ( uint32  size  )  [inline]

uint32 Falcon::ItemArray::allocated (  )  const [inline]

virtual void Falcon::ItemArray::append ( const Item data  )  [virtual]

Append an item at the end of the sequence.

Implements Falcon::Sequence.

virtual Item& Falcon::ItemArray::at ( int32  pos  )  [inline, virtual]

virtual const Item& Falcon::ItemArray::at ( int32  pos  )  const [inline, virtual]

virtual const Item& Falcon::ItemArray::back (  )  const [inline, virtual]

Returns the first element of the sequence.

If the sequence has not an underlying storage, it may generate a temporary item, as the item is immediately copied into some destination by the caller.

This method is never used by the engine to modify the underlying item.

Guarantees are taken so that this method is never called when v_empty() returns false.

Returns:
a valid reference to the first item of the sequence

Implements Falcon::Sequence.

bool Falcon::ItemArray::change ( const ItemArray other,
int32  begin,
int32  end 
)

virtual void Falcon::ItemArray::clear (  )  [inline, virtual]

Removes all the items in the sequence.

Implements Falcon::Sequence.

virtual FalconData* Falcon::ItemArray::clone (  )  const [virtual]

Implements Falcon::FalconData.

void Falcon::ItemArray::compact (  ) 

Reduce the memory used by this array to exactly its size.

virtual void Falcon::ItemArray::copyIterator ( Iterator tgt,
const Iterator source 
) const [protected, virtual]

Copy an iterator so that the two points to the same item.

The source iterator may point to the past-end element, but must not be invalid.

Note:
The base version of this function just adds the iterator to the iterator list; it MUST be called by all the implementations.

Reimplemented from Falcon::Sequence.

bool Falcon::ItemArray::copyOnto ( const ItemArray src,
uint32  first = 0,
uint32  amount = 0xFFFFFFFF 
) [inline]

Copy part or all of another vector on this vector.

Shortcut for copyOnto starting from element 0 of this vector.

Parameters:
src The source array
first The first element in the array to be copied.
amount Number of elements to be copied.

bool Falcon::ItemArray::copyOnto ( uint32  from,
const ItemArray src,
uint32  first = 0,
uint32  amount = 0xFFFFFFFF 
)

Copy part or all of another vector on this vector.

This method performs a flat copy of another array into this one. It is possible to copy part of the target array, specifying the first and amount parameters. Also, it's possible to select a starting position different from the beginning through the from parameter.

If the from parameter is larger than the size of this array, or if the first parameter is larger than the size of the source array, the function returns false.

If the required amount of items to be copied is greater than the number of items in the source array (starting from the first), then it's rounded down to copy all the items starting from first.

If this array is not large enough to store all the items starting from the from parameter, it is enlarged.

Parameters:
from The first item from which to start copying.
src The source array
first The first element in the array to be copied.
amount Number of elements to be copied.

void Falcon::ItemArray::elements ( Item d  )  [inline]

Item* Falcon::ItemArray::elements (  )  const [inline]

virtual bool Falcon::ItemArray::empty (  )  const [inline, virtual]

Tells if the series is empty.

Returns:
false if there is at least one valid item in the series, false otherwise.

Implements Falcon::Sequence.

virtual bool Falcon::ItemArray::equalIterator ( const Iterator first,
const Iterator second 
) const [protected, virtual]

Implements Falcon::Sequence.

virtual void Falcon::ItemArray::erase ( Iterator iter  )  [protected, virtual]

Deletes the element at position indicated by the iterator.

The implementation must check that the iterator is a valid iterator created by this object and pointing to a valid position.

Deletion happens at given position, shifting all the remaining elements backward; after a successful erase, the iterator must point to the element that was previously next in the series, or must be invalidated if the removed element was the last.

If the sequence is empty or the iterator is invalid, an AccessError must be thrown. If the iterator is referencing another sequence, a CodeError must be thrown.

Parameters:
iter an iterator (possibly invalid or not generated by this class).
Returns:
true if the iterator was valid for this object.

Implements Falcon::Sequence.

int32 Falcon::ItemArray::esize ( int32  count = 1  )  const [inline]

An inline utility to compute element size.

Parameters:
count numbrer of elements
Returns:
the amout of bytes needed to store the elements

int32 Falcon::ItemArray::find ( const Item itm  )  const

virtual const Item& Falcon::ItemArray::front (  )  const [inline, virtual]

Returns the first element of the sequence.

If the sequence has not an underlying storage, it may generate a temporary item, as the item is immediately copied into some destination by the caller.

Guarantees are taken so that this method is never called when v_empty() returns false.

Returns:
a valid reference to the first item of the sequence

Implements Falcon::Sequence.

virtual void Falcon::ItemArray::gcMark ( uint32  mark  )  [virtual]

Reimplemented from Falcon::Sequence.

virtual Item& Falcon::ItemArray::getCurrent ( const Iterator iter  )  [protected, virtual]

Implements Falcon::Sequence.

virtual Item& Falcon::ItemArray::getCurrentKey ( const Iterator iter  )  [protected, virtual]

Implements Falcon::Sequence.

virtual void Falcon::ItemArray::getIterator ( Iterator tgt,
bool  tail = false 
) const [protected, virtual]

Gets an Iterator valid for this sequence.

If you need an iterator as a pointer or in the target stack, use Iterator( Sequence*, bool) instead.

The iterator constructor calls back this method to be configured.

It is possible to call this method thereafter to reset the iterator, even if it's gone invalid.

However, it is not legal to call this method with an iterator coming from another sequence; this will cause the program to throw a CodeError.

Note:
The base version of this function just adds the iterator to the iterator list; it MUST be called by all the implementations.
Parameters:
An Iterator to be set.
tail if false, get an iterator to the first element, else get an iterator to the last element.

Reimplemented from Falcon::Sequence.

virtual bool Falcon::ItemArray::hasCurrent ( const Iterator iter  )  const [protected, virtual]

Implements Falcon::Sequence.

virtual bool Falcon::ItemArray::hasNext ( const Iterator iter  )  const [protected, virtual]

Implements Falcon::Sequence.

virtual bool Falcon::ItemArray::hasPrev ( const Iterator iter  )  const [protected, virtual]

Implements Falcon::Sequence.

virtual void Falcon::ItemArray::insert ( Iterator iter,
const Item data 
) [protected, virtual]

Inserts an element in a position indicated by the iterator.

The implementation must check that the iterator is a valid iterator created by this object and pointing to a valid position.

Insertion happens at given position, shifting all the remaining elements forward; after a successful insert, the iterator must point to the newly inserted element, and the previously current element is found safely in the next() position of the iterator.

Valid iterators (generated by this owner) pointing to invalid positions must be treated as pointing to last-past-one element; insertion causes append on tail, and at return they must be valid and point to the last valid element (the one just inserted).

If the iterator cannot be used, for example because their owner is not this item, this method will raise a CodeError.

Parameters:
iterator an iterator.
data the item to be inserted
Returns:
true if the iterator was valid for this object.

Implements Falcon::Sequence.

bool Falcon::ItemArray::insert ( const ItemArray other,
int32  pos 
)

bool Falcon::ItemArray::insert ( const Item ndata,
int32  pos 
)

bool Falcon::ItemArray::insertSpace ( uint32  pos,
uint32  size 
)

void Falcon::ItemArray::length ( uint32  size  )  [inline]

uint32 Falcon::ItemArray::length (  )  const [inline]

void Falcon::ItemArray::merge ( const ItemArray other  ) 

void Falcon::ItemArray::merge_front ( const ItemArray other  ) 

virtual bool Falcon::ItemArray::next ( Iterator iter  )  const [protected, virtual]

Implements Falcon::Sequence.

virtual bool Falcon::ItemArray::onCriterion ( Iterator elem  )  const [protected, virtual]

Criterion called back by disposeIteratorOnCriterion().

Return true to remove this iterator, false to let it alive. Disposed iterators are removed from the iterator list of this sequence and invalidated.

Reimplemented from Falcon::Sequence.

const Item& Falcon::ItemArray::operator[] ( int32  pos  )  const throw () [inline]

Item& Falcon::ItemArray::operator[] ( int32  pos  )  throw () [inline]

ItemArray* Falcon::ItemArray::partition ( int32  start,
int32  end 
) const

virtual void Falcon::ItemArray::prepend ( const Item data  )  [virtual]

Prepend an item at the beginning of the sequence.

Implements Falcon::Sequence.

virtual bool Falcon::ItemArray::prev ( Iterator iter  )  const [protected, virtual]

Implements Falcon::Sequence.

bool Falcon::ItemArray::remove ( int32  first,
int32  last 
)

bool Falcon::ItemArray::remove ( int32  pos  ) 

void Falcon::ItemArray::reserve ( uint32  size  ) 

void Falcon::ItemArray::resize ( uint32  size  ) 


Friends And Related Function Documentation

friend class CoreArray [friend]

friend class CoreTable [friend]


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

Generated on Mon Oct 19 10:11:37 2009 for Falcon_Core by  doxygen 1.5.8