Skip to content

Commit

Permalink
fix latest ns-3-dev warnings and issues (#49)
Browse files Browse the repository at this point in the history
* fixed latest warnings and issues
* fixed example
* fixed woss test
* Update README.md
  • Loading branch information
MetalKnight authored Jan 10, 2025
1 parent 43dc842 commit 748bcc1
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 164 deletions.
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ WOSS can be integrated in any network simulator or simulation tool that supports

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

How to install 'woss-ns3' with *waf*:
How to install 'woss-ns3' with *cmake*:
- download and install the recommended Acoustic Toolbox library
- with optional NetCDF support, download and install the recommended HDF5, NetCDF libraries, with NetCDF4 format support
- download and install the latest WOSS library with optional NetCDF4 and HDF5 support
- clone this repository in the `<ns3-dir>/src` path and then run one of the following:
- 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"`
- with no NetCDF support `./waf configure --with-woss-source=<woss_source_path> --with-woss-library=<woss_lib_path>`

How to install 'woss-ns3' with *cmake*:
- install the required libraries as in previous instructions
- run one of the following:
- 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>`
- 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>`
- 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>`
- finally run `./ns3 build`

How to install 'woss-ns3' with *waf* (**OBSOLETE**):
- download and install the recommended Acoustic Toolbox library
- with optional NetCDF support, download and install the recommended HDF5, NetCDF libraries, with NetCDF4 format support
- download and install the latest WOSS library with optional NetCDF4 and HDF5 support
- clone this repository in the `<ns3-dir>/src` path and then run one of the following:
- 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"`
- with no NetCDF support `./waf configure --with-woss-source=<woss_source_path> --with-woss-library=<woss_lib_path>`
- finally run `./waf build`

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

Expand Down
2 changes: 1 addition & 1 deletion examples/woss-aloha-example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Experiment::Run (uint32_t param)

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

for (int cnt = 0; cnt < 5; ++cnt)
{
Expand Down
94 changes: 47 additions & 47 deletions helper/woss-helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,18 @@ WossHelper::WossHelper ()
m_wossRandomGenStream (0),
m_randomGenProto (),
m_timeRefProto (),
m_defHandler (NULL),
m_defHandler (nullptr),
m_resDbCreatorDebug (WH_DEBUG_DEFAULT),
m_resDbDebug (WH_DEBUG_DEFAULT),
m_resDbUseBinary (true),
m_resDbUseTimeArr (true),
m_resDbSpaceSampling (WH_SPACE_SAMPLING_DEFAULT),
m_resDbFilePath (WH_STRING_DEFAULT),
m_resDbFileName (WH_STRING_DEFAULT),
m_resDbCreatorPressBin (NULL),
m_resDbCreatorPressTxt (NULL),
m_resDbCreatorTimeArrBin (NULL),
m_resDbCreatorTimeArrTxt (NULL),
m_resDbCreatorPressBin (nullptr),
m_resDbCreatorPressTxt (nullptr),
m_resDbCreatorTimeArrBin (nullptr),
m_resDbCreatorTimeArrTxt (nullptr),
#if defined (WOSS_NETCDF_SUPPORT)
m_sedimDbCreatorDebug (WH_DEBUG_DEFAULT),
m_sedimDbDebug (WH_DEBUG_DEFAULT),
Expand All @@ -208,22 +208,22 @@ WossHelper::WossHelper ()
m_sedimDbCoordFilePath (WH_STRING_DEFAULT),
m_sedimDbMarsdenFilePath (WH_STRING_DEFAULT),
m_sedimDbMarsdenOneFilePath (WH_STRING_DEFAULT),
m_sedimDbCreator (NULL),
m_sedimDbCreator (nullptr),
m_sspDbCreatorDebug (WH_DEBUG_DEFAULT),
m_sspDbDebug (WH_DEBUG_DEFAULT),
m_sspDbFilePath (WH_STRING_DEFAULT),
#if defined (WOSS_NETCDF4_SUPPORT)
m_sspWoaDbType (WH_WOA_DB_TYPE_DEFAULT),
#endif // defined (WOSS_NETCDF_SUPPORT)
m_sspDbCreator (NULL),
m_sspDbCreator (nullptr),
m_bathyDbCreatorDebug (WH_DEBUG_DEFAULT),
m_bathyDbDebug (WH_DEBUG_DEFAULT),
m_bathyDbGebcoFormat(WH_GEBCO_FORMAT_DEFAULT),
m_bathyDbFilePath (WH_STRING_DEFAULT),
m_bathyDbCreator (NULL),
m_bathyDbCreator (nullptr),
#endif // defined (WOSS_NETCDF_SUPPORT)
m_wossDbManagerDebug (WH_DEBUG_DEFAULT),
m_wossDbManager (NULL),
m_wossDbManager (nullptr),
m_wossCreatorDebug (WH_DEBUG_DEFAULT),
m_wossDebug (WH_DEBUG_DEFAULT),
m_wossClearWorkDir (true),
Expand Down Expand Up @@ -255,18 +255,18 @@ WossHelper::WossHelper ()
m_bellhopArrSyntax (WH_BELLHOP_ARR_SYNTAX_DEFAULT),
m_bellhopShdSyntax (WH_BELLHOP_SHD_SYNTAX_DEFAULT),
m_simTime (),
m_bellhopCreator (NULL),
m_bellhopCreator (nullptr),
m_boxDepth (WH_BOX_DEPTH),
m_boxRange (WH_BOX_RANGE),
m_wossManagerDebug (WH_DEBUG_DEFAULT),
m_isTimeEvolutionActive (false),
m_concurrentThreads (WH_CONCURRENT_THREADS_DEFAULT),
m_wossManagerSpaceSampling (WH_SPACE_SAMPLING_DEFAULT),
m_wossManagerUseMultiThread (false),
m_wossManagerSimple (NULL),
m_wossManagerMulti (NULL),
m_wossManagerSimple (nullptr),
m_wossManagerMulti (nullptr),
m_wossTransducerHndlDebug (WH_DEBUG_DEFAULT),
m_wossTransducerHndl (NULL),
m_wossTransducerHndl (nullptr),
m_wossControllerDebug (WH_DEBUG_DEFAULT),
m_wossController (),
m_initialized (false)
Expand All @@ -287,69 +287,69 @@ WossHelper::DoDispose (void)

DeleteWossLocationMap ();

if (m_wossManagerSimple != NULL)
if (m_wossManagerSimple != nullptr)
{
delete m_wossManagerSimple;
}

if (m_wossManagerMulti != NULL)
if (m_wossManagerMulti != nullptr)
{
delete m_wossManagerMulti;
}

if (m_wossTransducerHndl != NULL)
if (m_wossTransducerHndl != nullptr)
{
delete m_wossTransducerHndl;
}

if (m_bellhopCreator != NULL)
if (m_bellhopCreator != nullptr)
{
delete m_bellhopCreator;
}

if (m_wossDbManager != NULL)
if (m_wossDbManager != nullptr)
{
delete m_wossDbManager;
}

#if defined (WOSS_NETCDF_SUPPORT)
if (m_bathyDbCreator != NULL)
if (m_bathyDbCreator != nullptr)
{
delete m_bathyDbCreator;
}

if (m_sspDbCreator != NULL)
if (m_sspDbCreator != nullptr)
{
delete m_sspDbCreator;
}

if (m_sedimDbCreator != NULL)
if (m_sedimDbCreator != nullptr)
{
delete m_sedimDbCreator;
}
#endif // defined (WOSS_NETCDF_SUPPORT)

if (m_resDbCreatorPressBin != NULL)
if (m_resDbCreatorPressBin != nullptr)
{
delete m_resDbCreatorPressBin;
}

if (m_resDbCreatorPressTxt != NULL)
if (m_resDbCreatorPressTxt != nullptr)
{
delete m_resDbCreatorPressTxt;
}

if (m_resDbCreatorTimeArrBin != NULL)
if (m_resDbCreatorTimeArrBin != nullptr)
{
delete m_resDbCreatorTimeArrBin;
}

if (m_resDbCreatorTimeArrTxt != NULL)
if (m_resDbCreatorTimeArrTxt != nullptr)
{
delete m_resDbCreatorTimeArrTxt;
}

if (m_wossController != NULL)
if (m_wossController != nullptr)
{
delete m_wossController;
}
Expand Down Expand Up @@ -605,7 +605,7 @@ WossHelper::GetWossLocation ( Ptr< MobilityModel > ptr )
{
NS_LOG_FUNCTION (this << ptr);

WossLocation* retValue = NULL;
WossLocation* retValue = nullptr;

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

Expand All @@ -630,7 +630,7 @@ WossHelper::DeleteWossLocationMap (void)
{
for ( MLMCIter it = m_locMap.begin (); it != m_locMap.end (); ++it )
{
if (it->second != NULL)
if (it->second != nullptr)
{
delete it->second;
}
Expand Down Expand Up @@ -673,9 +673,9 @@ WossHelper::SetAngles ( const woss::CustomAngles& angles, Ptr<MobilityModel> tx,
{
CheckInitialized ();

if ( tx == NULL )
if ( tx == nullptr )
{
if ( rx == NULL )
if ( rx == nullptr )
{
m_bellhopCreator->setAngles (angles);
}
Expand All @@ -689,7 +689,7 @@ WossHelper::SetAngles ( const woss::CustomAngles& angles, Ptr<MobilityModel> tx,
{
WossLocation* txLoc = GetWossLocation ( tx );

if ( rx == NULL )
if ( rx == nullptr )
{
m_bellhopCreator->eraseAngles ( txLoc );
}
Expand All @@ -709,9 +709,9 @@ WossHelper::GetAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx ) const
{
CheckInitialized ();

if ( tx == NULL )
if ( tx == nullptr )
{
if ( rx == NULL )
if ( rx == nullptr )
{
return m_bellhopCreator->getAngles ();
}
Expand All @@ -725,7 +725,7 @@ WossHelper::GetAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx ) const
{
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );

if ( rx == NULL )
if ( rx == nullptr )
{
return m_bellhopCreator->getAngles ( txLoc );
}
Expand All @@ -743,9 +743,9 @@ WossHelper::EraseAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx )
{
CheckInitialized ();

if ( tx == NULL )
if ( tx == nullptr )
{
if ( rx == NULL )
if ( rx == nullptr )
{
m_bellhopCreator->eraseAngles ();
}
Expand All @@ -759,7 +759,7 @@ WossHelper::EraseAngles ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx )
{
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );

if ( rx == NULL )
if ( rx == nullptr )
{
m_bellhopCreator->eraseAngles ( txLoc );
}
Expand Down Expand Up @@ -838,9 +838,9 @@ WossHelper::SetCustomTransducer ( const woss::CustomTransducer& type, Ptr<Mobili
{
CheckInitialized ();

if ( tx == NULL )
if ( tx == nullptr )
{
if ( rx == NULL )
if ( rx == nullptr )
{
m_bellhopCreator->setCustomTransducer (type);
}
Expand All @@ -854,7 +854,7 @@ WossHelper::SetCustomTransducer ( const woss::CustomTransducer& type, Ptr<Mobili
{
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );

if ( rx == NULL )
if ( rx == nullptr )
{
m_bellhopCreator->setCustomTransducer ( type, txLoc );
}
Expand All @@ -874,9 +874,9 @@ WossHelper::GetCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx )
{
CheckInitialized ();

if ( tx == NULL )
if ( tx == nullptr )
{
if ( rx == NULL )
if ( rx == nullptr )
{
return m_bellhopCreator->getCustomTransducer ();
}
Expand All @@ -890,7 +890,7 @@ WossHelper::GetCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx )
{
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );

if ( rx == NULL )
if ( rx == nullptr )
{
return m_bellhopCreator->getCustomTransducer ( txLoc );
}
Expand All @@ -908,9 +908,9 @@ WossHelper::EraseCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx
{
CheckInitialized ();

if ( tx == NULL )
if ( tx == nullptr )
{
if ( rx == NULL )
if ( rx == nullptr )
{
m_bellhopCreator->eraseCustomTransducer ();
}
Expand All @@ -924,7 +924,7 @@ WossHelper::EraseCustomTransducer ( Ptr<MobilityModel> tx, Ptr<MobilityModel> rx
{
WossLocation* txLoc = const_cast<WossHelper*> (this)->GetWossLocation ( tx );

if ( rx == NULL )
if ( rx == nullptr )
{
m_bellhopCreator->eraseCustomTransducer ( txLoc );
}
Expand Down Expand Up @@ -1286,7 +1286,7 @@ WossHelper::CreateDirectory (const ::std::string& path)

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

if (system (NULL))
if (system (nullptr))
{
ret_value = system (command.c_str ());
}
Expand Down
4 changes: 2 additions & 2 deletions model/woss-channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ WossChannel::WossChannel ()
: UanChannel (),
m_channelEqSnrThresDb (WOSS_CHANNEL_SNR_EQ_THRES_DB),
// -infinite snr ==> first tap
m_wossPropModel (NULL)
m_wossPropModel (nullptr)
{
}

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

m_wossPropModel = DynamicCast< WossPropModel > ( m_prop );

NS_ASSERT ( m_wossPropModel != NULL );
NS_ASSERT ( m_wossPropModel != nullptr );

UanChannel::DoInitialize ();
}
Expand Down
2 changes: 1 addition & 1 deletion model/woss-position-allocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ WossGridPositionAllocator::GetTypeId (void)
MakeDoubleChecker<double> ())
.AddAttribute ("LayoutType", "The type of layout.",
EnumValue (ROW_FIRST),
MakeEnumAccessor (&WossGridPositionAllocator::m_layoutType),
MakeEnumAccessor<LayoutType> (&WossGridPositionAllocator::m_layoutType),
MakeEnumChecker (ROW_FIRST, "RowFirst",
COLUMN_FIRST, "ColumnFirst"))
;
Expand Down
Loading

0 comments on commit 748bcc1

Please sign in to comment.