World Ocean Simulation System (WOSS) library
res-time-arr-txt-db.h
Go to the documentation of this file.
1/* WOSS - World Ocean Simulation System -
2 *
3 * Copyright (C) 2009 2025 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - WOSS@guerra-tlc.com
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation;
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22
33#ifndef WOSS_RES_TIME_ARR_TXT_DB_H
34#define WOSS_RES_TIME_ARR_TXT_DB_H
35
36#include <string>
37#include <memory>
38#include <optional>
41#include "woss-db.h"
42
43
44namespace woss {
45
46
54
55 public:
56
61 ResTimeArrTxtDb( const std::string& name );
62
63 virtual ~ResTimeArrTxtDb() override = default;
64
65
70 virtual bool finalizeConnection() override;
71
72
77 virtual bool closeConnection() override;
78
79
90 virtual std::unique_ptr<TimeArr> getValue( const CoordZ& coord_tx, const CoordZ& coord_rx, const double frequency, const Time& time_value ) const override;
91
100 virtual bool insertValue( const CoordZ& coord_tx, const CoordZ& coord_rx, const double frequency,const Time& time_value, const TimeArr& channel ) override;
101
102
103 static void setSpaceSampling( double value ) { space_sampling = value; }
104
105 static double getSpaceSampling() { return space_sampling; }
106
107 protected:
108
109 using TimeMap = std::map< time_t, std::unique_ptr<TimeArr> >;
110 using TMIter = TimeMap::iterator;
111 using TMCIter = TimeMap::const_iterator;
112 using TMRIter = TimeMap::reverse_iterator;
113
114 using FreqMap = std::map< PDouble, TimeMap >;
115 using FMIter = FreqMap::iterator;
116 using FMCIter = FreqMap::const_iterator;
117 using FMRIter = FreqMap::reverse_iterator;
118
119 using RxMap = std::map< CoordZ, FreqMap, CoordComparator< ResTimeArrTxtDb, CoordZ > >;
120 using RxMIter = RxMap::iterator;
121 using RxMCIter = RxMap::const_iterator;
122 using RxMRIter = RxMap::reverse_iterator;
123
128 using ArrMatrix = std::map< CoordZ, RxMap, CoordComparator< ResTimeArrTxtDb, CoordZ > >;
129 using AMXIter = ArrMatrix::iterator;
130 using AMXCIter = ArrMatrix::const_iterator;
131 using AMXRIter = ArrMatrix::reverse_iterator;
132 using AMXCRIter = ArrMatrix::const_reverse_iterator;
133
134 static double space_sampling;
135
140
145
147
154 void printScreenMap();
155
162 virtual bool writeMap();
163
170 virtual bool importMap();
171
180 std::optional< std::unique_ptr< TimeArr > > readMap( const CoordZ& tx, const CoordZ& rx, const double frequency, const Time& time_value ) const;
181
182 };
183
184}
185
186#endif /* WOSS_RES_TIME_ARR_TXT_DB_H */
3D-Coordinates (lat, long, depth) class definitions and functions library
Definition coordinates-definitions.h:384
Textual WossDb for TimeArr.
Definition res-time-arr-txt-db.h:53
virtual bool closeConnection() override
Definition res-time-arr-txt-db.cpp:375
std::map< PDouble, TimeMap > FreqMap
Definition res-time-arr-txt-db.h:114
static double getSpaceSampling()
Definition res-time-arr-txt-db.h:105
virtual ~ResTimeArrTxtDb() override=default
FreqMap::const_iterator FMCIter
Definition res-time-arr-txt-db.h:116
FreqMap::reverse_iterator FMRIter
Definition res-time-arr-txt-db.h:117
bool has_been_modified
Definition res-time-arr-txt-db.h:146
TimeMap::iterator TMIter
Definition res-time-arr-txt-db.h:110
int initial_arrmap_size
Definition res-time-arr-txt-db.h:144
virtual bool importMap()
Definition res-time-arr-txt-db.cpp:63
virtual bool writeMap()
Definition res-time-arr-txt-db.cpp:179
static double space_sampling
Definition res-time-arr-txt-db.h:134
ArrMatrix::const_iterator AMXCIter
Definition res-time-arr-txt-db.h:130
TimeMap::const_iterator TMCIter
Definition res-time-arr-txt-db.h:111
RxMap::reverse_iterator RxMRIter
Definition res-time-arr-txt-db.h:122
virtual std::unique_ptr< TimeArr > getValue(const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value) const override
Definition res-time-arr-txt-db.cpp:388
ArrMatrix::reverse_iterator AMXRIter
Definition res-time-arr-txt-db.h:131
ArrMatrix arrivals_map
Definition res-time-arr-txt-db.h:139
static void setSpaceSampling(double value)
Definition res-time-arr-txt-db.h:103
std::map< CoordZ, RxMap, CoordComparator< ResTimeArrTxtDb, CoordZ > > ArrMatrix
Definition res-time-arr-txt-db.h:128
std::map< CoordZ, FreqMap, CoordComparator< ResTimeArrTxtDb, CoordZ > > RxMap
Definition res-time-arr-txt-db.h:119
FreqMap::iterator FMIter
Definition res-time-arr-txt-db.h:115
ArrMatrix::const_reverse_iterator AMXCRIter
Definition res-time-arr-txt-db.h:132
std::optional< std::unique_ptr< TimeArr > > readMap(const CoordZ &tx, const CoordZ &rx, const double frequency, const Time &time_value) const
Definition res-time-arr-txt-db.cpp:135
TimeMap::reverse_iterator TMRIter
Definition res-time-arr-txt-db.h:112
virtual bool insertValue(const CoordZ &coord_tx, const CoordZ &coord_rx, const double frequency, const Time &time_value, const TimeArr &channel) override
Definition res-time-arr-txt-db.cpp:401
RxMap::iterator RxMIter
Definition res-time-arr-txt-db.h:120
void printScreenMap()
Definition res-time-arr-txt-db.cpp:279
ArrMatrix::iterator AMXIter
Definition res-time-arr-txt-db.h:129
virtual bool finalizeConnection() override
Definition res-time-arr-txt-db.cpp:369
RxMap::const_iterator RxMCIter
Definition res-time-arr-txt-db.h:121
std::map< time_t, std::unique_ptr< TimeArr > > TimeMap
Definition res-time-arr-txt-db.h:109
Channel power delay profile class.
Definition time-arrival-definitions.h:70
a class for time date manipulation
Definition time-definitions.h:83
Data behaviour class for storing calculated TimeArr.
Definition woss-db.h:374
Textual implementation of WossDb.
Definition woss-db.h:224
Provides the interface for the woss::Coord and woss::CoordZ classes.
Definition ac-toolbox-arr-asc-reader.h:44
Definitions and library for woss::TimeArr class.
Provides the interface for woss::WossDb class.