World Ocean Simulation System (WOSS) library
woss::DefHandler Class Reference

Class for managing dynamic instantiation of foundation classes. More...

#include <definitions-handler.h>

Collaboration diagram for woss::DefHandler:
Collaboration graph

Public Member Functions

 DefHandler ()=default
 
 DefHandler (const DefHandler &copy)=default
 
 DefHandler (DefHandler &&tmp)=default
 
DefHandleroperator= (const DefHandler &copy)=default
 
DefHandleroperator= (DefHandler &&tmp)=default
 
 ~DefHandler ()=default
 
void setPressure (std::unique_ptr< Pressure > ptr)
 
void setTimeArr (std::unique_ptr< TimeArr > ptr)
 
void setSSP (std::unique_ptr< SSP > ptr)
 
void setSediment (std::unique_ptr< Sediment > ptr)
 
void setTimeReference (std::unique_ptr< TimeReference > ptr)
 
void setRandGenerator (std::unique_ptr< RandomGenerator > ptr)
 
void setTransducer (std::unique_ptr< Transducer > ptr)
 
void setAltimetry (std::unique_ptr< Altimetry > ptr)
 
void setLocation (std::unique_ptr< Location > ptr)
 
void setDebug (bool flag)
 
double getRand () const
 
int getRandInt () const
 
double getTimeReference () const
 
bool getDebug () const
 
template<class... Args>
std::unique_ptr< SedimentcreateSediment (Args &&... args) const
 
template<class... Args>
std::unique_ptr< TransducercreateTransducer (Args &&... args) const
 
template<class... Args>
std::unique_ptr< AltimetrycreateAltimetry (Args &&... args) const
 
template<class... Args>
std::unique_ptr< LocationcreateLocation (Args &&... args) const
 
template<class... Args>
std::unique_ptr< SSPcreateSSP (Args &&... args) const
 
template<class... Args>
std::unique_ptr< PressurecreatePressure (Args &&... args) const
 
template<class... Args>
std::unique_ptr< TimeArrcreateTimeArr (Args &&... args) const
 
template<class... Args>
std::unique_ptr< Pressure[]> createPressureArray (Args &&... args) const
 
template<class... Args>
std::unique_ptr< TimeArr[]> createTimeArrArray (Args &&... args) const
 

Private Attributes

bool debug = false
 
std::unique_ptr< SSPssp_creator = nullptr
 
std::unique_ptr< Sedimentsediment_creator = nullptr
 
std::unique_ptr< TimeReferencetime_reference = nullptr
 
std::unique_ptr< RandomGeneratorrand_generator = nullptr
 
std::unique_ptr< Transducertransducer_creator = nullptr
 
std::unique_ptr< Altimetryaltimetry_creator = nullptr
 
std::unique_ptr< Locationlocation_creator = nullptr
 
std::unique_ptr< Pressurepressure_creator = nullptr
 
std::unique_ptr< TimeArrtime_arr_creator = nullptr
 

Detailed Description

Class for managing dynamic instantiation of foundation classes.

woss::DefHandler is a class that handle the creation of dynamic instances of woss::SSP, woss::Sediment, woss::TimeArr, woss::Pressure, woss::RandomGenerator, woss::TimeReference, woss::Transducer, woss::Location and woss::Altimetry. A custom derived definition class can be "plug in" at run time in the WOSS framework without changing the framework source code. DefHandler has been be created with singleton pattern for safety reasons (e.g. woss::Sigleton< woss::DefHandler > )

Constructor & Destructor Documentation

◆ DefHandler() [1/3]

woss::DefHandler::DefHandler ( )
default

◆ DefHandler() [2/3]

woss::DefHandler::DefHandler ( const DefHandler copy)
default

◆ DefHandler() [3/3]

woss::DefHandler::DefHandler ( DefHandler &&  tmp)
default

◆ ~DefHandler()

woss::DefHandler::~DefHandler ( )
default

Member Function Documentation

◆ createAltimetry()

template<class... Args>
std::unique_ptr< Altimetry > woss::DefHandler::createAltimetry ( Args &&...  args) const
inline

Returns a std::unique_ptr to heap allocated instance of the woss::Altimetry class hierarchy.

Parameters
argsvariadic arguments that will be perfectly forwarded to the underlying woss::Altimetry::create() function
Returns
a std::unique_ptr to a woss::Altimetry instance

References altimetry_creator.

◆ createLocation()

template<class... Args>
std::unique_ptr< Location > woss::DefHandler::createLocation ( Args &&...  args) const
inline

Returns a std::unique_ptr to heap allocated instance of the woss::Location class hierarchy.

Parameters
argsvariadic arguments that will be perfectly forwarded to the underlying woss::Location::create() function
Returns
a std::unique_ptr to a woss::Location instance

References location_creator.

◆ createPressure()

template<class... Args>
std::unique_ptr< Pressure > woss::DefHandler::createPressure ( Args &&...  args) const
inline

Returns a std::unique_ptr to heap allocated instance of the woss::Pressure class hierarchy.

