| TerraLib 4.1

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
TeTable Class Reference

An attribute table in memory. More...

`#include <TeTable.h>`

List of all members.

## Public Member Functions

| TeTable ()
| Empty constructor.
| TeTable (const string &name)
| Constructor by name.
| TeTable (const string &name, const TeAttributeList &attList, const string &uniqueName, const string &linkName="", TeAttrTableType tableType=TeAttrStatic)
| Constructor by name and attribute list.
| ~TeTable ()
| Destructor.
| TeTable (const TeTable &)
| Copy Constructor.
TeTable & | operator= (const TeTable &)
| Operator =.
const string & | name () const
| Returns the table name.
string | name ()
| Returns the table name.
void | name (const string &n)
| Sets the table name.
int | id ()
| Returns the unique id of the table in a database.
void | setId (int n)
| Sets the id of the table.
void | setOrder (int n)
| Set the position of the table in a join.
int | getOrder ()
| Get the position of the table in a join.
void | setAttributeList (const TeAttributeList &attList)
| Defines the list of attributes of this table.
TeAttributeList & | attributeList ()
| Retrieves the list of attributes of this table.
const TeAttributeList & | attributeList () const
| Retrieves the list of attributes of this table.
bool | attributeNames (vector< string > &attrs)
| Retrieves the list of attribute names of this table.
TeAttrTableType | tableType ()
| Returns the type of this attribute table.
void | setSeparator (const char &c)
| Sets the table separator.
char | separator ()
| Returns the table separator.
bool | setTableType (TeAttrTableType attType, int relatedTableId=-1, const string &relatedAttribute="")
| Sets the table type.
void | setLinkName (const string &linkName)
| Sets an attribute as the table index.
string | linkName ()
| Returns the name of the column used as link between the attribute table and a spatial table.
void | setUniqueName (const string &uniqueName)
| Sets the name of the column that has unique values.
string | uniqueName ()
| Returns the name of the column used as primary key.
bool | attrLink (TeAttribute &att)
| If there is one, returns the attribute used as an index.
bool | attrUnique (TeAttribute &attr)
| If there is one, returns the attribute used as primary key.
int | attrLinkPosition ()
| Returns the position of the link attribute in the attribute list.
int | attrUniquePosition ()
| Returns the position of the unique attribute in the attribute list.
void | primaryKeys (vector< string > &keys)
| Returns the primary key names of the table.
External tables
The following members are used to manipulate information about tables that are external: donīt have a direct link to geometries, but can be linked by a column to another attribute table
void | relatedTableId (int id)
| Sets the id of a table to which this is related (only for TeAttrExternal tables)
int | relatedTableId ()
| Returns the id of a related table (only for TeAttrExternal tables)
void | relatedTableName (string tableName)
| Sets the name of a table to which this is related (only for TeAttrExternal tables)
string | relatedTableName ()
| Returns the name of a related table (only for TeAttrExternal tables)
void | relatedAttribute (const string &columnName)
| Set the name of a column to link to a related table (only for TeAttrExternal tables)
string | relatedAttribute ()
| Return the column that links to a related table (only for TeAttrExternal tables)
Temporal Attributes
The following members are used to manipulate the attribute tables with temporal information.

Temporal tables contains columns to store a time interval in which the
  attributes (or a row) of an object is valid.

void | attInitialTime (const string &t)
| Sets the name of the column that has the initial time of the validity interval.
string | attInitialTime ()
| Returns the name of the column that has the initial time of the validity interval.
void | attFinalTime (const string &t)
| Sets the name of the column that has the final time of the validity interval.
string | attFinalTime ()
| Returns the name of the column that has the final time of the validity interval.
void | attTimeUnit (TeChronon t)
| Sets the time unit relative to the validity interval.
TeChronon | attTimeUnit ()
| Returns the time unit relative to the validity interval.
Data in Memory
The following members are used to manipulate rows of the table in memory
void | add (const TeTableRow &row)
| Add a row to a table.
TeTableRow | operator[] (int row) const
| Returns the i-th row.
string | operator() (int row, int col)
| Returns the element indexed by (row,col)
void | setValue (int row, int col, string &val)
| Sets the value of a cell indexed by row x col to value val.
unsigned int | size () const
| Returns the number of rows in a table.
void | clear ()
| Clears the table storage in memory.

