World Ocean Simulation System (WOSS) library
woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp > Class Template Reference

Class for managing custom db data. More...

#include <woss-db-custom-data-container.h>

Inheritance diagram for woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >:
Inheritance graph
Collaboration diagram for woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >:
Collaboration graph

Public Member Functions

 CustomDataTimeContainer ()
 
 ~CustomDataTimeContainer ()
 
MediumDataoperator[] (const T &key)
 
bool empty () const
 
int size () const
 
Data get (const T &t=DB_CDATA_ALL_OUTER_KEYS, double b=DB_CDATA_ALL_MEDIUM_KEYS, double r=DB_CDATA_ALL_INNER_KEYS, const Time &time_key=DB_CDATA_ALL_TIME_KEYS) const
 
Data get (const T &tx, const T &rx, const Time &time_key=DB_CDATA_ALL_TIME_KEYS) const
 
bool insert (const Data &data, const T &t=DB_CDATA_ALL_OUTER_KEYS, double b=DB_CDATA_ALL_MEDIUM_KEYS, double r=DB_CDATA_ALL_INNER_KEYS, const Time &time_key=DB_CDATA_ALL_TIME_KEYS)
 
void replace (const Data &data, const T &t=DB_CDATA_ALL_OUTER_KEYS, double b=DB_CDATA_ALL_MEDIUM_KEYS, double r=DB_CDATA_ALL_INNER_KEYS, const Time &time_key=DB_CDATA_ALL_TIME_KEYS)
 
void erase (const T &t=DB_CDATA_ALL_OUTER_KEYS, double b=DB_CDATA_ALL_MEDIUM_KEYS, double r=DB_CDATA_ALL_INNER_KEYS, const Time &time_key=DB_CDATA_ALL_TIME_KEYS)
 
void clear ()
 
void setDebug (bool flag)
 
bool usingDebug ()
 

Static Public Attributes

static constexpr double DB_CDATA_ALL_MEDIUM_KEYS = -190.0
 
static constexpr double DB_CDATA_ALL_INNER_KEYS = -10.0
 
static const double DB_CDATA_ALL_MEDIUM_KEYS = -190.0
 
static const double DB_CDATA_ALL_INNER_KEYS = -10.0
 
static const T DB_CDATA_ALL_OUTER_KEYS = T()
 
static const Time DB_CDATA_ALL_TIME_KEYS = Time(1, 1, 1901, 0, 0, 0)
 

Protected Types

typedef ::std::map< time_t, Data > TimeData
 
typedef TimeData::iterator CDTCTimeIt
 
typedef TimeData::reverse_iterator CDTCTimeRIt
 
typedef TimeData::const_iterator CDTCTimeCIt
 
typedef TimeData::const_reverse_iterator CDTCTimeCRIt
 
typedef ::std::map< double, TimeData, InComp > InnerData
 
typedef InnerData::iterator CDCInnerIt
 
typedef InnerData::reverse_iterator CDCInnerRIt
 
typedef InnerData::const_iterator CDCInnerCIt
 
typedef InnerData::const_reverse_iterator CDCInnerCRIt
 
typedef ::std::map< double, InnerData, MidComp > MediumData
 
typedef MediumData::iterator CDCMediumIt
 
typedef MediumData::const_iterator CDCMediumCIt
 
typedef MediumData::reverse_iterator CDCMediumRIt
 
typedef MediumData::const_reverse_iterator CDCMediumCRIt
 
typedef ::std::map< T, MediumData, OutComp > CustomContainer
 
typedef CustomContainer::iterator CDCIt
 
typedef CustomContainer::reverse_iterator CDCRIt
 
typedef CustomContainer::const_iterator CDCCIt
 
typedef CustomContainer::const_reverse_iterator CDCCRIt
 
typedef ::std::pair< Data, bool > DataFind
 

Protected Member Functions

DataFind find (const T &t=DB_CDATA_ALL_OUTER_KEYS, double b=DB_CDATA_ALL_MEDIUM_KEYS, double r=DB_CDATA_ALL_INNER_KEYS, const Time &time_key=DB_CDATA_ALL_TIME_KEYS) const
 
Data calculateData (const TimeData &time_data, const Time &time_key=DB_CDATA_ALL_TIME_KEYS) const
 

Protected Attributes

bool debug
 
CustomContainer data_map
 

Detailed Description

template<class T, class MidFunctor, class InFunctor, class Data, class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
class woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >

Class for managing custom db data.

CustomDataTimeContainer is a template that manages environmental data provided by the user. It sorts data by the first template parameter then by two doubles, (e.g. bearing and range) and woss::Time

Member Typedef Documentation

◆ CustomContainer

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
typedef ::std::map< T, MediumData, OutComp > woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::CustomContainer
protected

The outer level map, that links a the first template parameter to a MediumData instance

◆ InnerData

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
typedef ::std::map< double, TimeData, InComp > woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::InnerData
protected

The inner level map, that links a double to TimeData

◆ MediumData

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
typedef ::std::map< double, InnerData, MidComp > woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::MediumData
protected

The medium level map, that links a double to a InnerData instance

◆ TimeData

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
typedef ::std::map< time_t, Data > woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::TimeData
protected

The Time map, that links a time_t to actual data

Constructor & Destructor Documentation

◆ CustomDataTimeContainer()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::CustomDataTimeContainer ( )
inline

CustomDataTimeContainer default constructor

◆ ~CustomDataTimeContainer()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::~CustomDataTimeContainer ( )
inline

Member Function Documentation

◆ calculateData()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp , class MidComp , class InComp >
Data woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::calculateData ( const TimeData time_data,
const Time time_key = DB_CDATA_ALL_TIME_KEYS 
) const
protected

Finds the given keys. Returns NULL if not found

Parameters
tconst reference to a T instance, default value is DB_CDATA_ALL_OUTER_KEYS. Default value means valid for all possible instances of T
bdouble, default value is DB_CDATA_ALL_MEDIUM_KEYS. Default value means valid for all possible doubles of MediumData
rdouble, default value is DB_CDATA_ALL_INNER_KEYS. Default value means valid for all possible doubles of InnerData
time_keyconst reference to a Time instance, default value is DB_CDATA_ALL_TIME_KEYS. Default value means it is valid for all possible Time values of TimeData
Returns
valid Data object if map is not empty. Data() otherwise

◆ clear()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp , class MidComp , class InComp >
void woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::clear ( )

◆ empty()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
bool woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::empty ( ) const
inline

Checks if the outer map is empty

Returns
true if it is empty, false otherwise

References woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::data_map.

Referenced by woss::WossDbManager::getAverageSSP(), and woss::WossDbManager::getSSP().

◆ erase()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp , class MidComp , class InComp >
void woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::erase ( const T &  t = DB_CDATA_ALL_OUTER_KEYS,
double  b = DB_CDATA_ALL_MEDIUM_KEYS,
double  r = DB_CDATA_ALL_INNER_KEYS,
const Time time_key = DB_CDATA_ALL_TIME_KEYS 
)

Erases a Data object for given parameters.

Parameters
tconst reference to a T instance, default value is DB_CDATA_ALL_OUTER_KEYS. Default value means valid for all possible instances of T
bdouble, default value is DB_CDATA_ALL_MEDIUM_KEYS. Default value means valid for all possible doubles of MediumData
rdouble, default value is DB_CDATA_ALL_INNER_KEYS. Default value means valid for all possible doubles of InnerData
time_keyconst reference to a Time instance, default value is DB_CDATA_ALL_TIME_KEYS. Default value means it is valid for all possible Time values of TimeData
Returns
true if function was successful, false otherwise

Referenced by woss::WossDbManager::eraseCustomSSP().

◆ find()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp , class MidComp , class InComp >
CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::DataFind woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::find ( const T &  t = DB_CDATA_ALL_OUTER_KEYS,
double  b = DB_CDATA_ALL_MEDIUM_KEYS,
double  r = DB_CDATA_ALL_INNER_KEYS,
const Time time_key = DB_CDATA_ALL_TIME_KEYS 
) const
protected

Finds the given keys. Returns NULL if not found

Parameters
tconst reference to a T instance, default value is DB_CDATA_ALL_OUTER_KEYS. Default value means valid for all possible instances of T
bdouble, default value is DB_CDATA_ALL_MEDIUM_KEYS. Default value means valid for all possible doubles of MediumData
rdouble, default value is DB_CDATA_ALL_INNER_KEYS. Default value means valid for all possible doubles of InnerData
time_keyconst reference to a Time instance, default value is DB_CDATA_ALL_TIME_KEYS. Default value means it is valid for all possible Time values of TimeData
Returns
pair of Data and a boolean. if boolean == true ==> Data is valid. Data is not valid otherwise.

◆ get() [1/2]

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp , class MidComp , class InComp >
Data woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::get ( const T &  t = DB_CDATA_ALL_OUTER_KEYS,
double  b = DB_CDATA_ALL_MEDIUM_KEYS,
double  r = DB_CDATA_ALL_INNER_KEYS,
const Time time_key = DB_CDATA_ALL_TIME_KEYS 
) const