Parameters
argsvariadic arguments that will be perfectly forwarded to the underlying woss::Pressure::create() function
Returns
a std::unique_ptr to a woss::Pressure instance

References pressure_creator.

◆ createPressureArray()

template<class... Args>
std::unique_ptr< Pressure[]> woss::DefHandler::createPressureArray ( Args &&...  args) const
inline

Returns a std::unique_ptr to heap allocated array of instances of the woss::Pressure class hierarchy.

Parameters
argsvariadic arguments that will be perfectly forwarded to the underlying woss::Pressure::createArray() function
Returns
a std::unique_ptr to an array of woss::Pressure instances

References pressure_creator.

◆ createSediment()

template<class... Args>
std::unique_ptr< Sediment > woss::DefHandler::createSediment ( Args &&...  args) const
inline

Returns a std::unique_ptr to heap allocated instance of the woss::Sediment class hierarchy.

Parameters
argsvariadic arguments that will be perfectly forwarded to the underlying woss::Sediment::create() function
Returns
a std::unique_ptr to a woss::Sediment instance

References sediment_creator.

◆ createSSP()

template<class... Args>
std::unique_ptr< SSP > woss::DefHandler::createSSP ( Args &&...  args) const
inline

Returns a std::unique_ptr to heap allocated instance of the woss::SSP class hierarchy.

Parameters
argsvariadic arguments that will be perfectly forwarded to the underlying woss::SSP::create() function
Returns
a std::unique_ptr to a woss::SSP instance

References ssp_creator.

◆ createTimeArr()

template<class... Args>
std::unique_ptr< TimeArr > woss::DefHandler::createTimeArr ( Args &&...  args) const
inline

Returns a std::unique_ptr to heap allocated instance of the woss::TimeArr class hierarchy.

Parameters
argsvariadic arguments that will be perfectly forwarded to the underlying woss::TimeArr::create() function
Returns
a std::unique_ptr to a woss::TimeArr instance

References time_arr_creator.

◆ createTimeArrArray()

template<class... Args>
std::unique_ptr< TimeArr[]> woss::DefHandler::createTimeArrArray ( Args &&...  args) const
inline

Returns a std::unique_ptr to heap allocated array of instances of the woss::TimeArr class hierarchy.

Parameters
argsvariadic arguments that will be perfectly forwarded to the underlying woss::TimeArr::createArray() function
Returns
a std::unique_ptr to an array of woss::TimeArr instances

References time_arr_creator.

◆ createTransducer()

template<class... Args>
std::unique_ptr< Transducer > woss::DefHandler::createTransducer ( Args &&...  args) const
inline

Returns a std::unique_ptr to heap allocated instance of the woss::Transducer class hierarchy.

Parameters
argsvariadic arguments that will be perfectly forwarded to the underlying woss::Transducer::create() function
Returns
a std::unique_ptr to a woss::Transducer instance

References transducer_creator.

◆ getDebug()

bool woss::DefHandler::getDebug ( ) const
inline

Returns the current debug flag

Returns
boolean debug flag

References debug.

◆ getRand()

double woss::DefHandler::getRand ( ) const
inline

Returns a random value from the connected woss::RandomGenerator object

Returns
a random value

References rand_generator.

◆ getRandInt()

int woss::DefHandler::getRandInt ( ) const
inline

Returns a random integer from the connected woss::RandomGenerator object

Returns
a random integer value

References rand_generator.

◆ getTimeReference()

double woss::DefHandler::getTimeReference ( ) const
inline

Returns the current simulation time reference from the connected woss::TimeReference object

Returns
a simulation time reference in seconds

References time_reference.

◆ operator=() [1/2]

DefHandler & woss::DefHandler::operator= ( const DefHandler copy)
default

◆ operator=() [2/2]

DefHandler & woss::DefHandler::operator= ( DefHandler &&  tmp)
default

◆ setAltimetry()

void woss::DefHandler::setAltimetry ( std::unique_ptr< Altimetry ptr)
inline

Sets the wos::Altimetry prototype, that will be used by the whole WOSS framework. The ownership of the input smart pointer will be trasfered to the woss::DefHandler instance.

Parameters
ptra std::unique_ptr to a woss::Altimetry object.

References altimetry_creator.

Referenced by woss::WossTest::WossTest().

◆ setDebug()

void woss::DefHandler::setDebug ( bool  flag)
inline

Sets the debug flag.

Parameters
flagdebug flag

References debug.

◆ setLocation()

void woss::DefHandler::setLocation ( std::unique_ptr< Location ptr)
inline

Sets the wos::Location prototype, that will be used by the whole WOSS framework. The ownership of the input smart pointer will be trasfered to the woss::DefHandler instance.

Parameters
ptra std::unique_ptr to a woss::Location object.

References location_creator.

Referenced by woss::WossTest::WossTest().

◆ setPressure()

void woss::DefHandler::setPressure ( std::unique_ptr< Pressure ptr)
inline

Sets the wos::Pressure prototype, that will be used by the whole WOSS framework. The ownership of the input smart pointer will be trasfered to the woss::DefHandler instance.

