World Ocean Simulation System (WOSS) library
woss-creator.h
Go to the documentation of this file.
1/* WOSS - World Ocean Simulation System -
2 *
3 * Copyright (C) 2009 Federico Guerra
4 * and regents of the SIGNET lab, University of Padova
5 *
6 * Author: Federico Guerra - federico@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/*
23 * This software has been developed by Federico Guerra and SIGNET lab,
24 * University of Padova, in collaboration with the NATO Centre for
25 * Maritime Research and Experimentation (http://www.cmre.nato.int ;
26 * E-mail: pao@cmre.nato.int), whose support is gratefully acknowledged.
27 */
28
29
40#ifndef WOSS_CREATOR_DEFINITIONS_H
41#define WOSS_CREATOR_DEFINITIONS_H
42
43
44#define WOSS_CREATOR_MAX_FREQ_STEP (1.0e20)
45#define WOSS_CREATOR_ALL_COORDZ CoordZ()
46
47
48#include "woss.h"
50
51
52namespace woss {
53
54
55
56 class WossDbManager;
57 class TransducerHandler;
58
59
66
67
68 protected:
69
70
75
80
85
86
87 public:
88
89
94
95 virtual ~WossCreator() { }
96
97
106 virtual Woss* const createWoss( const CoordZ& tx, const CoordZ& rx, double start_freq, double end_freq ) const = 0;
107
108
114 WossCreator& setWossDebug( bool flag ) { woss_debug = flag; return *this; }
115
121 WossCreator& setDebug( bool flag ) { debug = flag; updateDebugFlag(); return *this; }
122
127 bool usingDebug() const { return debug; }
128
133 bool usingWossDebug() const { return woss_debug; }
134
135
141 WossCreator& setWrkDirPath( const ::std::string& path ) { work_dir_path = path; return *this; }
142
148 WossCreator& setCleanWorkDir( bool flag ) { woss_clean_workdir = flag; return *this; }
149
154 ::std::string getWrkDirPath() const { return work_dir_path; }
155
156
164 WossCreator& setFrequencyStep( double f_step, const CoordZ& tx, const CoordZ& rx ) {
165 if ( f_step <= 0.0 ) f_step = WOSS_CREATOR_MAX_FREQ_STEP;
166 ccfrequency_step.replace(f_step, tx, rx);
167 return *this; }
168
177 if ( f_step <= 0.0 ) f_step = WOSS_CREATOR_MAX_FREQ_STEP;
178 ccfrequency_step.replace(f_step, tx, rx);
179 return *this; }
180
187 double getFrequencyStep( const CoordZ& tx, const CoordZ& rx ) const {
188 return ccfrequency_step.get(tx, rx); }
189
197 return ccfrequency_step.get(tx, rx); }
198
205 WossCreator& eraseFrequencyStep( const CoordZ& tx, const CoordZ& rx ) {
206 ccfrequency_step.erase(tx, rx); return *this; }
207
216
217
225 WossCreator& setEvolutionTimeQuantum( double value, const CoordZ& tx, const CoordZ& rx ) {
226 ccevolution_time_quantum.replace( value, tx, rx ); return *this; }
227
236 ccevolution_time_quantum.replace( value, tx, rx ); return *this; }
237
244 double getEvolutionTimeQuantum( const CoordZ& tx, const CoordZ& rx ) const {
245 return ccevolution_time_quantum.get(tx, rx); }
246
255
263 ccevolution_time_quantum.erase(tx, rx); return *this; }
264
273
274
282 WossCreator& setTotalRuns( int runs, const CoordZ& tx, const CoordZ& rx ) {
283 cctotal_runs.replace( runs, tx, rx ); return *this; }
284
293 cctotal_runs.replace( runs, tx, rx ); return *this; }
294
301 int getTotalRuns( const CoordZ& tx, const CoordZ& rx ) const {
302 return cctotal_runs.get(tx, rx); }
303
311 return cctotal_runs.get(tx, rx); }
312
319 WossCreator& eraseTotalRuns( const CoordZ& tx, const CoordZ& rx ) {
320 cctotal_runs.erase( tx, rx ); return *this; }
321
329 cctotal_runs.erase( tx, rx ); return *this; }
330
331
339 WossCreator& setSimTime( const SimTime& simtime, const CoordZ& tx, const CoordZ& rx ) {
340 ccsimtime_map.replace(simtime, tx, rx); return *this; }
341
350 ccsimtime_map.replace(simtime, tx, rx); return *this; }
351
358 SimTime getSimTime( const CoordZ& tx, const CoordZ& rx ) const {
359 return ccsimtime_map.get(tx, rx); }
360
369
376 WossCreator& eraseSimTime( const CoordZ& tx, const CoordZ& rx ) { ccsimtime_map.erase(tx, rx); return *this; }
377
386
387
393 WossCreator& setWossDbManager( const WossDbManager* const ptr ) { woss_db_manager = ptr; return *this; }
394
395
401 WossCreator& setTransducerHandler( const TransducerHandler* const ptr ) { transducer_handler = ptr; return *this; }
402
403
404 const Woss& getWossNotValid() const;
405
406
407 protected:
408
409
410 static const Woss* woss_not_valid;
411
412
413 const WossDbManager* woss_db_manager;
414
415
416 const TransducerHandler* transducer_handler;
417
418
422 ::std::string work_dir_path;
423
424
429
434
439
440
445
446
450 bool debug;
451
456
461
462
468 virtual bool initializeWoss( Woss* const woss_ptr ) const = 0;
469
470 virtual const Woss* createNotValidWoss() const = 0;
471
475 virtual void updateDebugFlag();
476
477 };
478
479
480}
481
482
483#endif /* WOSS_CREATOR_DEFINITIONS_H */
484
3D-Coordinates (lat, long, depth) class definitions and functions library
Definition coordinates-definitions.h:403
Class that stores the coordinates of moving entity.
Definition location-definitions.h:60
Transducer creator and handler class.
Definition transducer-handler.h:63
Data get(Location *const tx, Location *const rx) const
Definition woss-creator-container.cpp:157
void replace(const Data &data, Location *const tx, Location *const rx)
Definition woss-creator-container.h:559
void erase(Location *const tx, Location *const rx)
Definition woss-creator-container.h:532
static Location *const ALL_LOCATIONS
Definition woss-creator-container.h:133
Abstract class that provides correctly initialized Woss objects.
Definition woss-creator.h:65
int getTotalRuns(Location *const tx=CCInt::ALL_LOCATIONS, Location *const rx=CCInt::ALL_LOCATIONS) const
Definition woss-creator.h:310
WossCreator & eraseSimTime(const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:376
WossCreator & setWossDebug(bool flag)
Definition woss-creator.h:114
virtual bool initializeWoss(Woss *const woss_ptr) const =0
Definition woss-creator.cpp:74
bool usingWossDebug() const
Definition woss-creator.h:133
WossCreator & eraseEvolutionTimeQuantum(const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:262
WossCreator & setFrequencyStep(double f_step, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:164
CCDouble ccevolution_time_quantum
Definition woss-creator.h:428
WossCreator & setFrequencyStep(double f_step, Location *const tx=CCDouble::ALL_LOCATIONS, Location *const rx=CCDouble::ALL_LOCATIONS)
Definition woss-creator.h:176
WossCreator & setDebug(bool flag)
Definition woss-creator.h:121
bool usingDebug() const
Definition woss-creator.h:127
WossCreator()
Definition woss-creator.cpp:50
WossCreator & setTotalRuns(int runs, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:282
WossCreator & setSimTime(const SimTime &simtime, Location *const tx=CCSimTime::ALL_LOCATIONS, Location *const rx=CCSimTime::ALL_LOCATIONS)
Definition woss-creator.h:349
WossCreator & eraseSimTime(Location *const tx=CCSimTime::ALL_LOCATIONS, Location *const rx=CCSimTime::ALL_LOCATIONS)
Definition woss-creator.h:384
WossCreator & eraseTotalRuns(const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:319
virtual Woss *const createWoss(const CoordZ &tx, const CoordZ &rx, double start_freq, double end_freq) const =0
double getFrequencyStep(Location *const tx=CCDouble::ALL_LOCATIONS, Location *const rx=CCDouble::ALL_LOCATIONS) const
Definition woss-creator.h:196
WossCreator & setTotalRuns(int runs, Location *const tx=CCInt::ALL_LOCATIONS, Location *const rx=CCInt::ALL_LOCATIONS)
Definition woss-creator.h:292
SimTime getSimTime(const CoordZ &tx, const CoordZ &rx) const
Definition woss-creator.h:358
double getEvolutionTimeQuantum(const CoordZ &tx, const CoordZ &rx) const
Definition woss-creator.h:244
WossCreatorContainer< int > CCInt
Definition woss-creator.h:84
virtual void updateDebugFlag()
Definition woss-creator.cpp:67
WossCreator & setCleanWorkDir(bool flag)
Definition woss-creator.h:148
double getEvolutionTimeQuantum(Location *const tx=CCInt::ALL_LOCATIONS, Location *const rx=CCInt::ALL_LOCATIONS) const
Definition woss-creator.h:253
WossCreator & setSimTime(const SimTime &simtime, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:339
::std::string getWrkDirPath() const
Definition woss-creator.h:154
WossCreator & eraseEvolutionTimeQuantum(Location *const tx=CCInt::ALL_LOCATIONS, Location *const rx=CCInt::ALL_LOCATIONS)
Definition woss-creator.h:271
CCSimTime ccsimtime_map
Definition woss-creator.h:444
CCInt cctotal_runs
Definition woss-creator.h:433
WossCreator & setWrkDirPath(const ::std::string &path)
Definition woss-creator.h:141
WossCreator & setEvolutionTimeQuantum(double value, const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:225
WossCreator & setTransducerHandler(const TransducerHandler *const ptr)
Definition woss-creator.h:401
double getFrequencyStep(const CoordZ &tx, const CoordZ &rx) const
Definition woss-creator.h:187
WossCreator & eraseTotalRuns(Location *const tx=CCInt::ALL_LOCATIONS, Location *const rx=CCInt::ALL_LOCATIONS)
Definition woss-creator.h:328
CCDouble ccfrequency_step
Definition woss-creator.h:438
WossCreator & eraseFrequencyStep(Location *const tx=CCDouble::ALL_LOCATIONS, Location *const rx=CCDouble::ALL_LOCATIONS)
Definition woss-creator.h:214
bool debug
Definition woss-creator.h:450
WossCreatorContainer< double > CCDouble
Definition woss-creator.h:79
WossCreator & setEvolutionTimeQuantum(double value, Location *const tx=CCInt::ALL_LOCATIONS, Location *const rx=CCInt::ALL_LOCATIONS)
Definition woss-creator.h:235
bool woss_clean_workdir
Definition woss-creator.h:460
WossCreatorContainer< SimTime > CCSimTime
Definition woss-creator.h:74
WossCreator & setWossDbManager(const WossDbManager *const ptr)
Definition woss-creator.h:393
WossCreator & eraseFrequencyStep(const CoordZ &tx, const CoordZ &rx)
Definition woss-creator.h:205
bool woss_debug
Definition woss-creator.h:455
int getTotalRuns(const CoordZ &tx, const CoordZ &rx) const
Definition woss-creator.h:301
::std::string work_dir_path
Definition woss-creator.h:422
SimTime getSimTime(Location *const tx=CCSimTime::ALL_LOCATIONS, Location *const rx=CCSimTime::ALL_LOCATIONS) const
Definition woss-creator.h:367
Abstraction layer for database and data manipulation.
Definition woss-db-manager.h:84
Abstract class that provides the interface for initializing and running a channel simulator.
Definition woss.h:94
Struct that stores start and end Time.
Definition time-definitions.h:373
Provides the interface for woss::WossCreatorContainer class.
Provides the interface for woss::Woss and woss::WossResReader classes.