GCBM
|
#include <cbmaggregatorlibpqxxwriter.h>
Public Member Functions | |
CBMAggregatorLibPQXXWriter (std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatFluxRecord >> fluxDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatPoolRecord >> poolDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatErrorRecord >> errorDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatAgeAreaRecord >> ageDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatDisturbanceRecord >> disturbanceDimension, std::shared_ptr< std::vector< std::string >> classifierNames, bool isPrimary=false) | |
virtual | ~CBMAggregatorLibPQXXWriter ()=default |
void | configure (const DynamicObject &config) override |
void | subscribe (NotificationCenter ¬ificationCenter) override |
flint::ModuleTypes | moduleType () override |
void | doSystemInit () override |
void | doLocalDomainInit () override |
void | doSystemShutdown () override |
Public Member Functions inherited from CBMModuleBase | |
virtual | ~CBMModuleBase ()=default |
void | onSystemInit () override |
void | onSystemShutdown () override |
void | onLocalDomainInit () override |
void | onLocalDomainShutdown () override |
void | onLocalDomainProcessingUnitInit () override |
void | onLocalDomainProcessingUnitShutdown () override |
void | onPreTimingSequence () override |
void | onTimingInit () override |
void | onTimingPrePostInit () override |
void | onTimingPostInit () override |
void | onTimingPostInit2 () override |
void | onTimingShutdown () override |
void | onTimingStep () override |
void | onTimingPreEndStep () override |
void | onTimingEndStep () override |
void | onTimingPostStep () override |
void | onOutputStep () override |
void | onPrePostDisturbanceEvent () override |
void | onPostDisturbanceEvent () override |
void | onPostDisturbanceEvent2 () override |
void | onError (std::string msg) override |
void | onDisturbanceEvent (DynamicVar e) override |
void | onPostNotification (short preMessageSignal) override |
virtual void | doLocalDomainShutdown () |
virtual void | doLocalDomainProcessingUnitInit () |
virtual void | doLocalDomainProcessingUnitShutdown () |
virtual void | doPreTimingSequence () |
virtual void | doTimingInit () |
virtual void | doTimingPrePostInit () |
virtual void | doTimingPostInit () |
virtual void | doTimingPostInit2 () |
virtual void | doTimingShutdown () |
virtual void | doTimingStep () |
virtual void | doTimingPreEndStep () |
virtual void | doTimingEndStep () |
virtual void | doTimingPostStep () |
virtual void | doOutputStep () |
virtual void | doError (std::string msg) |
virtual void | doDisturbanceEvent (DynamicVar) |
virtual void | doPrePostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent2 () |
virtual void | doPostNotification (short preMessageSignal) |
Private Member Functions | |
template<typename TAccumulator > | |
void | load (pqxx::work &tx, Int64 jobId, const std::string &table, std::shared_ptr< TAccumulator > dataDimension) |
void | doIsolated (pqxx::connection_base &conn, std::string sql, bool optional=false) |
void | doIsolated (pqxx::connection_base &conn, std::vector< std::string > sql, bool optional=false) |
Private Attributes | |
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatFluxRecord > > | _fluxDimension |
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatPoolRecord > > | _poolDimension |
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatErrorRecord > > | _errorDimension |
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatAgeAreaRecord > > | _ageDimension |
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatDisturbanceRecord > > | _disturbanceDimension |
std::shared_ptr< std::vector< std::string > > | _classifierNames |
std::shared_ptr< const flint::SpatialLocationInfo > | _spatialLocationInfo |
std::string | _connectionString |
std::string | _schema |
Int64 | _jobId |
bool | _isPrimaryAggregator |
bool | _dropSchema |
CBMAggregatorLibPQXXWriter | ( | std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatFluxRecord >> | fluxDimension, |
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatPoolRecord >> | poolDimension, | ||
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatErrorRecord >> | errorDimension, | ||
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatAgeAreaRecord >> | ageDimension, | ||
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatDisturbanceRecord >> | disturbanceDimension, | ||
std::shared_ptr< std::vector< std::string >> | classifierNames, | ||
bool | isPrimary = false |
||
) |
|
virtualdefault |
|
override |
Configuration function
Assign CBMAggregatorLibPQXXWriter._connectionString as variable "connection_string" in parameter config,
CBMAggregatorLibPQXXWriter._schema as variable "schema" in parameter config,
If parameter config has "drop_schema", assign it to CBMAggregatorLibPQXXWriter._dropSchema
config | DynamicObject& |
|
private |
Perform a single transaction using SQL commands (Overloaded function)
conn | connection_base& |
sql | string |
optional | bool |
|
private |
Perform transactions using SQL commands (Overloaded function)
conn | connection_base& |
sql | vector<string> |
optional | bool |
|
overridevirtual |
Initiate Local Domain
Assign CBMAggregatorLibPQXXWriter._jobId the value of variable "job_id" in _landUnitData,
if it exists, else to 0
Reimplemented from CBMModuleBase.
|
overridevirtual |
Initiate System
If CBMAggregatorLibPQXXWriter._isPrimaryAggregator and CBMAggregatorLibPQXXWriter._dropSchema are true
drop CBMAggregatorLibPQXXWriter._schema
Create CBMAggregatorLibPQXXWriter._schema
Reimplemented from CBMModuleBase.
|
overridevirtual |
doSystemShutDown
If CBMAggregatorLibPQXXWriter._isPrimaryAggregator is true, create unlogged tables for the DateDimension, LandClassDimension,
PoolDimension, ClassifierSetDimension, ModuleInfoDimension, LocationDimension, DisturbanceTypeDimension,
DisturbanceDimension, Pools, Fluxes, ErrorDimension, AgeClassDimension, LocationErrorDimension,
and AgeArea if they do not already exist, and load data into tables on PostgreSQL
Reimplemented from CBMModuleBase.
|
private |
Load each record in paramter dataDimension into table (table name is based on parameter table and jobId)
tx | work& |
jobId | Int64 |
table | string |
dataDimension | shared_ptr<TAccumulator> |
|
override |
|
override |
Subscribes to the signals SystemInit, LocalDomainInit and SystemShutDown
notificationCenter | NotificationCenter& |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |