World Ocean Simulation System (WOSS) library
definitions-handler.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_DEF_HANDLER_H
41#define WOSS_DEF_HANDLER_H
42
43
44#include <cassert>
46#include <time-definitions.h>
48
49
50namespace woss {
51
52
53 class WossDbCreator;
54 class WossCreator;
55 class WossDbManager;
56 class WossManager;
57 class SSP;
58 class Sediment;
59 class Pressure;
60 class TimeArr;
61 class Transducer;
62 class Altimetry;
63
64
75 class DefHandler {
76
77
78 public:
79
80
84 DefHandler();
85
86
90 DefHandler( const DefHandler& copy );
91
95 DefHandler& operator=( const DefHandler& copy );
96
97
101 virtual ~DefHandler();
102
103
108 double getRand() const;
109
114 int getRandInt() const;
115
116
121 double getTimeReference() const;
122
123
124 void setPressure( Pressure* const ptr ) { pressure_creator = ptr; }
125
126 void setTimeArr( TimeArr* const ptr ) { time_arr_creator = ptr; }
127
128 void setSSP( SSP* const ptr ) { ssp_creator = ptr; }
129
130 void setSediment( Sediment* const ptr ) { sediment_creator = ptr; }
131
132 void setTimeReference( TimeReference* const ptr ) { time_reference = ptr; }
133
134 void setRandGenerator( RandomGenerator* const ptr ) { rand_generator = ptr; }
135
136 void setTransducer( Transducer* const ptr ) { transducer = ptr; }
137
138 void setAltimetry( Altimetry* const ptr ) { altimetry_creator = ptr; }
139
140
141 const Pressure* const getPressure() const { assert(pressure_creator); return pressure_creator; }
142
143 const TimeArr* const getTimeArr() const { assert(time_arr_creator); return time_arr_creator; }
144
145 const SSP* const getSSP() const { assert(ssp_creator); return ssp_creator; }
146
147 const Sediment* const getSediment() const { assert(sediment_creator); return sediment_creator; }
148
149 RandomGenerator* const getRandomGenerator() const { assert(rand_generator); return rand_generator; }
150
151 const Transducer* const getTransducer() const { assert(transducer); return transducer; }
152
153 const Altimetry* const getAltimetry() const { assert(altimetry_creator); return altimetry_creator; }
154
155
156 void setDebug( bool flag ) { debug = flag; }
157
158 bool getDebug() { return debug; }
159
160
161 protected:
162
163
167 bool debug;
168
169
170 SSP* ssp_creator;
171
172 Sediment* sediment_creator;
173
174 Pressure* pressure_creator;
175
176 TimeArr* time_arr_creator;
177
178 TimeReference* time_reference;
179
180 RandomGenerator* rand_generator;
181
182 Transducer* transducer;
183
184 Altimetry* altimetry_creator;
185
186 };
187
188
195
196
197 //inline functions
198
199 inline double DefHandler::getRand() const {
200 if (rand_generator) return rand_generator->getRand();
201 else {
202 ::std::cerr << "DefHandler::getRand() ERROR, random generator wasn't set" << ::std::endl;
203 exit(1);
204 }
205 }
206
207
208 inline int DefHandler::getRandInt() const {
209 if (rand_generator) return rand_generator->getRandInt();
210 else {
211 ::std::cerr << "DefHandler::getRandInt() ERROR, random generator wasn't set" << ::std::endl;
212 exit(1);
213 }
214 }
215
216
217 inline double DefHandler::getTimeReference() const {
218 if (time_reference) return time_reference->getTimeReference();
219 else {
220 ::std::cerr << "DefHandler::getTimeReference() ERROR, time reference wasn't set" << ::std::endl;
221 exit(1);
222 }
223 }
224
225
226}
227
228
229#endif /* WOSS_DEF_HANDLER_H */
Altimetry profile class.
Definition altimetry-definitions.h:78
Class for managing dynamic instantiation of foundation classes.
Definition definitions-handler.h:75
int getRandInt() const
Definition definitions-handler.h:208
bool debug
Definition definitions-handler.h:167
double getTimeReference() const
Definition definitions-handler.h:217
virtual ~DefHandler()
Definition definitions-handler.cpp:97
DefHandler()
Definition definitions-handler.cpp:51
double getRand() const
Definition definitions-handler.h:199
DefHandler & operator=(const DefHandler &copy)
Definition definitions-handler.cpp:82
Complex attenuated pressure class.
Definition pressure-definitions.h:59
woss::RandomGenerator class
Definition random-generator-definitions.h:56
virtual int getRandInt() const
Definition random-generator-definitions.cpp:65
virtual double getRand() const
Definition random-generator-definitions.cpp:55
SSP class offers multiple creation and manipulation capabilities for sound speed profile.
Definition ssp-definitions.h:258
Surficial sediment geoacoustic parameters definitions.
Definition sediment-definitions.h:63
Singleton design pattern template.
Definition singleton-definitions.h:54
Channel power delay profile class.
Definition time-arrival-definitions.h:82
Class for simulation time reference purposes.
Definition time-definitions.h:63
virtual double getTimeReference() const =0
Transducer class.
Definition transducer-definitions.h:70
Definitions and library for woss::RandomGenerator class.
Definitions of woss::Singleton template.
Definitions and library for woss::Time, woss::SimTime, woss::TimeReference and woss::TimeReferenceTcl...