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

Textual WossDb for TimeArr. More...

#include <res-time-arr-txt-db.h>

Inheritance diagram for woss::ResTimeArrTxtDb:
Inheritance graph
Collaboration diagram for woss::ResTimeArrTxtDb:
Collaboration graph

Public Member Functions

 ResTimeArrTxtDb (const std::string &name)
virtual ~ResTimeArrTxtDb () override=default
virtual bool finalizeConnection () override
virtual bool closeConnection () override
virtual std::unique_ptr< TimeArrgetValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value) const override
virtual bool insertValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value, const TimeArr &channel) override
Public Member Functions inherited from woss::WossTextualDb
 WossTextualDb (const std::string &name)
virtual ~WossTextualDb () override
virtual bool openConnection () override
Public Member Functions inherited from woss::WossDb
 WossDb (const std::string &name)
virtual ~WossDb ()=default
void setDbName (const std::string &pathname)
std::string getDbName () const
void setDebug (double flag=true)
bool isUsingDebug () const
virtual bool isValid () const
Public Member Functions inherited from woss::WossResTimeArrDb
 WossResTimeArrDb ()=default
virtual ~WossResTimeArrDb ()=default

Static Public Member Functions

static void setSpaceSampling (double value)
static double getSpaceSampling ()

Protected Types

using TimeMap = std::map< time_t, std::unique_ptr<TimeArr> >
using TMIter = TimeMap::iterator
using TMCIter = TimeMap::const_iterator
using TMRIter = TimeMap::reverse_iterator
using FreqMap = std::map< PDouble, TimeMap >
using FMIter = FreqMap::iterator
using FMCIter = FreqMap::const_iterator
using FMRIter = FreqMap::reverse_iterator
using RxMap = std::map< CoordZ, FreqMap, CoordComparator< ResTimeArrTxtDb, CoordZ > >
using RxMIter = RxMap::iterator
using RxMCIter = RxMap::const_iterator
using RxMRIter = RxMap::reverse_iterator
using ArrMatrix = std::map< CoordZ, RxMap, CoordComparator< ResTimeArrTxtDb, CoordZ > >
using AMXIter = ArrMatrix::iterator
using AMXCIter = ArrMatrix::const_iterator
using AMXRIter = ArrMatrix::reverse_iterator
using AMXCRIter = ArrMatrix::const_reverse_iterator

Protected Member Functions

void printScreenMap ()
virtual bool writeMap ()
virtual bool importMap ()
std::optional< std::unique_ptr< TimeArr > > readMap (const CoordZ &tx, const CoordZ &rx, const double frequency, const Time &time_value) const
Protected Member Functions inherited from woss::WossDb
PathName getPathName (const std::string &complete_path) const

Protected Attributes

ArrMatrix arrivals_map
int initial_arrmap_size
bool has_been_modified
Protected Attributes inherited from woss::WossTextualDb
std::fstream textual_db
Protected Attributes inherited from woss::WossDb
std::string db_name
bool debug

Static Protected Attributes

static double space_sampling = 0.0

Detailed Description

Textual WossDb for TimeArr.

ResTimeArrTxtDb implements WossTextualDb and WossResTimeArrDb for storing calculated TimeArr into a text file

Member Typedef Documentation

◆ AMXCIter

using woss::ResTimeArrTxtDb::AMXCIter = ArrMatrix::const_iterator
protected

◆ AMXCRIter

using woss::ResTimeArrTxtDb::AMXCRIter = ArrMatrix::const_reverse_iterator
protected

◆ AMXIter

using woss::ResTimeArrTxtDb::AMXIter = ArrMatrix::iterator
protected

◆ AMXRIter

using woss::ResTimeArrTxtDb::AMXRIter = ArrMatrix::reverse_iterator
protected

◆ ArrMatrix

Multidimensional map that links a transmitter CoordZ to a receiver CoordZ to a frequency PDouble value and finally to a TimeArr value

◆ FMCIter