Finds and returns a const pointer to a Data for given parameters

Parameters
tconst reference to a T instance, default value is DB_CDATA_ALL_OUTER_KEYS. Default value means valid for all possible instances of T
bdouble, default value is DB_CDATA_ALL_MEDIUM_KEYS. Default value means valid for all possible doubles of MediumData
rdouble, default value is DB_CDATA_ALL_INNER_KEYS. Default value means valid for all possible doubles of InnerData
time_keyconst reference to a Time instance, default value is DB_CDATA_ALL_TIME_KEYS. Default value means it is valid for all possible Time values of TimeData
Returns
valid Data object if map is not empty. Data() otherwise

Referenced by woss::WossDbManager::getAverageSSP(), woss::WossDbManager::getCustomSSP(), and woss::WossDbManager::getSSP().

◆ get() [2/2]

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp , class MidComp , class InComp >
Data woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::get ( const T &  tx,
const T &  rx,
const Time time_key = DB_CDATA_ALL_TIME_KEYS 
) const

Finds and returns a const pointer to a Data for the nearest match in all generated keys

Parameters
txconst reference to a T instance
rxconst reference to a T instance
time_keyconst reference to a Time instance, default value is DB_CDATA_ALL_TIME_KEYS. Default value means it is valid for all possible Time values of TimeData
Returns
valid Data object if map is not empty. Data() otherwise

◆ insert()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp , class MidComp , class InComp >
bool woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::insert ( const Data &  data,
const T &  t = DB_CDATA_ALL_OUTER_KEYS,
double  b = DB_CDATA_ALL_MEDIUM_KEYS,
double  r = DB_CDATA_ALL_INNER_KEYS,
const Time time_key = DB_CDATA_ALL_TIME_KEYS 
)

Inserts a Data object for given parameters. If keys are already present, the object is discarded

Parameters
dataconst reference to a Data object to be inserted
tconst reference to a T instance, default value is DB_CDATA_ALL_OUTER_KEYS. Default value means valid for all possible instances of T
bdouble, default value is DB_CDATA_ALL_MEDIUM_KEYS. Default value means valid for all possible doubles of MediumData
rdouble, default value is DB_CDATA_ALL_INNER_KEYS. Default value means valid for all possible doubles of InnerData
time_keyconst reference to a Time instance, default value is DB_CDATA_ALL_TIME_KEYS. Default value means it is valid for all possible Time values of TimeData
Returns
true if function was successful, false otherwise

Referenced by woss::WossDbManager::importCustomSSP(), and woss::WossDbManager::setCustomSSP().

◆ operator[]()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
MediumData & woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::operator[] ( const T &  key)
inline

operator[]

Parameters
keya const reference to a T type ( first class parameter of template )
Returns
a reference to the linked MediumData

References woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::data_map.

◆ replace()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp , class MidComp , class InComp >
void woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::replace ( const Data &  data,
const T &  t = DB_CDATA_ALL_OUTER_KEYS,
double  b = DB_CDATA_ALL_MEDIUM_KEYS,
double  r = DB_CDATA_ALL_INNER_KEYS,
const Time time_key = DB_CDATA_ALL_TIME_KEYS 
)

Replaces a Data object for given parameters. If keys are not present, the object is inserted

Parameters
dataconst reference to a Data object to be inserted
tconst reference to a T instance, default value is DB_CDATA_ALL_OUTER_KEYS. Default value means valid for all possible instances of T
bdouble, default value is DB_CDATA_ALL_MEDIUM_KEYS. Default value means valid for all possible doubles of MediumData
rdouble, default value is DB_CDATA_ALL_INNER_KEYS. Default value means valid for all possible doubles of InnerData
time_keyconst reference to a Time instance, default value is DB_CDATA_ALL_TIME_KEYS. Default value means it is valid for all possible Time values of TimeData
Returns
true if function was successful, false otherwise

◆ setDebug()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
void woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::setDebug ( bool  flag)
inline

◆ size()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
int woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::size ( ) const
inline

◆ usingDebug()

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
bool woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::usingDebug ( )
inline

Member Data Documentation

◆ data_map

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
CustomContainer woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::data_map
protected

◆ debug

template<class T , class MidFunctor , class InFunctor , class Data , class OutComp = ::std::less<T>, class MidComp = ::std::less<double>, class InComp = ::std::less<double>>
bool woss::CustomDataTimeContainer< T, MidFunctor, InFunctor, Data, OutComp, MidComp, InComp >::debug
protected

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