Ilwis-Objects  1.0
GIS and Remote Sensing framework for data access and processing
 All Classes Functions Enumerations Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Ilwis::FlatTable Class Reference
Inheritance diagram for Ilwis::FlatTable:
Ilwis::BaseTable Ilwis::Table Ilwis::IlwisObject Ilwis::Identity

Public Member Functions

 FlatTable ()
 
 FlatTable (const Resource &resource)
 
bool createTable ()
 
void newRecord ()
 
std::vector< QVariant > record (quint32 n) const
 
void record (quint32, const std::vector< QVariant > &vars, quint32 offset=0)
 
std::vector< QVariant > column (const QString &nme, quint32 start=0, quint32 stop=2e9) const
 
std::vector< QVariant > column (quint32 index, quint32 start=0, quint32 stop=2e9) const
 
void column (const QString &nme, const std::vector< QVariant > &vars, quint32 offset=0)
 
void column (quint32 index, const std::vector< QVariant > &vars, quint32 offset)
 
QVariant cell (const QString &col, quint32 rec, bool asRaw=true) const
 
QVariant cell (const quint32 index, quint32 rec, bool asRaw=true) const
 
void setCell (const QString &col, quint32 rec, const QVariant &var)
 
void setCell (quint32, quint32 rec, const QVariant &var)
 
bool prepare ()
 
bool isValid () const
 
bool addColumn (const QString &name, const IDomain &domain)
 
bool addColumn (const ColumnDefinition &def)
 
std::vector< quint32 > select (const QString &conditions) const
 
IlwisTypes ilwisType () const
 
IlwisObjectclone ()
 
- Public Member Functions inherited from Ilwis::BaseTable
 BaseTable ()
 
 BaseTable (const Resource &resource)
 
virtual quint32 recordCount () const
 
virtual quint32 columnCount () const
 
virtual void recordCount (quint32 r)
 
virtual bool addColumn (const QString &name, const QString &domainname)
 
ColumnDefinition columndefinition (const QString &nme) const
 
ColumnDefinition columndefinition (quint32 index) const
 
ColumnDefinitioncolumndefinition (quint32 index)
 
void columndefinition (const ColumnDefinition &coldef)
 
bool merge (const IlwisObject *obj, int options)
 
void dataLoaded (bool yesno)
 
bool isDataLoaded () const
 

Protected Member Functions

bool isColumnIndexValid (quint32 index) const
 
void copyTo (IlwisObject *obj)
 
bool initLoad ()
 
- Protected Member Functions inherited from Ilwis::BaseTable
virtual void adjustRange (int index)
 
void copyTo (IlwisObject *obj)
 
quint32 columnIndex (const QString &nme) const
 
void columnCount (int cnt)
 
QVariant checkInput (const QVariant &inputVar, quint32 columnIndex)
 
void initValuesColumn (const ColumnDefinition &def)
 
void initRecord (std::vector< QVariant > &values) const
 
- Protected Member Functions inherited from Ilwis::Table
 Table (const Resource &resource)
 
- Protected Member Functions inherited from Ilwis::IlwisObject
QScopedPointer
< ConnectorInterface > & 
connector (int mode=cmINPUT|cmOUTPUT)
 
const QScopedPointer
< ConnectorInterface > & 
connector (int mode=cmINPUT|cmOUTPUT) const
 
bool setValid (bool yesno)
 
void copyTo (IlwisObject *obj)
 
- Protected Member Functions inherited from Ilwis::Identity
 Identity (const QString &name, qint64 id=i64UNDEF, const QString &cde=sUNDEF, const QString &descr=sUNDEF)
 
void prepare (quint64 base=0)
 
void setId (quint64 newid)
 

Protected Attributes

std::vector< std::vector
< QVariant > > 
_datagrid
 
- Protected Attributes inherited from Ilwis::BaseTable
QHash< QString, ColumnDefinition_columnDefinitionsByName
 
QHash< quint32, ColumnDefinition_columnDefinitionsByIndex
 

