# DataSet Class Reference

A data set. More...

`#include <DataSet.h>`

Inheritance diagram for DataSet:

List of all members.

## Public Member Functions

| DataSet (string s_category="", string s_name="", string s_default_file="", string s_title="", string s_description="", bool is_local=true)
| DataSet (const DataSet *o)
ExpressionItem * | copy () const
void | set (const ExpressionItem *item)
int | subtype () const
void | setCopyright (string s_copyright)
const string & | copyright () const
void | setDefaultDataFile (string s_file)
const string & | defaultDataFile () const
void | setDefaultProperty (string property)
const string & | defaultProperty () const
virtual int | calculate (MathStructure &mstruct, const MathStructure &vargs, const EvaluationOptions &eo)
bool | loadObjects (const char *file_name=NULL, bool is_user_defs=true)
int | saveObjects (const char *file_name=NULL, bool save_global=false)
bool | objectsLoaded () const
void | setObjectsLoaded (bool objects_loaded)
void | addProperty (DataProperty *dp)
void | delProperty (DataProperty *dp)
void | delProperty (DataPropertyIter *it)
DataProperty * | getPrimaryKeyProperty ()
DataProperty * | getProperty (string property)
DataProperty * | getFirstProperty (DataPropertyIter *it)
DataProperty * | getNextProperty (DataPropertyIter *it)
const string & | getFirstPropertyName (DataPropertyIter *it)
const string & | getNextPropertyName (DataPropertyIter *it)
void | addObject (DataObject *o)
void | delObject (DataObject *o)
void | delObject (DataObjectIter *it)
DataObject * | getObject (string object)
DataObject * | getObject (const MathStructure &object)
DataObject * | getFirstObject (DataObjectIter *it)
DataObject * | getNextObject (DataObjectIter *it)
const MathStructure * | getObjectProperyStruct (string property, string object)
const string & | getObjectProperty (string property, string object)
string | getObjectPropertyInputString (string property, string object)
string | getObjectPropertyDisplayString (string property, string object)
string | printProperties (string object)
string | printProperties (DataObject *o)

## Protected Attributes

string | sfile
string | scopyright
bool | b_loaded
vector< DataProperty * > | properties
vector< DataObject * > | objects

## Detailed Description

A data set.

This is a simple database class for storage of many grouped values, when ordinary variables is not practical.

A data set consists of properties and objects, with values for the properties. Qalculate! includes for example a "Planets" data set with properties such as name, mass, speed and density, and an object for each planet in solar system.

A data set is also mathemtical function, dataset(object, property), which retrieves values for objects and properties. Data sets can be saved and loaded from a XML file.

## Member Function Documentation

int DataSet::subtype | ( |  | ) | const`[virtual]`

Returns the subtype of the mathematical function, corresponding to which subsubclass the object belongs to.

Returns:
  FunctionSubtype.

Reimplemented from MathFunction.

virtual int DataSet::calculate | ( | MathStructure & | mstruct,
|  | const MathStructure & | vargs,
|  | const EvaluationOptions & | eo |
| ) |  |  | `[virtual]`

The main function for subclasses to reimplement. Calculates a value from arguments in vargs and puts it in mstruct.

This function expects the number of arguments to be equal to the maximum number of arguments, and checked by the argument definitions.

If the return value is negative, then argument -(return value) has been evaluated in mstruct. If -(return value) is greater than max arguments, then mstruct is a vector of evaluated argument values.

Parameters:

  `[out]` | mstruct | Structure that is set with the result of the calculation.
  | vargs | Arguments passed to the mathematical function.
  | eo | Evaluation options.

Returns:
  1 if the calculation was successful.

Reimplemented from MathFunction.

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

- libqalculate/DataSet.h