using woss::ResTimeArrTxtDb::FMCIter = FreqMap::const_iterator
protected

◆ FMIter

using woss::ResTimeArrTxtDb::FMIter = FreqMap::iterator
protected

◆ FMRIter

using woss::ResTimeArrTxtDb::FMRIter = FreqMap::reverse_iterator
protected

◆ FreqMap

using woss::ResTimeArrTxtDb::FreqMap = std::map< PDouble, TimeMap >
protected

◆ RxMap

◆ RxMCIter

using woss::ResTimeArrTxtDb::RxMCIter = RxMap::const_iterator
protected

◆ RxMIter

using woss::ResTimeArrTxtDb::RxMIter = RxMap::iterator
protected

◆ RxMRIter

using woss::ResTimeArrTxtDb::RxMRIter = RxMap::reverse_iterator
protected

◆ TimeMap

using woss::ResTimeArrTxtDb::TimeMap = std::map< time_t, std::unique_ptr<TimeArr> >
protected

◆ TMCIter

using woss::ResTimeArrTxtDb::TMCIter = TimeMap::const_iterator
protected

◆ TMIter

using woss::ResTimeArrTxtDb::TMIter = TimeMap::iterator
protected

◆ TMRIter

using woss::ResTimeArrTxtDb::TMRIter = TimeMap::reverse_iterator
protected

Constructor & Destructor Documentation

◆ ResTimeArrTxtDb()

ResTimeArrTxtDb::ResTimeArrTxtDb ( const std::string & name)

ResTimeArrTxtDb constructor

Parameters
namepathname of database

References arrivals_map, has_been_modified, initial_arrmap_size, and woss::WossTextualDb::WossTextualDb().

Referenced by woss::ResTimeArrBinDb::ResTimeArrBinDb().

Here is the call graph for this function:

◆ ~ResTimeArrTxtDb()

virtual woss::ResTimeArrTxtDb::~ResTimeArrTxtDb ( )
overridevirtualdefault

Member Function Documentation

◆ closeConnection()

bool ResTimeArrTxtDb::closeConnection ( )
overridevirtual

Closes the connection to the text file provided

Returns
true if method was successful, false otherwise

Reimplemented from woss::WossTextualDb.

References woss::WossTextualDb::closeConnection(), woss::WossDb::debug, has_been_modified, and writeMap().

Here is the call graph for this function:

◆ finalizeConnection()

bool ResTimeArrTxtDb::finalizeConnection ( )
overridevirtual

Post openConnection() actions

Returns
true if method was successful, false otherwise

Implements woss::WossDb.

References importMap().

Here is the call graph for this function:

◆ getSpaceSampling()

double woss::ResTimeArrTxtDb::getSpaceSampling ( )
inlinestatic

References space_sampling.

◆ getValue()

std::unique_ptr< TimeArr > ResTimeArrTxtDb::getValue ( const CoordZ & coord_tx,
const CoordZ & coord_rx,
const double frequency,
const Time & time_value ) const
overridevirtual

Returns a pointer to a heap-created TimeArr value for given frequency, transmitter and receiver coordinates if present in the database. User is responsible of pointer's ownership

Parameters
coord_txconst reference to a valid CoordZ object
coord_rxconst reference to a valid CoordZ object
frequencyused frequency [hz]
time_valueconst reference to a valid Time object
Returns
a std::unique_ptr to a valid TimeArr if parameters are found, not valid otherwise

Implements woss::WossResTimeArrDb.

References arrivals_map, woss::TimeArr::createNotValid(), woss::DefHandler::createTimeArr(), woss::Singleton< DefHandler >::instance(), woss::Time::isValid(), and readMap().

Here is the call graph for this function:

◆ importMap()

bool ResTimeArrTxtDb::importMap ( )
protectedvirtual

Imports the formatted textual files into arrivals_map. The column format is the following:
tx latitude, tx longitude, tx depth, rx latitude, rx longitude, rx depth, frequency, total channel taps, delay-i-th real pressure-i-th, imag pressure-i-th

