Skip to content

Commit 748bcc1

Browse files
authored
fix latest ns-3-dev warnings and issues (#49)
* fixed latest warnings and issues * fixed example * fixed woss test * Update README.md
1 parent 43dc842 commit 748bcc1

File tree

6 files changed

+159
-164
lines changed

6 files changed

+159
-164
lines changed

README.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,23 @@ WOSS can be integrated in any network simulator or simulation tool that supports
1515

1616
Latest WOSS source code, installation instructions and related libraries can be found at https://woss.dei.unipd.it
1717

18-
How to install 'woss-ns3' with *waf*:
18+
How to install 'woss-ns3' with *cmake*:
1919
- download and install the recommended Acoustic Toolbox library
2020
- with optional NetCDF support, download and install the recommended HDF5, NetCDF libraries, with NetCDF4 format support
2121
- download and install the latest WOSS library with optional NetCDF4 and HDF5 support
2222
- clone this repository in the `<ns3-dir>/src` path and then run one of the following:
23-
- NetCDF4 and HDF5 support, *pay attention to the CXXFLAGS inline redefinition due to a unresolved NetCDF-C++4 API warning* `./waf configure
24-
--with-woss-source=<woss_source_path> --with-woss-library=<woss_lib_path> --with-netcdf4-install=<netcdf4_and_hdf5_installed_path> CXXFLAGS="-Wall -Werror -Wno-unused-variable"`
25-
- with no NetCDF support `./waf configure --with-woss-source=<woss_source_path> --with-woss-library=<woss_lib_path>`
26-
27-
How to install 'woss-ns3' with *cmake*:
28-
- install the required libraries as in previous instructions
29-
- run one of the following:
30-
- NetCDF4 and HDF5 support, *pay attention to the CXXFLAGS inline redefinition due to a unresolved NetCDF-C++4 API warning* `CXXFLAGS="-Wno-unused-variable" ./ns3 configure --enable-examples --enable-tests -- -DNS3_WITH_WOSS_SOURCE=/<woss_source_path> -DNS3_WITH_WOSS_LIBRARY=<woss_lib_path> -DNS3_WITH_NETCDF4_INSTALL=<netcdf4_and_hdf5_installed_path>`
23+
- NetCDF4 and HDF5 support, *pay attention to the CXXFLAGS inline redefinition due to a unresolved NetCDF-C++4 API warning* `CXXFLAGS="-Wno-unused-variable" ./ns3 configure --enable-examples --enable-tests -- -DNS3_WITH_WOSS_SOURCE=<woss_source_path> -DNS3_WITH_WOSS_LIBRARY=<woss_lib_path> -DNS3_WITH_NETCDF4_INSTALL=<netcdf4_and_hdf5_installed_path>`
3124
- with no NetCDF support `CXXFLAGS="-Wno-unused-variable" ./ns3 configure --enable-examples --enable-tests -- -DNS3_WITH_WOSS_SOURCE=/<woss_source_path> -DNS3_WITH_WOSS_LIBRARY=<woss_lib_path>`
25+
- finally run `./ns3 build`
26+
27+
How to install 'woss-ns3' with *waf* (**OBSOLETE**):
28+
- download and install the recommended Acoustic Toolbox library
29+
- with optional NetCDF support, download and install the recommended HDF5, NetCDF libraries, with NetCDF4 format support
30+
- download and install the latest WOSS library with optional NetCDF4 and HDF5 support
31+
- clone this repository in the `<ns3-dir>/src` path and then run one of the following:
32+
- NetCDF4 and HDF5 support, *pay attention to the CXXFLAGS inline redefinition due to a unresolved NetCDF-C++4 API warning* `./waf configure --with-woss-source=<woss_source_path> --with-woss-library=<woss_lib_path> --with-netcdf4-install=<netcdf4_and_hdf5_installed_path> CXXFLAGS="-Wall -Werror -Wno-unused-variable"`
33+
- with no NetCDF support `./waf configure --with-woss-source=<woss_source_path> --with-woss-library=<woss_lib_path>`
34+
- finally run `./waf build`
3235

3336
For info on how to install all the required libraries with the suggested paths, please check https://woss.dei.unipd.it/woss/doxygen/installation.html
3437

examples/woss-aloha-example.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ Experiment::Run (uint32_t param)
247247

248248
Ptr<Node> nodeSink = sink.Get (0);
249249
Ptr<WossWaypointMobilityModel> sinkMob = nodeSink->GetObject<WossWaypointMobilityModel> ();
250-
NS_ASSERT (sinkMob != NULL);
250+
NS_ASSERT (sinkMob != nullptr);
251251

252252
for (int cnt = 0; cnt < 5; ++cnt)
253253
{

helper/woss-helper.cc

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,18 @@ WossHelper::WossHelper ()
187187
m_wossRandomGenStream (0),
188188
m_randomGenProto (),
189189
m_timeRefProto (),
190-
m_defHandler (NULL),
190+
m_defHandler (nullptr),
191191
m_resDbCreatorDebug (WH_DEBUG_DEFAULT),
192192
m_resDbDebug (WH_DEBUG_DEFAULT),
193193
m_resDbUseBinary (true),
194194
m_resDbUseTimeArr (true),
195195
m_resDbSpaceSampling (WH_SPACE_SAMPLING_DEFAULT),
196196
m_resDbFilePath (WH_STRING_DEFAULT),
197197
m_resDbFileName (WH_STRING_DEFAULT),
198-
m_resDbCreatorPressBin (NULL),
199-
m_resDbCreatorPressTxt (NULL),
200-
m_resDbCreatorTimeArrBin (NULL),
201-
m_resDbCreatorTimeArrTxt (NULL),
198+
m_resDbCreatorPressBin (nullptr),
199+
m_resDbCreatorPressTxt (nullptr),
200+
m_resDbCreatorTimeArrBin (nullptr),
201+
m_resDbCreatorTimeArrTxt (nullptr),
202202
#if defined (WOSS_NETCDF_SUPPORT)
203203
m_sedimDbCreatorDebug (WH_DEBUG_DEFAULT),
204204
m_sedimDbDebug (WH_DEBUG_DEFAULT),
@@ -208,22 +208,22 @@ WossHelper::WossHelper ()
208208
m_sedimDbCoordFilePath (WH_STRING_DEFAULT),
209209
m_sedimDbMarsdenFilePath (WH_STRING_DEFAULT),
210210
m_sedimDbMarsdenOneFilePath (WH_STRING_DEFAULT),
211-
m_sedimDbCreator (NULL),
211+
m_sedimDbCreator (nullptr),
212212
m_sspDbCreatorDebug (WH_DEBUG_DEFAULT),
213213
m_sspDbDebug (WH_DEBUG_DEFAULT),
214214
m_sspDbFilePath (WH_STRING_DEFAULT),
215215
#if defined (WOSS_NETCDF4_SUPPORT)
216216
m_sspWoaDbType (WH_WOA_DB_TYPE_DEFAULT),
217217
#endif // defined (WOSS_NETCDF_SUPPORT)
218-
m_sspDbCreator (NULL),
218+
m_sspDbCreator (nullptr),
219219
m_bathyDbCreatorDebug (WH_DEBUG_DEFAULT),
220220
m_bathyDbDebug (WH_DEBUG_DEFAULT),
221221
m_bathyDbGebcoFormat(WH_GEBCO_FORMAT_DEFAULT),
222222
m_bathyDbFilePath (WH_STRING_DEFAULT),
223-
m_bathyDbCreator (NULL),
223+
m_bathyDbCreator (nullptr),
224224
#endif // defined (WOSS_NETCDF_SUPPORT)
225225
m_wossDbManagerDebug (WH_DEBUG_DEFAULT),
226-
m_wossDbManager (NULL),
226+
m_wossDbManager (nullptr),
227227
m_wossCreatorDebug (WH_DEBUG_DEFAULT),
228228
m_wossDebug (WH_DEBUG_DEFAULT),
229229
m_wossClearWorkDir (true),
@@ -255,18 +255,18 @@ WossHelper::WossHelper ()
255255
m_bellhopArrSyntax (WH_BELLHOP_ARR_SYNTAX_DEFAULT),
256256
m_bellhopShdSyntax (WH_BELLHOP_SHD_SYNTAX_DEFAULT),
257257
m_simTime (),
258-
m_bellhopCreator (NULL),
258+
m_bellhopCreator (nullptr),
259259
m_boxDepth (WH_BOX_DEPTH),
260260
m_boxRange (WH_BOX_RANGE),
261261
m_wossManagerDebug (WH_DEBUG_DEFAULT),
262262
m_isTimeEvolutionActive (false),
263263
m_concurrentThreads (WH_CONCURRENT_THREADS_DEFAULT),
264264
m_wossManagerSpaceSampling (WH_SPACE_SAMPLING_DEFAULT),
265265
m_wossManagerUseMultiThread (false),
266-
m_wossManagerSimple (NULL),
267-
m_wossManagerMulti (NULL),
266+
m_wossManagerSimple (nullptr),
267+
m_wossManagerMulti (nullptr),
268268
m_wossTransducerHndlDebug (WH_DEBUG_DEFAULT),
269-
m_wossTransducerHndl (NULL),
269+
m_wossTransducerHndl (nullptr),
270270
m_wossControllerDebug (WH_DEBUG_DEFAULT),
271271
m_wossController (),
272272
m_initialized (false)
@@ -287,69 +287,69 @@ WossHelper::DoDispose (void)
287287

288288
DeleteWossLocationMap ();
289289

290-
if (m_wossManagerSimple != NULL)
290+
if (m_wossManagerSimple != nullptr)
291291
{
292292
delete m_wossManagerSimple;
293293
}
294294

295-
if (m_wossManagerMulti != NULL)
295+
if (m_wossManagerMulti != nullptr)
296296
{
297297
delete m_wossManagerMulti;
298298
}
299299

300-
if (m_wossTransducerHndl != NULL)
300+
if (m_wossTransducerHndl != nullptr)
301301
{
302302
delete m_wossTransducerHndl;
303303
}
304304

305-
if (m_bellhopCreator != NULL)
305+
if (m_bellhopCreator != nullptr)
306306
{
307307
delete m_bellhopCreator;
308308
}
309309

310-
if (m_wossDbManager != NULL)
310+
if (m_wossDbManager != nullptr)
311311
{
312312
delete m_wossDbManager;
313313
}
314314

315315
#if defined (WOSS_NETCDF_SUPPORT)
316-
if (m_bathyDbCreator != NULL)
316+
if (m_bathyDbCreator != nullptr)
317317
{
318318
delete m_bathyDbCreator;
319319
}
320320

321-
if (m_sspDbCreator != NULL)
321+
if (m_sspDbCreator != nullptr)
322322
{
323323
delete m_sspDbCreator;
324324
}
325325

326-
if (m_sedimDbCreator != NULL)
326+
if (m_sedimDbCreator != nullptr)
327327
{
328328
delete m_sedimDbCreator;
329329
}
330330
#endif // defined (WOSS_NETCDF_SUPPORT)
331331

332-
if (m_resDbCreatorPressBin != NULL)
332+
if (m_resDbCreatorPressBin != nullptr)
333333
{
334334
delete m_resDbCreatorPressBin;
335335
}
336336

337-
if (m_resDbCreatorPressTxt != NULL)
337+
if (m_resDbCreatorPressTxt != nullptr)
338338
{
339339
delete m_resDbCreatorPressTxt;
340340
}
341341

342-
if (m_resDbCreatorTimeArrBin != NULL)
342+
if (m_resDbCreatorTimeArrBin != nullptr)
343343
{
344344
delete m_resDbCreatorTimeArrBin;
345345
}
346346

347-
if (m_resDbCreatorTimeArrTxt != NULL)
347+
if (m_resDbCreatorTimeArrTxt != nullptr)
348348
{
349349
delete m_resDbCreatorTimeArrTxt;
350350
}
351351

352-
if (m_wossController != NULL)
352+
if (m_wossController != nullptr)
353353
{
354354
delete m_wossController;
355355
}
@@ -605,7 +605,7 @@ WossHelper::GetWossLocation ( Ptr< MobilityModel > ptr )
605605
{
606606
NS_LOG_FUNCTION (this << ptr);
607607

608-
WossLocation* retValue = NULL;
608+
WossLocation* retValue = nullptr;
609609

610610
MLMCIter it = m_locMap.find (PeekPointer (ptr));
611611

@@ -630,7 +630,7 @@ WossHelper::DeleteWossLocationMap (void)
630630
{
631631
for ( MLMCIter it = m_locMap.begin (); it != m_locMap.end (); ++it )
632632
{
633-
if (it->second != NULL)
633+
if (it->second != nullptr)
634634
{
635635
delete it->second;
636636
}
@@ -673,9 +673,9 @@ WossHelper::SetAngles ( const woss::CustomAngles& angles, Ptr<MobilityModel> tx,
673673
{
674674
CheckInitialized ();
675675

676-
if ( tx == NULL )
676+
if ( tx == nullptr )
677677
{
678-
if ( rx == NULL )
678+
if ( rx == nullptr )
679679
{
680680
m_bellhopCreator->setAngles (angles);
681681
}
@@ -689,7 +689,7 @@ WossHelper::SetAngles ( const woss::CustomAngles& angles, Ptr<MobilityModel> tx,
689689
{
690690
WossLocation* txLoc = GetWossLocation ( tx );
691691

692-
if ( rx == NULL )
692+
if ( rx == nullptr )
693693
{
694694
m_bellhopCreator->eraseAngles ( txLoc );
695695
}
@@ -709,9 +709,9 @@ WossHelper::GetAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx ) const
709709
{
710710
CheckInitialized ();
711711

712-
if ( tx == NULL )
712+
if ( tx == nullptr )
713713
{
714-
if ( rx == NULL )
714+
if ( rx == nullptr )
715715
{
716716
return m_bellhopCreator->getAngles ();
717717
}
@@ -725,7 +725,7 @@ WossHelper::GetAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx ) const
725725
{
726726
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );
727727

728-
if ( rx == NULL )
728+
if ( rx == nullptr )
729729
{
730730
return m_bellhopCreator->getAngles ( txLoc );
731731
}
@@ -743,9 +743,9 @@ WossHelper::EraseAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx )
743743
{
744744
CheckInitialized ();
745745

746-
if ( tx == NULL )
746+
if ( tx == nullptr )
747747
{
748-
if ( rx == NULL )
748+
if ( rx == nullptr )
749749
{
750750
m_bellhopCreator->eraseAngles ();
751751
}
@@ -759,7 +759,7 @@ WossHelper::EraseAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx )
759759
{
760760
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );
761761

762-
if ( rx == NULL )
762+
if ( rx == nullptr )
763763
{
764764
m_bellhopCreator->eraseAngles ( txLoc );
765765
}
@@ -838,9 +838,9 @@ WossHelper::SetCustomTransducer ( const woss::CustomTransducer& type, Ptr<Mobili
838838
{
839839
CheckInitialized ();
840840

841-
if ( tx == NULL )
841+
if ( tx == nullptr )
842842
{
843-
if ( rx == NULL )
843+
if ( rx == nullptr )
844844
{
845845
m_bellhopCreator->setCustomTransducer (type);
846846
}
@@ -854,7 +854,7 @@ WossHelper::SetCustomTransducer ( const woss::CustomTransducer& type, Ptr<Mobili
854854
{
855855
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );
856856

857-
if ( rx == NULL )
857+
if ( rx == nullptr )
858858
{
859859
m_bellhopCreator->setCustomTransducer ( type, txLoc );
860860
}
@@ -874,9 +874,9 @@ WossHelper::GetCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx )
874874
{
875875
CheckInitialized ();
876876

877-
if ( tx == NULL )
877+
if ( tx == nullptr )
878878
{
879-
if ( rx == NULL )
879+
if ( rx == nullptr )
880880
{
881881
return m_bellhopCreator->getCustomTransducer ();
882882
}
@@ -890,7 +890,7 @@ WossHelper::GetCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx )
890890
{
891891
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );
892892

893-
if ( rx == NULL )
893+
if ( rx == nullptr )
894894
{
895895
return m_bellhopCreator->getCustomTransducer ( txLoc );
896896
}
@@ -908,9 +908,9 @@ WossHelper::EraseCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx
908908
{
909909
CheckInitialized ();
910910

911-
if ( tx == NULL )
911+
if ( tx == nullptr )
912912
{
913-
if ( rx == NULL )
913+
if ( rx == nullptr )
914914
{
915915
m_bellhopCreator->eraseCustomTransducer ();
916916
}
@@ -924,7 +924,7 @@ WossHelper::EraseCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx
924924
{
925925
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );
926926

927-
if ( rx == NULL )
927+
if ( rx == nullptr )
928928
{
929929
m_bellhopCreator->eraseCustomTransducer ( txLoc );
930930
}
@@ -1286,7 +1286,7 @@ WossHelper::CreateDirectory (const ::std::string& path)
12861286

12871287
NS_LOG_DEBUG ("WossHelper::CreateDirectory () command = " << command);
12881288

1289-
if (system (NULL))
1289+
if (system (nullptr))
12901290
{
12911291
ret_value = system (command.c_str ());
12921292
}

model/woss-channel.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ WossChannel::WossChannel ()
7171
: UanChannel (),
7272
m_channelEqSnrThresDb (WOSS_CHANNEL_SNR_EQ_THRES_DB),
7373
// -infinite snr ==> first tap
74-
m_wossPropModel (NULL)
74+
m_wossPropModel (nullptr)
7575
{
7676
}
7777

@@ -87,7 +87,7 @@ WossChannel::DoInitialize (void)
8787

8888
m_wossPropModel = DynamicCast< WossPropModel > ( m_prop );
8989

90-
NS_ASSERT ( m_wossPropModel != NULL );
90+
NS_ASSERT ( m_wossPropModel != nullptr );
9191

9292
UanChannel::DoInitialize ();
9393
}

model/woss-position-allocator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ WossGridPositionAllocator::GetTypeId (void)
113113
MakeDoubleChecker<double> ())
114114
.AddAttribute ("LayoutType", "The type of layout.",
115115
EnumValue (ROW_FIRST),
116-
MakeEnumAccessor (&WossGridPositionAllocator::m_layoutType),
116+
MakeEnumAccessor<LayoutType> (&WossGridPositionAllocator::m_layoutType),
117117
MakeEnumChecker (ROW_FIRST, "RowFirst",
118118
COLUMN_FIRST, "ColumnFirst"))
119119
;

0 commit comments

Comments
 (0)