Parameters
ptra std::unique_ptr to a woss::Pressure object.

References pressure_creator.

Referenced by woss::WossTest::WossTest().

◆ setRandGenerator()

void woss::DefHandler::setRandGenerator ( std::unique_ptr< RandomGenerator ptr)
inline

Sets the wos::RandomGenerator prototype, that will be used by the whole WOSS framework. The ownership of the input smart pointer will be trasfered to the woss::DefHandler instance.

Parameters
ptra std::unique_ptr to a woss::RandomGenerator object.

References rand_generator.

Referenced by woss::WossTest::init().

◆ setSediment()

void woss::DefHandler::setSediment ( std::unique_ptr< Sediment ptr)
inline

Sets the wos::Sediment prototype, that will be used by the whole WOSS framework. The ownership of the input smart pointer will be trasfered to the woss::DefHandler instance.

Parameters
ptra std::unique_ptr to a woss::Sediment object.

References sediment_creator.

Referenced by woss::WossTest::WossTest().

◆ setSSP()

void woss::DefHandler::setSSP ( std::unique_ptr< SSP ptr)
inline

Sets the wos::SSP prototype, that will be used by the whole WOSS framework. The ownership of the input smart pointer will be trasfered to the woss::DefHandler instance.

Parameters
ptra std::unique_ptr to a woss::SSP object.

References ssp_creator.

Referenced by woss::WossTest::WossTest().

◆ setTimeArr()

void woss::DefHandler::setTimeArr ( std::unique_ptr< TimeArr ptr)
inline

Sets the wos::TimeArr prototype, that will be used by the whole WOSS framework. The ownership of the input smart pointer will be trasfered to the woss::DefHandler instance.

Parameters
ptra std::unique_ptr to a woss::TimeArr object.

References time_arr_creator.

Referenced by woss::WossTest::WossTest().

◆ setTimeReference()

void woss::DefHandler::setTimeReference ( std::unique_ptr< TimeReference ptr)
inline

Sets the wos::TimeReference prototype, that will be used by the whole WOSS framework. The ownership of the input smart pointer will be trasfered to the woss::DefHandler instance.

Parameters
ptra std::unique_ptr to a woss::TimeReference object.

References time_reference.

Referenced by woss::WossTest::WossTest().

◆ setTransducer()

void woss::DefHandler::setTransducer ( std::unique_ptr< Transducer ptr)
inline

Sets the wos::Transducer prototype, that will be used by the whole WOSS framework. The ownership of the input smart pointer will be trasfered to the woss::DefHandler instance.

Parameters
ptra std::unique_ptr to a woss::Transducer object.

References transducer_creator.

Referenced by woss::WossTest::WossTest().

Member Data Documentation

◆ altimetry_creator

std::unique_ptr<Altimetry> woss::DefHandler::altimetry_creator = nullptr
private

std::unique_ptr of an instance of the woss::Altimetry class hierarchy

Referenced by createAltimetry(), and setAltimetry().

◆ debug

bool woss::DefHandler::debug = false
private

Debug flag

Referenced by getDebug(), and setDebug().

◆ location_creator

std::unique_ptr<Location> woss::DefHandler::location_creator = nullptr
private

std::unique_ptr of an instance of the woss::Location class hierarchy

Referenced by createLocation(), and setLocation().

◆ pressure_creator

std::unique_ptr<Pressure> woss::DefHandler::pressure_creator = nullptr
private

std::unique_ptr of an instance of the woss::Pressure class hierarchy

Referenced by createPressure(), createPressureArray(), and setPressure().

◆ rand_generator

std::unique_ptr<RandomGenerator> woss::DefHandler::rand_generator = nullptr
private

std::unique_ptr of an instance of the woss::RandomGenerator class hierarchy

Referenced by getRand(), getRandInt(), and setRandGenerator().

◆ sediment_creator

std::unique_ptr<Sediment> woss::DefHandler::sediment_creator = nullptr
private

std::unique_ptr of an instance of the woss::Sediment class hierarchy

Referenced by createSediment(), and setSediment().

◆ ssp_creator

std::unique_ptr<SSP> woss::DefHandler::ssp_creator = nullptr
private

std::unique_ptr of an instance of the woss::SSP class hierarchy

Referenced by createSSP(), and setSSP().

◆ time_arr_creator

std::unique_ptr<TimeArr> woss::DefHandler::time_arr_creator = nullptr
private

std::unique_ptr of an instance of the woss::TimeArr class hierarchy

Referenced by createTimeArr(), createTimeArrArray(), and setTimeArr().

◆ time_reference

std::unique_ptr<TimeReference> woss::DefHandler::time_reference = nullptr
private

std::unique_ptr of an instance of the woss::TimeReference class hierarchy

Referenced by getTimeReference(), and setTimeReference().

◆ transducer_creator

std::unique_ptr<Transducer> woss::DefHandler::transducer_creator = nullptr
private

std::unique_ptr of an instance of the woss::Transducer class hierarchy

Referenced by createTransducer(), and setTransducer().


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