From 0a813ecf9b2c2153ca7b8aa24ad66fdffad487a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Wed, 29 Sep 2021 01:45:57 +0200 Subject: [PATCH] Fix documentation and deprecation warnings (#265) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The poll() API with integer timeout is deprecated. Use std::chrono::duration instead. Signed-off-by: Alejandro Hernández Signed-off-by: Steve Peters Signed-off-by: Louise Poubel Co-authored-by: Steve Peters Co-authored-by: Louise Poubel --- README.md | 2 +- example/bench.cc | 5 +++-- src/Discovery.cc | 3 ++- src/NodeShared.cc | 4 ++-- src/NodeSharedPrivate.hh | 2 +- tutorials/02_installation.md | 31 ++++++++++++++++++++++++++++++- 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 96a7ca989..5f4f1da8e 100644 --- a/README.md +++ b/README.md @@ -86,12 +86,12 @@ Visit the [documentation page](https://ignitionrobotics.org/api/transport/11.0/i ``` ign-transport ├── conf Configuration file for the integration with the `ign` CLI tool. +├── docker Dockerfile with ign-transport installed and scripts to build and run the code. ├── example Example programs that use most of the Ignition Transport API. ├── include Header files that get installed. ├── log All the code related with Ignition Transport logging. ├── src Source code of the core library. ├── test A directory of integration, performance and regression tests. -├── tools Scripts for continuous integration testing. └── tutorials A set of tutorials about Ignition Transport features. ``` diff --git a/example/bench.cc b/example/bench.cc index af944de87..aa894bf84 100644 --- a/example/bench.cc +++ b/example/bench.cc @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -233,7 +234,7 @@ class ReplyTester std::cerr << "Received[" << _msg.header().stamp().sec() << "] Expected[" << this->prevStamp+1 << "]\n"; - throw std::unexpected; + std::terminate(); } } @@ -548,7 +549,7 @@ class PubTester { std::cerr << "Received[" << _msg.header().stamp().sec() << "] Expected[" << this->expectedStamp << "]\n"; - throw std::unexpected; + std::terminate(); } this->expectedStamp++; diff --git a/src/Discovery.cc b/src/Discovery.cc index 074a34857..de6e301ee 100644 --- a/src/Discovery.cc +++ b/src/Discovery.cc @@ -51,7 +51,8 @@ inline namespace IGNITION_TRANSPORT_VERSION_NAMESPACE try { - zmq::poll(&items[0], sizeof(items) / sizeof(items[0]), _timeout); + zmq::poll(&items[0], sizeof(items) / sizeof(items[0]), + std::chrono::milliseconds(_timeout)); } catch(...) { diff --git a/src/NodeShared.cc b/src/NodeShared.cc index 8ef336043..c374945d7 100644 --- a/src/NodeShared.cc +++ b/src/NodeShared.cc @@ -352,7 +352,7 @@ void NodeShared::RunReceptionTask() try { zmq::poll(&items[0], sizeof(items) / sizeof(items[0]), - NodeSharedPrivate::Timeout); + std::chrono::milliseconds(NodeSharedPrivate::Timeout)); } catch(...) { @@ -1677,7 +1677,7 @@ void NodeSharedPrivate::AccessControlHandler() try { zmq::poll(&items[0], sizeof(items) / sizeof(items[0]), - NodeSharedPrivate::Timeout); + std::chrono::milliseconds(NodeSharedPrivate::Timeout)); } catch(...) { diff --git a/src/NodeSharedPrivate.hh b/src/NodeSharedPrivate.hh index 1bc7e5030..1c3e472de 100644 --- a/src/NodeSharedPrivate.hh +++ b/src/NodeSharedPrivate.hh @@ -137,7 +137,7 @@ namespace ignition public: std::atomic exit = false; /// \brief Timeout used for receiving messages (ms.). - public: static const int Timeout = 250; + public: inline static const int Timeout = 250; //////////////////////////////////////////////////////////////// /////// The following is for asynchronous publication of /////// diff --git a/tutorials/02_installation.md b/tutorials/02_installation.md index 3a13d0c3c..0e5b7ef92 100644 --- a/tutorials/02_installation.md +++ b/tutorials/02_installation.md @@ -170,6 +170,36 @@ cd /tmp/ign-transport/build sudo make uninstall ``` +### macOS + +1. Clone the repository + ``` + git clone https://github.com/ignitionrobotics/ign-transport -b ign-transport<#> + ``` + Be sure to replace `<#>` with a number value, such as 10 or 11, depending on + which version you need. + +2. Install dependencies + ``` + brew install --only-dependencies ignition-transport<#> + ``` + Be sure to replace `<#>` with a number value, such as 10 or 11, depending on + which version you need. + +3. Configure and build + ``` + cd ign-transport + mkdir build + cd build + cmake .. + make + ``` + +4. Optionally, install + ``` + sudo make install + ``` + ## Windows ### Prerequisites @@ -273,4 +303,3 @@ can run: ``` make test ``` -