Returns
true if operation succeeds, false otherwise

Reimplemented in woss::ResTimeArrBinDb.

References arrivals_map, woss::DefHandler::createTimeArr(), woss::WossDb::db_name, woss::WossDb::debug, initial_arrmap_size, woss::Singleton< DefHandler >::instance(), printScreenMap(), and woss::WossTextualDb::textual_db.

Referenced by finalizeConnection().

Here is the call graph for this function:

◆ insertValue()

bool ResTimeArrTxtDb::insertValue ( const CoordZ & coord_tx,
const CoordZ & coord_rx,
const double frequency,
const Time & time_value,
const TimeArr & channel )
overridevirtual

Inserts the given TimeArr value in the arrivals_map at given frequency, transmitter and receiver coordinates

Parameters
coord_txconst reference to a valid CoordZ object
coord_rxconst reference to a valid CoordZ object
frequencyused frequency [hz]
time_valueconst reference to a valid Time& object
channelcomputed TimeArr

Implements woss::WossResTimeArrDb.

References arrivals_map, woss::TimeArr::clone(), woss::WossDb::debug, and has_been_modified.

Here is the call graph for this function:

◆ printScreenMap()

void ResTimeArrTxtDb::printScreenMap ( )
protected

Prints arrivals_map to screen. The columns format is the following:
tx latitude, tx longitude, tx depth, rx latitude, rx longitude, rx depth, frequency, total channel taps, delay-i-th real pressure-i-th, imag pressure-i-th

Returns
true if operation succeeds, false otherwise

References arrivals_map, woss::TimeArr::size(), and woss::WossTextualDb::textual_db.

Referenced by woss::ResTimeArrBinDb::importMap(), importMap(), woss::ResTimeArrBinDb::writeMap(), and writeMap().

Here is the call graph for this function:

◆ readMap()

std::optional< std::unique_ptr< TimeArr > > ResTimeArrTxtDb::readMap ( const CoordZ & tx,
const CoordZ & rx,
const double frequency,
const Time & time_value ) const
protected

Reads given values from arrivals_map

Parameters
txvalid transmitter coordinates
rxvalid receiver coordinates
frequencyfrequency [hz]
time_valueconst reference to a valid Time object
Returns
std::optional to a std::unique_ptr to a valid TimeArr if parameters are found, not valid otherwise

References arrivals_map, and woss::WossDb::debug.

Referenced by getValue().

◆ setSpaceSampling()

void woss::ResTimeArrTxtDb::setSpaceSampling ( double value)
inlinestatic

References space_sampling.

◆ writeMap()

bool ResTimeArrTxtDb::writeMap ( )
protectedvirtual

Writes arrivals_map into the textual file. The columns format is the following:
tx latitude, tx longitude, tx depth, rx latitude, rx longitude, rx depth, frequency, total channel taps, delay-i-th real pressure-i-th, imag pressure-i-th

Returns
true if operation succeeds, false otherwise

Reimplemented in woss::ResTimeArrBinDb.

References arrivals_map, woss::WossDb::db_name, woss::WossDb::debug, printScreenMap(), woss::TimeArr::size(), and woss::WossTextualDb::textual_db.

Referenced by closeConnection().

Here is the call graph for this function:

Member Data Documentation

◆ arrivals_map

ArrMatrix woss::ResTimeArrTxtDb::arrivals_map
protected

◆ has_been_modified

bool woss::ResTimeArrTxtDb::has_been_modified
protected

◆ initial_arrmap_size

int woss::ResTimeArrTxtDb::initial_arrmap_size
protected

arrivals_map's initial size. If pressure_map's size is greater on closeConnection() the map will be written to disk

Referenced by woss::ResTimeArrBinDb::importMap(), importMap(), and ResTimeArrTxtDb().

◆ space_sampling

double ResTimeArrTxtDb::space_sampling = 0.0
staticprotected

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