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 bool finalizeConnection ()
 
virtual bool closeConnection ()
 
virtual TimeArrgetValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value) const
 
virtual bool insertValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value, const TimeArr &channel)
 
- Public Member Functions inherited from woss::WossTextualDb
 WossTextualDb (const ::std::string &name)
 
virtual bool openConnection ()
 
virtual bool closeConnection ()
 
- Public Member Functions inherited from woss::WossDb
 WossDb (const ::std::string &name)
 
void setDbName (const ::std::string &pathname)
 
::std::string getDbName () const
 
void setDebug (double flag=true)
 
bool isUsingDebug () const
 
virtual bool isValid ()
 
virtual bool openConnection ()=0
 
virtual bool finalizeConnection ()=0
 
virtual bool closeConnection ()=0
 
virtual TimeArrgetValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value) const =0
 
virtual bool insertValue (const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value, const TimeArr &channel)=0
 

Static Public Member Functions

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

Protected Types

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

Protected Member Functions

void printScreenMap ()
 
virtual bool writeMap ()
 
virtual bool importMap ()
 
const TimeArrreadMap (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)
 

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

◆ ArrMatrix

typedef ::std::map< CoordZ, RxMap, CoordComparator< ResTimeArrTxtDb, CoordZ > > woss::ResTimeArrTxtDb::ArrMatrix
protected

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

Constructor & Destructor Documentation

◆ ResTimeArrTxtDb()

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

ResTimeArrTxtDb constructor

Parameters
namepathname of database

Member Function Documentation

◆ closeConnection()

bool ResTimeArrTxtDb::closeConnection ( )
virtual

Closes the connection to the text file provided

Returns
true if method was successful, false otherwise

Reimplemented from woss::WossTextualDb.

References woss::WossTextualDb::closeConnection(), and writeMap().

Here is the call graph for this function:

◆ finalizeConnection()

bool ResTimeArrTxtDb::finalizeConnection ( )
virtual

Post openConnection() actions

Returns
true if method was successful, false otherwise

Implements woss::WossDb.

References importMap().

Here is the call graph for this function:

◆ getValue()

TimeArr * ResTimeArrTxtDb::getValue ( const CoordZ coord_tx,
const CoordZ coord_rx,
const double  frequency,
const Time time_value 
) const
virtual

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
valid TimeArr if parameters are found, not valid otherwise

Implements woss::WossResTimeArrDb.

References arrivals_map, woss::TimeArr::create(), woss::TimeArr::createNotValid(), woss::Singleton< T >::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 woss::WossDb::db_name, and woss::WossTextualDb::textual_db.

Referenced by finalizeConnection().

◆ insertValue()

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

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, and woss::WossDb::debug.

◆ 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

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

◆ readMap()

const 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
valid TimeArr if parameters are found, not valid otherwise

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

Referenced by getValue().

◆ 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 woss::WossDb::db_name, and woss::WossTextualDb::textual_db.

Referenced by closeConnection().

Member Data Documentation

◆ arrivals_map

ArrMatrix woss::ResTimeArrTxtDb::arrivals_map
protected

ArrMatrix map for storing imported and user inserted TimeArr values

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

◆ 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().


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