## Detailed Description

An attribute table in memory.

Instances of this classes represent non-spatial tables, or tables that donīt have a spatial data as one of its columns. The class stores the table schema and it also can store rows of data.

Rows of data are stored according to handle/hody idiom, to make copies optimized.

See also:
  TeAttribute TeTableImpl

Examples:

  createLayer.cpp, and createTable.cpp.

## Constructor & Destructor Documentation

TeTable::TeTable | ( |  | ) |

Empty constructor.

Note:
  Instance of TeTable will be created with the following default values:
  - name: "" (empty)
  - id_: -1 (no database identifier)
  - type_: static attribute table
  - attList: empty list of attributes
  - attLink_: "" (no index to geometries)
  - attUnique_: "" (no unique values)
  - separator_: ',' comma separator (used to read ASCII tables from files)
  - attInitialTime_: "" no initial time information
  - attFinalTime_: "" no final time information
  - attTimeUnit_: TeYear
  - relatedTableId: -1 (no relation to other table)
  - relatedTableName: "" (name of the related table)
  - relatedAttribute: "" (attribute of the related table)

TeTable::TeTable | ( | const string & | name | ) |

Constructor by name.

Parameters:

  name | table name

Note:
  Instance of TeTable will be created with the following default values:
  - id_: -1 (no database identifier)
  - tableType_: static attribute table
  - attList: empty list of attributes
  - attLink_: "" (no index to geometries)
  - attUnique_: "" (no unique values)
  - separator_: ',' comma separator (used to read ASCII tables from files)
  - attInitialTime_: "" no initial time information
  - attFinalTime_: "" no final time information
  - attTimeUnit_: TeYear
  - relatedTableId: -1 (no relation to other table)
  - relatedTableName: "" (name of the related table)
  - relatedAttribute: "" (attribute of the related table)

TeTable::TeTable | ( | const string & | name,
|  | const TeAttributeList & | attList,
|  | const string & | uniqueName,
|  | const string & | linkName = `""`,
|  | TeAttrTableType | tableType = `TeAttrStatic`
| ) |  |

Constructor by name and attribute list.

Parameters:

  name | table name
  attList | list of attributes
  uniqueName | column that unique attributes to be used as a primary key
  linkName | column that links attributes to geometries
  tableType | type of attribute table

Note:
  Instance of TeTable will be created with the following default values:
  - id_: -1 (no database identifier)
  - separator_: ',' comma separator (used to read ASCII tables from files)
  - attInitialTime_: "" no initial time information
  - attFinalTime_: "" no final time information
  - attTimeUnit_: TeYear
  - relatedTableId: -1 (no relation to other table)
  - relatedTableName: "" (name of the related table)
  - relatedAttribute: "" (attribute of the related table)

TeTable::~TeTable | ( |  | ) |

Destructor.

TeTable::TeTable | ( | const TeTable & | other | ) |

Copy Constructor.

Copies the representation pointer increments the reference counter

## Member Function Documentation

void TeTable::add | ( | const TeTableRow & | row | ) |

Add a row to a table.

Examples:
  createLayer.cpp, and createTable.cpp.

void TeTable::attFinalTime | ( | const string & | t | ) | `[inline]`

Sets the name of the column that has the final time of the validity interval.

string TeTable::attFinalTime | ( |  | ) | `[inline]`

Returns the name of the column that has the final time of the validity interval.

string TeTable::attInitialTime | ( |  | ) | `[inline]`

Returns the name of the column that has the initial time of the validity interval.

void TeTable::attInitialTime | ( | const string & | t | ) | `[inline]`

Sets the name of the column that has the initial time of the validity interval.

const TeAttributeList& TeTable::attributeList | ( |  | ) | const`[inline]`

Retrieves the list of attributes of this table.

TeAttributeList& TeTable::attributeList | ( |  | ) | `[inline]`

Retrieves the list of attributes of this table.

bool TeTable::attributeNames | ( | vector< string > & | attrs | ) |

Retrieves the list of attribute names of this table.

bool TeTable::attrLink | ( | TeAttribute & | att | ) |

If there is one, returns the attribute used as an index.

Parameters:

  att | to return the attribute used as an index

Returns:
  TRUE if there is an index, FALSE otherwise

int TeTable::attrLinkPosition | ( |  | ) |

