The Output class abstracts output data (database, textbased, ...).
More...
#include <output.h>
|
void | setName (const QString &name, const QString tableName) |
|
void | setDescription (const QString &description) |
|
QList< OutputColumn > & | columns () |
|
int | currentYear () const |
|
const XmlHelper & | settings () const |
| access XML settings (see class description) More...
|
|
void | writeRow () |
| saves the current row/line of data to database/file. Must be called for each row. More...
|
|
void | singleThreadedWriteRow () |
| writeRow() protected by a mutex (if there is a chance that two outputs write at the same time) More...
|
|
void | add (const double &value) |
|
void | add (const double &value1, const double &value2) |
|
void | add (const double &value1, const double &value2, const double &value3) |
|
void | add (const double &value1, const double &value2, const double &value3, const double &value4) |
|
void | add (const double &value1, const double &value2, const double &value3, const double &value4, const double value5) |
|
void | add (const int intValue) |
|
void | add (const QString &stringValue) |
|
bool | clearColumnsAfter (QString find_name) |
| delete all columns after the column 'find_name'. Return true if columns were removed. More...
|
|
void | truncateTable () |
| delete all data from the table More...
|
|
The Output class abstracts output data (database, textbased, ...).
To create a new output, create a class derived from Output and perform the following steps:
- Overwrite constructor: Create columns and set fixed properties (e.g. table name)
- overwrite setup() this function is called after the project file is read. You can access a XmlHelper calling settings() which is set to the top-node of the output (defined by tableName() which is set in the constructor). Access settings using relative xml-pathes (see example).
- overwrite exec() add data using the stream operators or add() function of Output. Call writeRow() after each row. Each invokation of exec() is a database transaction.
- Add the output to the constructor of
OutputManager
- Example
{
}
{
if (filter!="")
mFilter = QSharedPointer<Expression>(
new Expression(filter));
}
{
while (
Tree *t=at.next()) {
if (mFilter && !mFilter->execute())
continue;
*this << t->id() << t->species()->id() << t->dbh();
}
}
{
...
...
}
An expression engine for mathematical expressions provided as strings.
Definition: expression.h:29
static GlobalSettings * instance()
Definition: globalsettings.h:51
QList< OutputColumn > & columns()
Definition: output.h:88
void setDescription(const QString &description)
Definition: output.h:86
const XmlHelper & settings() const
access XML settings (see class description)
Definition: output.h:90
void writeRow()
saves the current row/line of data to database/file. Must be called for each row.
Definition: output.cpp:185
void setName(const QString &name, const QString tableName)
Definition: output.h:85
OutputManager()
create all outputs
Definition: outputmanager.cpp:51
A tree is the basic simulation entity of iLand and represents a single tree.
Definition: tree.h:44
virtual void exec()
main function that executes the output
Definition: treeout.cpp:68
TreeOut()
Definition: treeout.cpp:28
virtual void setup()
setup() is called during project setup and can be ovveridden for specific setup
Definition: treeout.cpp:59
QString value(const QString &path, const QString &defaultValue="") const
retrieve value (as string) from node path.
Definition: xmlhelper.cpp:129
@ OutString
Definition: output.h:29
@ OutInteger
Definition: output.h:29
@ OutDouble
Definition: output.h:29
◆ Output()
ctor. Override in derived class to craete columns, etc.
◆ ~Output()
◆ add() [1/7]
void Output::add |
( |
const double & |
value | ) |
|
|
inlineprotected |
◆ add() [2/7]
void Output::add |
( |
const double & |
value1, |
|
|
const double & |
value2 |
|
) |
| |
|
inlineprotected |
◆ add() [3/7]
void Output::add |
( |
const double & |
value1, |
|
|
const double & |
value2, |
|
|
const double & |
value3 |
|
) |
| |
|
inlineprotected |
◆ add() [4/7]
void Output::add |
( |
const double & |
value1, |
|
|
const double & |
value2, |
|
|
const double & |
value3, |
|
|
const double & |
value4 |
|
) |
| |
|
inlineprotected |
◆ add() [5/7]
void Output::add |
( |
const double & |
value1, |
|
|
const double & |
value2, |
|
|
const double & |
value3, |
|
|
const double & |
value4, |
|
|
const double |
value5 |
|
) |
| |
|
inlineprotected |
◆ add() [6/7]
void Output::add |
( |
const int |
intValue | ) |
|
|
inlineprotected |
◆ add() [7/7]
void Output::add |
( |
const QString & |
stringValue | ) |
|
|
inlineprotected |
◆ clearColumnsAfter()
bool Output::clearColumnsAfter |
( |
QString |
find_name | ) |
|
|
protected |
delete all columns after the column 'find_name'. Return true if columns were removed.
delete columns that were added after the column 'find_name'
◆ close()
shut down the connection.
◆ columns()
◆ currentYear()
int Output::currentYear |
( |
| ) |
const |
|
inlineprotected |
◆ description()
const QString Output::description |
( |
| ) |
const |
|
inline |
◆ exec()
main function that executes the output
Reimplemented in ABE::ABEStandOut, ABE::ABEStandDetailsOut, ABE::ABEStandRemovalOut, ABE::UnitOut, BITE::BiteOutput, BITE::BiteCellOutput, CarbonFlowOut, CarbonOut, DevStageOut, DynamicStandOut, EcoVizOut, LandscapeOut, LandscapeRemovedOut, ManagementOut, ProductionOut, SaplingOut, SaplingDetailsOut, SoilInputOut, StandDeadOut, StandOut, SVDGPPOut, SVDStateOut, SVDUniqueStateOut, SVDIndicatorOut, TreeOut, TreeRemovedOut, WaterOut, BarkBeetleOut, FireOut, and WindOut.
◆ getColumns()
◆ isEnabled()
bool Output::isEnabled |
( |
| ) |
const |
|
inline |
returns true if output is enabled, i.e. is "turned on"
◆ isOpen()
bool Output::isOpen |
( |
| ) |
const |
|
inline |
returns true if output is open, i.e. has a open database connection
◆ isRowEmpty()
bool Output::isRowEmpty |
( |
| ) |
const |
|
inline |
returns true if the buffer of the current row is empty
◆ name()
const QString Output::name |
( |
| ) |
const |
|
inline |
descriptive name of the ouptut
◆ open()
open output connection (create actual db connection, ...)
◆ operator<<() [1/3]
Output & Output::operator<< |
( |
const double & |
value | ) |
|
|
inline |
◆ operator<<() [2/3]
Output & Output::operator<< |
( |
const int |
value | ) |
|
|
inline |
◆ operator<<() [3/3]
Output & Output::operator<< |
( |
const QString & |
value | ) |
|
|
inline |
◆ setDescription()
void Output::setDescription |
( |
const QString & |
description | ) |
|
|
inlineprotected |
◆ setEnabled()
void Output::setEnabled |
( |
const bool |
enabled | ) |
|
|
inline |
◆ setMode()
◆ setName()
void Output::setName |
( |
const QString & |
name, |
|
|
const QString |
tableName |
|
) |
| |
|
inlineprotected |
◆ settings()
access XML settings (see class description)
◆ setup()
setup() is called during project setup and can be ovveridden for specific setup
Reimplemented in ABE::ABEStandOut, ABE::ABEStandDetailsOut, ABE::ABEStandRemovalOut, ABE::UnitOut, BITE::BiteOutput, BITE::BiteCellOutput, CarbonFlowOut, CarbonOut, DevStageOut, DynamicStandOut, EcoVizOut, LandscapeOut, LandscapeRemovedOut, ManagementOut, ProductionOut, SaplingOut, SaplingDetailsOut, SoilInputOut, StandDeadOut, StandOut, SVDGPPOut, SVDStateOut, SVDUniqueStateOut, SVDIndicatorOut, TreeOut, TreeRemovedOut, WaterOut, BarkBeetleOut, FireOut, and WindOut.
◆ singleThreadedWriteRow()
void Output::singleThreadedWriteRow |
( |
| ) |
|
|
protected |
writeRow() protected by a mutex (if there is a chance that two outputs write at the same time)
◆ tableName()
const QString Output::tableName |
( |
| ) |
const |
|
inline |
internal output name (no spaces allowed)
◆ truncateTable()
void Output::truncateTable |
( |
| ) |
|
|
protected |
delete all data from the table
◆ wikiFormat()
QString Output::wikiFormat |
( |
| ) |
const |
return output description in a (tiki)-wiki format
◆ writeRow()
void Output::writeRow |
( |
| ) |
|
|
protected |
saves the current row/line of data to database/file. Must be called for each row.
The documentation for this class was generated from the following files: