GCBM
Public Member Functions | Private Attributes | List of all members
TimeSeriesIdxFromFlintDataTransform Class Reference

#include <timeseriesidxfromflintdatatransform.h>

Inherits ITransform.

Collaboration diagram for TimeSeriesIdxFromFlintDataTransform:
Collaboration graph

Public Member Functions

 TimeSeriesIdxFromFlintDataTransform ()
 
void configure (DynamicObject config, const flint::ILandUnitController &landUnitController, datarepository::DataRepository &dataRepository) override
 
void controllerChanged (const flint::ILandUnitController &controller) override
 
const DynamicVar & value () const override
 

Private Attributes

const flint::ILandUnitController * _landUnitController
 
std::shared_ptr< const flint::SpatialLocationInfo > _spatialLocationInfo
 
const datarepository::IProviderLayer * _layer
 
const datarepository::TileBlockCellIndexer * _providerIndexer
 
bool _subsame
 
int _startYear
 
int _dataPerYear
 
int _nYears
 
std::string _origin
 
DynamicVar _cachedValue
 
size_t _lastCellHash
 

Constructor & Destructor Documentation

◆ TimeSeriesIdxFromFlintDataTransform()

Member Function Documentation

◆ configure()

void configure ( DynamicObject  config,
const flint::ILandUnitController &  landUnitController,
datarepository::DataRepository &  dataRepository 
)
override

Configuration function

Assign TimeSeriesIdxFromFlintDataTransform._landUnitController as parameter landUnitController&, TimeSeriesIdxFromFlintDataTransform._subsame, TimeSeriesIdxFromFlintDataTransform._startYear, TimeSeriesIdxFromFlintDataTransform._dataPerYear, TimeSeriesIdxFromFlintDataTransform._nYears value of "sub_same", "start_year", "data_per_year" in parameter config, _origin, value of "origin" if it exists in parameter config, else the string "start_sim", TimeSeriesIdxFromFlintDataTransform._spatialLocationInfo value of variable "spatialLocationInfo" in parameter landUnitController
Assign the value of the getProvider() on parameter dataRepository with argument config["provider"] to a variable provider, set the result of the indexer() method on variable provider to TimeSeriesIdxFromFlintDataTransform._providerIndex, and result of getLayer() on variable provider with argument config["data_id"] to TimeSeriesIdxFromFlintDataTransform._layer

Parameters
configDynamicObject
controllerflint::ILandUnitController&
dataRepositorymoja::datarepository::DataRepository&
Returns
void

◆ controllerChanged()

void controllerChanged ( const flint::ILandUnitController &  landUnitController)
override

Assign TimeSeriesIdxFromFlintDataTransform._landUnitController as parameter &landUnitController, TimeSeriesIdxFromFlintDataTransform._spatialLocationInfo as statically casted pointer to variable "spatialLocationInfo" in parameter landUnitController

Parameters
landUnitControllerflint::ILandUnitController&
Returns
void

◆ value()

const DynamicVar & value ( ) const
override

Instantiate an object of datarepository::CellIdx, with the tile index, block index, cell index and provider index corresponding to the current spatial location
If the value of TimeSeriesIdxFromFlintDataTransform._lastCellHash is not the same as the current cell hash, then assign the value of the current cell hash to TimeSeriesIdxFromFlintDataTransform._lastCellHash
For each value in the result of getValueByCellIndex() on TimeSeriesIdxFromFlintDataTransform._layer, if value.is_initialized() is true, add the value to a vector raw.
If atleast one value returned a true value for value.is_initialized(), instantiate an object of TimeSeries and assgin it to TimeSeriesIdxFromFlintDataTransform._cachedValue
If none of the values return true for value.is_initialized(), assign TimeSeriesIdxFromFlintDataTransform._cachedValue to DynamicVar()
Return TimeSeriesIdxFromFlintDataTransform._cachedValue

Returns
DynamicVar&

Member Data Documentation

◆ _cachedValue

DynamicVar _cachedValue
mutableprivate

◆ _dataPerYear

int _dataPerYear
private

◆ _landUnitController

const flint::ILandUnitController* _landUnitController
private

◆ _lastCellHash

size_t _lastCellHash
mutableprivate

◆ _layer

const datarepository::IProviderLayer* _layer
private

◆ _nYears

int _nYears
private

◆ _origin

std::string _origin
private

◆ _providerIndexer

const datarepository::TileBlockCellIndexer* _providerIndexer
private

◆ _spatialLocationInfo

std::shared_ptr<const flint::SpatialLocationInfo> _spatialLocationInfo
mutableprivate

◆ _startYear

int _startYear
private

◆ _subsame

bool _subsame
private

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