Additional Inherited Members

- Public Types inherited from Ilwis::IlwisObject
enum  ConnectorMode { cmINPUT =1, cmOUTPUT =2, cmEXTENDED =4 }
 The ConnectorMode enum Describes the state of the instance of the connector. More...
 
enum  StoreMode { smMETADATA =1, smBINARYDATA =2 }
 
- Static Public Member Functions inherited from Ilwis::IlwisObject
template<typename T >
static T create (const QString &def)
 
template<typename T >
static T create (quint64 id)
 
static IlwisObjectcreate (const Resource &source, const PrepareOptions &options=PrepareOptions())
 
static IlwisTypes findType (const QString &source)
 findType More...
 
static QString type2Name (IlwisTypes t)
 
static IlwisTypes name2Type (const QString &name)
 
static void addTypeFunction (IlwisTypeFunction)
 addTypeFunction More...
 
static IlwisTypes name2ExtendedType (const QString &dname)
 

Constructor & Destructor Documentation

FlatTable::FlatTable ( )

Constructs an empty FlatTable

FlatTable::FlatTable ( const Resource resource)

The constructor for a FlatTable with a a Resource that is registered in the mastercatalog.
This resource must have a name and an Id.
Code and description are optional.

See Also
IlwisObject
Resource
Parameters
resourceThe resource to use

Member Function Documentation

bool FlatTable::addColumn ( const QString &  name,
const IDomain domain 
)
virtual

adds a column to the current set of columns of this table
the name string must be unique and the domain must be valid.
if this collumn creates a duplicate nothing will happen.
the collumn will be filled with appropriate defaults depending on the domain

See Also
IDomain
Parameters
namethe name of a column must be unique among the columns
domainthe domain of the new column
Returns
true if the column is succesfully added, false if some error occurred. The nature of the error can be found in the issue logger

Reimplemented from Ilwis::BaseTable.

bool FlatTable::addColumn ( const ColumnDefinition def)
virtual

adds a column to the column definitions.
ColumnDefinition must be valid.
The new column contents will be set to appropriate defaults depending on the domain

Parameters
defThe ColumnDefinition of the new column
Returns
true if succesful. Duplicate columns are not allowed

Reimplemented from Ilwis::BaseTable.

QVariant FlatTable::cell ( const QString &  col,
quint32  rec,
bool  asRaw = true 
) const
virtual

returns the value of a single record/field combination ( a cell).
Disabling asRaw (setting it to false) has negative effects on performance.

Parameters
colcolumn name
recrecord number
asRawwhen set to false it will return the String value on Thematic and Identifier domains
Returns
the value of the cell or an invalid qvariant if an error occured. The nature of the error can be found in the issue logger

Implements Ilwis::Table.

QVariant FlatTable::cell ( const quint32  index,
quint32  rec,
bool  asRaw = true 
) const
virtual

returns the value of a single record/field combination ( a cell).
Disabling asRaw (setting it to false) has negative effects on performance.

Parameters
indexcolumn index
asRawwhen set to false it will return the String value on Thematic and Identifier domains
recrecord number
Returns
the value of the cell or an invalid qvariant if an error occured. The nature of the error can be found in the issue logger

Implements Ilwis::Table.

std::vector< QVariant > FlatTable::column ( const QString &  nme,
quint32  start = 0,
quint32  stop = 2e9 
) const
virtual

returns the content of a column with a name in a vector. Will return an empty vector if there is no collumn with that name

Parameters
nmename of the column to be returned
startThe index at which it should start returning values(within the collumn)
stopThe index at which it should stop returning values(within the collumn)
Returns
A filled variantlist or an empty list if an error occurred. The nature of the error can be found in the issue logger

Implements Ilwis::Table.

std::vector< QVariant > FlatTable::column ( quint32  index,
quint32  start = 0,
quint32  stop = 2e9 
) const
virtual

returns the content of a column at a index in a vector. Will return an empty vector if there is no column with that name

Parameters
indexthe index of the column to be returned
startThe index at which it should start returning values(within the collumn)
stopThe index at which it should stop returning values(within the collumn)
Returns
A filled variantlist or an empty list if an error occurred. The nature of the error can be found in the issue logger

Implements Ilwis::Table.

void FlatTable::column ( const QString &  nme,
const std::vector< QVariant > &  vars,
quint32  offset = 0 
)
virtual

sets a column with values from variantlist. The list doesnt need to contain all the rows in a column but may contain a subset.
Note that the rows are in consecutive order.

Parameters
nmename of the column to be set
varsvalues of the rows
offsetstarting row form where the values are set. If the number of values to be added goes beyond the size of the table, new records will be added

Implements Ilwis::Table.

void FlatTable::column ( quint32  index,
const std::vector< QVariant > &  vars,
quint32  offset 
)
virtual

sets a column with values from variantlist. The list doesnt need to contain all the rows in a column but may contain a subset.
Note that the rows are in consecutive order.

Parameters
indexindex of the column to be set
varsvalues of the rows
offsetstarting row form where the values are set. If the number of values to be added goes beyond the size of the table, new records will be added

Implements Ilwis::Table.

bool FlatTable::createTable ( )
virtual

Creates a table based on the definitions in the columndefinition members. Will load the data in the specified amount of collumns and rows

Returns
true if succesfull

Reimplemented from Ilwis::BaseTable.

IlwisTypes FlatTable::ilwisType ( ) const
virtual

Gives the IlwisTypes of this object

See Also
IlwisObject
Returns
the IlwisTypes of this IlwisObject

Reimplemented from Ilwis::BaseTable.

bool FlatTable::isValid ( ) const
virtual

a BaseTable is valid if it has rows and columns

Returns
true when valid.

Reimplemented from Ilwis::BaseTable.

void FlatTable::newRecord ( )
virtual

Adds a new record to this table It will be filled with appropriate default values depending on the domain(s)

Implements Ilwis::Table.

bool FlatTable::prepare ( )
virtual

tries to Prepares this ilwisobject for use

Returns
true when the prepare succeeded

Reimplemented from Ilwis::BaseTable.

std::vector< QVariant > FlatTable::record ( quint32  n) const
virtual

retrieves a record from a table. A record contains all the fields for one row. This method is implemented in the derivatives
of table as how records are organized is quite different between the derivatives

Parameters
nthe row/record number of the record
Returns
A filled variantlist or an empty list if an error occurred. The nature of the error can be found in the issue logger

Implements Ilwis::Table.

void FlatTable::record ( quint32  rec,
const std::vector< QVariant > &  vars,
quint32  offset = 0 
)
virtual

sets a record with values from variantlist. The list doesnt need to contain all the fields in a record but may contain a subset.
Note that the fields are in consecutive order. It is up to the programmer that the order of fields in the list match the order of fields in the table

Parameters
recrecord that has to be updated. If the record number is beyond the last record or the record is iUNDEF, the record will appended to the end
varsthe list values to be set
offsetstarting point of the field to be set

Implements Ilwis::Table.

std::vector< quint32 > FlatTable::select ( const QString &  conditions) const
virtual

Selects the indices of all collumns that meet the conditions specified in the conditions String
so for example: if conditions is

col1 < 5 AND col2 == "two"


it will return all indices at which collumns 1 and 2 meet the requirements

This function is still under development, only the most basic expressions are implemented at this time

Parameters
conditions
Returns

Implements Ilwis::Table.

void FlatTable::setCell ( const QString &  col,
quint32  rec,
const QVariant &  var 
)
virtual

Sets the value of a single cell

Parameters
colcolumn name of the cell to be set
recrecord number of the cell to be set
varthe new value of the cell

Implements Ilwis::Table.

void FlatTable::setCell ( quint32  col,
quint32  rec,
const QVariant &  var 
)
virtual

Sets the value of a single cell

Parameters
colindex of the column of the cell to be set
recrecord number of the cell to be set
varthe new value of the cell

Implements Ilwis::Table.


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