Returns the position of the link attribute in the attribute list.

bool TeTable::attrUnique | ( | TeAttribute & | attr | ) |

If there is one, returns the attribute used as primary key.

Parameters:

  attr | to return the attribute used as primary key

Returns:
  TRUE if there is an index, FALSE otherwise

int TeTable::attrUniquePosition | ( |  | ) |

Returns the position of the unique attribute in the attribute list.

void TeTable::attTimeUnit | ( | TeChronon | t | ) | `[inline]`

Sets the time unit relative to the validity interval.

TeChronon TeTable::attTimeUnit | ( |  | ) | `[inline]`

Returns the time unit relative to the validity interval.

void TeTable::clear | ( | void |  | ) |

Clears the table storage in memory.

int TeTable::getOrder | ( |  | ) | `[inline]`

Get the position of the table in a join.

int TeTable::id | ( |  | ) | `[inline]`

Returns the unique id of the table in a database.

string TeTable::linkName | ( |  | ) | `[inline]`

Returns the name of the column used as link between the attribute table and a spatial table.

void TeTable::name | ( | const string & | n | ) | `[inline]`

Sets the table name.

const string& TeTable::name | ( |  | ) | const`[inline]`

Returns the table name.

string TeTable::name | ( |  | ) | `[inline]`

Returns the table name.

string TeTable::operator() | ( | int | row,
|  | int | col
| ) |  |

Returns the element indexed by (row,col)

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

Operator =.

Copies the representation pointer Decrements the reference counter of the current object Increments the reference counter for the new object

TeTableRow TeTable::operator[] | ( | int | row | ) | const

Returns the i-th row.

void TeTable::primaryKeys | ( | vector< string > & | keys | ) |

Returns the primary key names of the table.

void TeTable::relatedAttribute | ( | const string & | columnName | ) | `[inline]`

Set the name of a column to link to a related table (only for TeAttrExternal tables)

string TeTable::relatedAttribute | ( |  | ) | `[inline]`

Return the column that links to a related table (only for TeAttrExternal tables)

void TeTable::relatedTableId | ( | int | id | ) | `[inline]`

Sets the id of a table to which this is related (only for TeAttrExternal tables)

int TeTable::relatedTableId | ( |  | ) | `[inline]`

Returns the id of a related table (only for TeAttrExternal tables)

void TeTable::relatedTableName | ( | string | tableName | ) | `[inline]`

Sets the name of a table to which this is related (only for TeAttrExternal tables)

string TeTable::relatedTableName | ( |  | ) | `[inline]`

Returns the name of a related table (only for TeAttrExternal tables)

char TeTable::separator | ( |  | ) | `[inline]`

Returns the table separator.

void TeTable::setAttributeList | ( | const TeAttributeList & | attList | ) | `[inline]`

Defines the list of attributes of this table.

void TeTable::setId | ( | int | n | ) | `[inline]`

Sets the id of the table.

void TeTable::setLinkName | ( | const string & | linkName | ) | `[inline]`

Sets an attribute as the table index.

Index in this context, means an attribute that is a link between the attribute table and a spatial table (a table of geometrical representation of objects).

void TeTable::setOrder | ( | int | n | ) | `[inline]`

Set the position of the table in a join.

void TeTable::setSeparator | ( | const char & | c | ) | `[inline]`

Sets the table separator.

bool TeTable::setTableType | ( | TeAttrTableType | attType,
|  | int | relatedTableId = `-1`,
|  | const string & | relatedAttribute = `""`
| ) |  |

Sets the table type.

Parameters:

  attType | table type

Note:
  In case of external tables

Parameters:

  relatedTableId | is the id of the related table
  relatedAttribute | is column name of the related table

void TeTable::setUniqueName | ( | const string & | uniqueName | ) | `[inline]`

Sets the name of the column that has unique values.

void TeTable::setValue | ( | int | row,
|  | int | col,
|  | string & | val
| ) |  |

Sets the value of a cell indexed by row x col to value val.

unsigned int TeTable::size | ( | void |  | ) | const

Returns the number of rows in a table.

TeAttrTableType TeTable::tableType | ( |  | ) | `[inline]`

Returns the type of this attribute table.

string TeTable::uniqueName | ( |  | ) | `[inline]`

Returns the name of the column used as primary key.

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

- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeTable.h
- E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeTable.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines