cee::ug::DataSourceInterface

class DataSourceInterface : public DataSource

A parent class for interface data sources.

See the main class DataSource for general explanation on a data source.

DataSourceInterface is the parent class for all interface data sources and cannot be instantiated. DataSource contains general functions that applies to all interface data source types. To create a data source, use one of the subclassed versions, for instance DataSourceVTF.

See DataSourceVTF and DataSourceVTFx on how to create a data source from a model file.

DataSourceInterface contains functionality for loading and discarding states manually. Loading states is useful to get access to, for instance, result data without having to add the state and results through the model.

Subclassed by DataSourceCae, DataSourceMerged, DataSourceReader, DataSourceVTF, DataSourceVTFx

Public Functions

DataSourceInterface(int dataSourceId)

Constructs an empty data source with the given id.

virtual bool open(const Str &filename, Error *error = NULL) = 0

Opens a file using the derived interface.

virtual void close() = 0

Closes the currently open file in the derived interface.

virtual bool loadState(int stateId, const DataStateSpec &stateSpec, Error *error)

Loads the state at the given stateId.

Only loads the state if not already present in the DataSource

The stateSpec describes which results to load for the given state.

Returns true if the state was successfully loaded.

See also

DataStateSpec

virtual void discardState(int stateId)

Deletes the state with the given id from the data source.

virtual bool loadCustomResultBaseDependencies(int stateId, const DataStateSpec &stateSpec)

Loads custom result bare dependencies. Returns true if success.

bool createResultCalculator(const Str &calculatorId, const Str &resultIdString, const Str &initString, Str *errorMessage)

Creates a new result with the given resultIdString by using the result calculator calculatorId configured with the given initString.

A new result calculator instance will be created and initialized with the given initString. If it can based on this produce a result, a new result will be added with the given resultIdString.

This is useful for having calculators that e.g. support a mathematical expression. The initString is passed unmodified to the calculator initialize() method.

See the CRC ExpressionPlugin for an example on how to use this feature.

Note: To change the initString (e.g. expression), use the recreateResultCalculator() method.

bool recreateResultCalculator(const Str &calculatorId, const Str &resultIdString, const Str &initString, Str *errorMessage)

Recreates a result calculator with a modified initString.

This function will create a new result calculator instance like the createResultCalculator(), but it will keep the same resultId and from the EnvisionDesktop point of view modify the result. The resultId is keep constant and any parts of the model currently showing the result will be updated.

There needs to already be a result calculator with the given calculatorId and resultIdString

bool deleteResultCalculator(const Str &calculatorId, const Str &resultIdString)

Deletes the result calculator with the given calculatorId and resultIdString.

bool setResultCalculatorParams(const Str &calculatorId, const Str &resultIdString, const ResultCalculatorParams &calcParams)

Sets the parameters for the given result calculator instance.

If the result is in use, the model will be updated.

You can find which calculator instance is producing a result (if any) by checking the resultCalculatorId and idString parameters in the ResultInfo from the DataSourceDirectory.

void getResultCalculatorParams(const Str &calculatorId, const Str &resultIdString, ResultCalculatorParams *calcParams) const

Gets the current parameters exposed by the given result calculator instance.

You can find which calculator instance is producing a result (if any) by checking the resultCalculatorId and idString parameters in the ResultInfo from the DataSourceDirectory.

Str primaryFilename() const

Returns the primary filename for this data source.

Str description() const

Returns the description for this data source.

virtual bool scalarRange(int stateId, int resultId, double *min, double *max)

Gets the range of the given scalar result for the given state.

The result does not need to be loaded. The it returns the global min max of the state, not taking any current filtering into account.

This will fetch the result from the reader if not already loaded, and is more efficient than loading the result into the data model if you only need the min/max. If the result is already present in the data model it will be used without loading the data.

virtual bool vectorRange(int stateId, int resultId, double *min, double *max)

Gets the range of the given vector result for the given state.

The result does not need to be loaded. The it returns the global min max of the state, not taking any current filtering into account.

This will fetch the result from the reader if not already loaded, and is more efficient than loading the result into the data model if you only need the min/max. If the result is already present in the data model it will be used without loading the data.

virtual bool displacementRange(int stateId, int resultId, double *min, double *max)

Gets the range of the given displacement result for the given state.

The result does not need to be loaded. The it returns the global min max of the state, not taking any current filtering into account.

This will fetch the result from the reader if not already loaded, and is more efficient than loading the result into the data model if you only need the min/max. If the result is already present in the data model it will be used without loading the data.

Public Static Functions

static bool supportsResultCalculatorPlugins()

Gets if result calculator plugins are supported or not.

static bool loadResultCalculatorPlugin(const Str &baseFileName)

Loads the specified result calculator plugin.

Protected Functions

void updateDirectoryFromDatabase()

Updates the directory with synthetic metadata from all states, parts and results in the geometries.

Note! Provided for convenience. Writing the directory info manually is the correct and most most efficient way.