Falcon::CoreTable Class Reference

#include <coretable.h>

Inheritance diagram for Falcon::CoreTable:

Inheritance graph
[legend]

List of all members.

Public Types

enum  { noitem = 0xFFFFFFFF }

Public Member Functions

virtual void append (const Item &data)
 Append an item at the end of the sequence.
virtual const Itemback () const
 Returns the first element of the sequence.
numericbiddings () const
 Returns bidding results.
uint32 biddingsSize () const
 Returns max size of the biddings array.
virtual void clear ()
 Removes all the raws in the current page.
virtual FalconDataclone () const
 Deletes the list.
void columnData (uint32 pos, const Item &data)
 Sets nth column-wide data in the table.
ItemcolumnData (uint32 pos)
 Returns nth column-wide data in the table.
const ItemcolumnData (uint32 pos) const
 Returns nth column-wide data in the table (const).
 CoreTable (const CoreTable &other)
 CoreTable ()
CoreArraycurrentPage () const
uint32 currentPageId () const
virtual bool empty () const
 Tells if the list is empty.
virtual const Itemfront () const
 Returns the first element of the sequence.
virtual void gcMark (uint32 mark)
 Perform marking of items stored in the table.
ItemgetHeaderData (const String &name) const
ItemgetHeaderData (uint32 pos) const
uint32 getHeaderPos (const String &name) const
const Stringheading (uint32 pos) const
 Returns the nth heading (column title).
void insertColumn (uint32 pos, const String &name, const Item &data, const Item &dflt)
 Inserts a colum in the table.
bool insertPage (CoreObject *self, CoreArray *data, uint32 pos=noitem)
 Inserts a page.
bool insertRow (CoreArray *ca, uint32 pos=noitem, uint32 page=noitem)
 Inserts a new row in a page.
uint32 order () const
 Returns the order (number of colums) in the table.
CoreArraypage (uint32 num) const
uint32 pageCount () const
virtual void prepend (const Item &data)
 Prepend an item at the beginning of the sequence.
bool removeColumn (uint32 pos)
 Removes a colum from the table.
bool removePage (uint32 pos)
 Removes a page.
bool removeRow (uint32 pos, uint32 page=noitem)
 Removes a row.
void renameColumn (uint32 pos, const String &name)
 Rename a colunm.
void reserveBiddings (uint32 size)
bool setCurrentPage (uint32 num)
bool setHeader (CoreArray *header)
virtual ~CoreTable ()

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 prev (Iterator &iter) const


Member Enumeration Documentation

anonymous enum

Enumerator:
noitem 


Constructor & Destructor Documentation

Falcon::CoreTable::CoreTable (  ) 

Falcon::CoreTable::CoreTable ( const CoreTable other  ) 

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


Member Function Documentation

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

Append an item at the end of the sequence.

Implements Falcon::Sequence.

virtual const Item& Falcon::CoreTable::back (  )  const [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.

numeric* Falcon::CoreTable::biddings (  )  const [inline]

Returns bidding results.

Must be initialized with makebiddings().

uint32 Falcon::CoreTable::biddingsSize (  )  const [inline]

Returns max size of the biddings array.

virtual void Falcon::CoreTable::clear (  )  [virtual]

Removes all the raws in the current page.

Implements Falcon::Sequence.

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

Deletes the list.

Items are shallowly destroyed.

Implements Falcon::FalconData.

void Falcon::CoreTable::columnData ( uint32  pos,
const Item data 
) [inline]

Sets nth column-wide data in the table.

Using an incorrect (greater than order) position parameter will crash.

References fassert, order(), and Falcon::GenericVector::set().

Item& Falcon::CoreTable::columnData ( uint32  pos  )  [inline]

Returns nth column-wide data in the table.

Using an incorrect (greater than order) position parameter will crash.

References Falcon::GenericVector::at(), fassert, and order().

const Item& Falcon::CoreTable::columnData ( uint32  pos  )  const [inline]

Returns nth column-wide data in the table (const).

Using an incorrect (greater than order) position parameter will crash.

References Falcon::GenericVector::at(), fassert, and order().

virtual void Falcon::CoreTable::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.

CoreArray* Falcon::CoreTable::currentPage (  )  const [inline]

uint32 Falcon::CoreTable::currentPageId (  )  const [inline]

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

Tells if the list is empty.

Returns:
true if the list is empty.

Implements Falcon::Sequence.

References Falcon::CoreArray::length().

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

Implements Falcon::Sequence.

virtual void Falcon::CoreTable::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.

virtual const Item& Falcon::CoreTable::front (  )  const [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::CoreTable::gcMark ( uint32  mark  )  [virtual]

Perform marking of items stored in the table.

Reimplemented from Falcon::Sequence.

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

Implements Falcon::Sequence.

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

Implements Falcon::Sequence.

Item* Falcon::CoreTable::getHeaderData ( const String name  )  const [inline]

Item* Falcon::CoreTable::getHeaderData ( uint32  pos  )  const

Referenced by getHeaderData().

uint32 Falcon::CoreTable::getHeaderPos ( const String name  )  const

Referenced by getHeaderData().

virtual void Falcon::CoreTable::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::CoreTable::hasCurrent ( const Iterator iter  )  const [protected, virtual]

Implements Falcon::Sequence.

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

Implements Falcon::Sequence.

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

Implements Falcon::Sequence.

const String& Falcon::CoreTable::heading ( uint32  pos  )  const

Returns the nth heading (column title).

Using an incorrect (greater than order) position parameter will crash.

virtual void Falcon::CoreTable::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.

void Falcon::CoreTable::insertColumn ( uint32  pos,
const String name,
const Item data,
const Item dflt 
)

Inserts a colum in the table.

This alters the heading and all the pages, inserting a row of default items (can be nil) as the new column.

If pos >= order, the column will be appended at end.

Parameters:
pos The position where to add the column.
name The name of the column to be inserted.
data The column data, can be nil.
dflt The default value for inserted items; can be nil.

bool Falcon::CoreTable::insertPage ( CoreObject self,
CoreArray data,
uint32  pos = noitem 
)

Inserts a page.

The function checks if the array is actually a matrix with an order compatible with the table.

Parameters:
self The core object representing this table in the VM.
pos Where to insert the page. If greater than the number of pages, or set to noitem, will append the page at the end.
array An array to fill the page. Can be empty; otherwise, every element must be an array of the same order of this table.
Returns:
true if the page can be added, false if the given array wasn't of correct order.

bool Falcon::CoreTable::insertRow ( CoreArray ca,
uint32  pos = noitem,
uint32  page = noitem 
)

Inserts a new row in a page.

If the core array has not the same length of the order of this table, the function will fail.

Parameters:
pos The position at which to insert the row; will add it if position >= length.
ca The array to be added.
page The page into which the row must be added, set
Returns:
true on success

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

Implements Falcon::Sequence.

uint32 Falcon::CoreTable::order (  )  const [inline]

Returns the order (number of colums) in the table.

Referenced by columnData().

CoreArray* Falcon::CoreTable::page ( uint32  num  )  const [inline]

uint32 Falcon::CoreTable::pageCount (  )  const [inline]

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

Prepend an item at the beginning of the sequence.

Implements Falcon::Sequence.

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

Implements Falcon::Sequence.

bool Falcon::CoreTable::removeColumn ( uint32  pos  ) 

Removes a colum from the table.

This alters the heading and all the pages, removing the item at given position in all the arrays in every page.

Parameters:
pos The index of the column to be removed.
Returns:
true on success, false if pos >= order.

bool Falcon::CoreTable::removePage ( uint32  pos  ) 

Removes a page.

Parameters:
pos Which page to remove.
Returns:
true if the page can be remove, false the position is invalid.

bool Falcon::CoreTable::removeRow ( uint32  pos,
uint32  page = noitem 
)

Removes a row.

Parameters:
pos The position at which to remove the row.
page The page into which the row must be remove, set
Returns:
true on success

void Falcon::CoreTable::renameColumn ( uint32  pos,
const String name 
)

Rename a colunm.

Parameters:
pos Column to be renamed.
name The new name for the given column.

void Falcon::CoreTable::reserveBiddings ( uint32  size  ) 

bool Falcon::CoreTable::setCurrentPage ( uint32  num  )  [inline]

bool Falcon::CoreTable::setHeader ( CoreArray header  ) 


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

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